Skip to content
  1. Jun 05, 2007
    • Chris Lattner's avatar
      8394d795
    • Chris Lattner's avatar
    • Chris Lattner's avatar
      add some fixme's for incorrect sema · 1d411a82
      Chris Lattner authored
      llvm-svn: 39591
      1d411a82
    • Chris Lattner's avatar
      rename forstmt accessors, add const accessors · 6d26a03d
      Chris Lattner authored
      llvm-svn: 39590
      6d26a03d
    • Steve Naroff's avatar
      Bug #: · 6d9de3dd
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Touch up a couple comments (one was incorrect/out-of-date).
      
      llvm-svn: 39589
      6d9de3dd
    • Chris Lattner's avatar
      add another fixme · 66cfa8ad
      Chris Lattner authored
      llvm-svn: 39588
      66cfa8ad
    • Chris Lattner's avatar
      Rename Sema::isConstantArrayType -> VerifyConstantArrayType. Make sure to · 6046e008
      Chris Lattner authored
      check canonical types in a few places.  Tighten up VerifyConstantArrayType
      to diagnose more errors, now that we can evaluate i-c-e's.  Add some fixmes
      about poor diagnostics.
      
      We now correctly typecheck this example:
      
      void s(void) {
        typedef int a[(int) +1.0];
        static a b;    // invalid, static VLA
      
        static int c[(int) +1.0];  // invalid, static VLA
      }
      
      void t(void) {
        typedef int a[(int)1.0];
        static a b;    // valid, constant size
      }
      
      void u() {
        static int X[-1];
        static int Y[0];
      }
      
      producing:
      
      static-vla.c:3:12: error: variable length array declared outside of any function
        static a b;    // invalid, static VLA
                 ^
      static-vla.c:5:14: error: variable length array declared outside of any function
        static int c[(int) +1.0];  // invalid, static VLA
                   ^ ~~~~~~~~~~
      static-vla.c:15:14: error: array size is negative
        static int X[-1];
                   ^ ~~
      static-vla.c:16:14: warning: zero size arrays are an extension
        static int Y[0];
                   ^ ~
      
      llvm-svn: 39587
      6046e008
    • Chris Lattner's avatar
      simplify Type::isConstantSizeType based on knowledge that it is only called · 3e4dabe4
      Chris Lattner authored
      on complete types.
      
      llvm-svn: 39586
      3e4dabe4
    • Chris Lattner's avatar
      Change Expr::isIntegerConstantExpr in two ways: · e0da5dc8
      Chris Lattner authored
        1. Compute and return the value of the i-c-e if the expression is one.
        2. Use this computation to correctly track whether subexprs are being
           evaluated, and use this to guide diagnostics appropriately.
      
      This allows us to correctly handle all the cases in:
      
      void bar() {
        int foo();
        switch (1) {
        case 1 ? 0 : foo():    // bad
        case 0 ? 0 : foo():    // bad
      
        case 0 ? 1/0 : 14 :  // ok
        case 1 ? 1/0 : 14 :  // bad
          ;
        }
      
        switch (1) {
        case 1 ? 2: (2, 3): // ok
        case 0 ? 2: (2, 3): // invalid comma.
          ;
        }
      }
      
      This code has numerous todo items.  Specifically, we need to:
        1. Pass in target info, so we know the size of the integers we are producing.
        2. Model type sizes and alignments correctly, so we can eval sizeof/alignof
        3. Handle promotions (need to talk to steve about this).
        4. Return an enum that can be used to better diagnose problems with i-c-e's.
           instead of just saying "this isn't valid" we should be able to say why.
        5. Various other miscellanea, like handling enums and character literals
           properly.
      
      llvm-svn: 39585
      e0da5dc8
    • Chris Lattner's avatar
      Nothing currently wants to know if something is a constantexpr. Simplify · 1f4479e7
      Chris Lattner authored
      isConstantExpr into just isIntegerConstantExpr in preparation for other
      changes.
      
      llvm-svn: 39584
      1f4479e7
    • Chris Lattner's avatar
      ab0b2df4
    • Chris Lattner's avatar
      946aa31f
    • Steve Naroff's avatar
      Bug #: · 71b59a9a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Fixed an "impurity" in the typechecking code (to more closely model the
      C99 spec)...
      
      - Added function Sema::DefaultFunctionArrayConversion(). This is called
      by UsualUnaryConversions(). It is also called from several contexts that
      don't call for integer promotions (logical negation for expressions, and
      while/if/do/for conditions in statements). It is also used in
      UsualAssignmentConversions (which is cleaner than the check I was using
      before).
      
      - Changed the name from UsualUnaryConversion->UsualUnaryConversions.
      
      - Added comments to the header.
      
      Since several contexts don't call for integer
      promotions,
      
      llvm-svn: 39581
      71b59a9a
  2. Jun 03, 2007
  3. Jun 02, 2007
    • Chris Lattner's avatar
      Implement translation of pointer, reference and simple array types. We now · 2b4e21ac
      Chris Lattner authored
      compile:
      
      void foo() {
        int A[10];
        int *P;
      
      into:
      
      entry:
              %A = alloca [10 x i32]          ; <[10 x i32]*> [#uses=0]
              %P = alloca i32*                ; <i32**> [#uses=0]
      
      llvm-svn: 39561
      2b4e21ac
    • Chris Lattner's avatar
      Implement a trivial optimization to reduce the number of compares emitted. · a45c5af8
      Chris Lattner authored
      For:
      
        register short X;
        if (!X) {
      
      We now produce:
      
              %tmp = load i16* %X             ; <i16> [#uses=1]
              %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
              %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
              br i1 %lnot, label %ifthen, label %ifend
      
      instead of:
      
              %tmp = load i16* %X             ; <i16> [#uses=1]
              %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
              %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
              %lnot.ext = zext i1 %lnot to i32                ; <i32> [#uses=1]
              %tobool1 = icmp ne i32 %lnot.ext, 0             ; <i1> [#uses=1]
              br i1 %tobool1, label %ifthen, label %ifend
      
      llvm-svn: 39560
      a45c5af8
    • Chris Lattner's avatar
      Refactor EvaluateScalarValueToBool out of if statement emission, so it can · f0106d25
      Chris Lattner authored
      be shared.
      
      Implement infrastructure for unary operator emission.
      
      Implement basic logical not support.  We now compile:
      
        register short X;
      
        if (!X) {
      
      into:
      
              %tmp = load i16* %X             ; <i16> [#uses=1]
              %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
              %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
              zext i1 %lnot to i32            ; <i32>:0 [#uses=1]
              %tobool1 = icmp ne i32 %0, 0            ; <i1> [#uses=1]
              br i1 %tobool1, label %ifthen, label %ifend
      
      llvm-svn: 39559
      f0106d25
    • Chris Lattner's avatar
      Correct the type of logical not. · be31ed8e
      Chris Lattner authored
      llvm-svn: 39558
      be31ed8e
    • Bill Wendling's avatar
      Submitted by: Bill Wendling · d6de6574
      Bill Wendling authored
      - Added C99 reference to why "auto" and "register" cannot be used as a
        storage class specifier for file scoped variable declarations.
      
      llvm-svn: 39557
      d6de6574
    • Chris Lattner's avatar
      Pretty print storage classes for vardecls. · b4522b4d
      Chris Lattner authored
      llvm-svn: 39556
      b4522b4d
    • Chris Lattner's avatar
      Implement scaffolding for lvalues. Implement block vardecl lvalues. · d7f58867
      Chris Lattner authored
      This allows us to translate:
      
      int func() {
        register int X;
        {
          int Y;
          return 1+X+Y;
        }
      }
      
      into:
      
      define i32 @func() {
      entry:
              %X = alloca i32         ; <i32*> [#uses=1]
              %Y = alloca i32         ; <i32*> [#uses=1]
              %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
              %tmp = load i32* %X             ; <i32> [#uses=1]
              %tmp1 = add i32 1, %tmp         ; <i32> [#uses=1]
              %tmp2 = load i32* %Y            ; <i32> [#uses=1]
              %tmp3 = add i32 %tmp1, %tmp2            ; <i32> [#uses=1]
              ret i32 %tmp3
                      ; No predecessors!
              ret i32 undef
      }
      
      llvm-svn: 39555
      d7f58867
    • Bill Wendling's avatar
      Submitted by: Bill Wendling · 44ebec53
      Bill Wendling authored
      Removed #include <iostream>.
      
      llvm-svn: 39554
      44ebec53
Loading