Skip to content
  1. Jul 14, 2007
  2. Jul 13, 2007
    • Chris Lattner's avatar
      remove some extraneous spaces, no functionality change. · 2ce5dd4c
      Chris Lattner authored
      llvm-svn: 39832
      2ce5dd4c
    • Steve Naroff's avatar
      · 7a5af782
      Steve Naroff authored
      Add (explicit) AST support for implicit casts. This should simplify the 
      code generator. Source translation tools can simply ignore this node.
      
      - Added a new Expr node, ImplicitCastExpr.
      - Changed UsualUnaryConversions/UsualArithmeticConversions to take references 
      to Expr *'s. This will allow these routines to instantiate the new AST node
      and pass it back.
      - Changed all clients of UsualUnary/UsualArithmetic (lot's of diff's).
      - Changed some names in CheckConditionalOperands. Several variables where
      only distinguished by their case (e.g. Cond, cond). Yuck (what was I thinking).
      - Removed an old/crufty constructor in CastExpr (cleanup).
      
      This check-in does not actually create the new AST node. I wanted to separate
      the mechanical changes from the semantic changes. In addition, I need to 
      coordinate with Chris, since the semantic change will break the code generator.
      
      llvm-svn: 39814
      7a5af782
    • Chris Lattner's avatar
      "Codegen for Character Literals and Conditional Operator · 6e9d9b35
      Chris Lattner authored
      Both in one patch, and the test case that Chris didn't commit last
      time is in there too...
      
      I'll split the patch up if somebody wants it split."
      
      Patch by Keith Bauer.
      
      llvm-svn: 39796
      6e9d9b35
    • Chris Lattner's avatar
      Implement codegen for + and - with pointers. Patch contributed by · d2b88ab3
      Chris Lattner authored
      Keith Bauer.
      
      llvm-svn: 39793
      d2b88ab3
    • Anton Korobeynikov's avatar
      Workaround gcc 3.4.x bug · b6719478
      Anton Korobeynikov authored
      llvm-svn: 39792
      b6719478
  3. Jul 12, 2007
  4. Jul 11, 2007
    • Steve Naroff's avatar
      Bug #: · b207d6be
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Removed Attr.[h,cpp]...they didn't have any useful content.
      
      When more (GCC) attributes are added, we might want to create a file
      of this ilk. For now, it's better to remove them (to eliminate any confusion).
      
      I also update the Xcode project file...
      
      llvm-svn: 39729
      b207d6be
    • Steve Naroff's avatar
      Bug #: · e728ba35
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Two vector fixes:
      
      - Sema::CheckAssignmentConstraints() needs to compare the canonical type.
      - Expr::isLvalue() needs to disallow subscripting into a vector returned by a function. This
      follows the rules for struct returns (in C, at least...C++ is another story:-)
      
      Here is an example...
      
      float4 float4_return()
      {
          float4 xx;
      
          return xx;
      }
      void add_float4_void_return(float4 *a, float4 *b, float4 *result)
      {
          float f;
          float4_return()[1] = f; // now illegal
      }
      
      llvm-svn: 39728
      e728ba35
  5. Jul 09, 2007
    • Steve Naroff's avatar
      Bug #: · 84ff4b44
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Typechecking support for vectors...
      
      - Added CheckVectorOperands(). Called from CheckAdditionOperands,
      CheckMultiplyDivideOperands, CheckSubstractionOperands, and CheckBitwiseOperands.
      - Added diagnostic for converting vector values of different size.
      - Modified Type::isArithmeticType to include vectors.
      
      Sould be ready for Chris to add code generation. I will continue testing/refining.
      
      llvm-svn: 39717
      84ff4b44
  6. Jul 07, 2007
    • Steve Naroff's avatar
      Bug #: · 4ae0ac6a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      - Finished semantic analysis for vectors, added some diagnostics.
      - Added AST for vectors (instantiation, installation into the decl).
      - Fixed bug in ParseArraySubscriptExpr()...this crasher was introduced by me
      when we added the range support.
      - Turned pedantic off by default. Since vectors are gcc extensions, having
      pedantic on by default was annoying. Turning it off by default is  also
      consistent with gcc (but this wasn't my primary motivation).
      - Tweaked some comments and diagnostics.
      
      Note: The type checking code is still under construction (for vectors). This
      will be my next check-in.
      
      llvm-svn: 39715
      4ae0ac6a
  7. Jun 27, 2007
  8. Jun 22, 2007
  9. Jun 16, 2007
    • Chris Lattner's avatar
      Finally bite the bullet and make the major change: split the clang namespace · 23b7eb67
      Chris Lattner authored
      out of the llvm namespace.  This makes the clang namespace be a sibling of
      llvm instead of being a child.
      
      The good thing about this is that it makes many things unambiguous.  The
      bad things is that many things in the llvm namespace (notably data structures
      like smallvector) now require an llvm:: qualifier.  IMO, libsystem and libsupport
      should be split out of llvm into their own namespace in the future, which will fix
      this issue.
      
      llvm-svn: 39659
      23b7eb67
  10. Jun 13, 2007
    • Chris Lattner's avatar
      Implement support for formal arguments. We can now compile this: · 53621a53
      Chris Lattner authored
      int test(int X, short Y, float Z) {
        return (int)(X*Y+Z);
      }
      
      to:
      
      define i32 @test(i32 %X, i16 %Y, float %Z) {
      entry:
              %promote = sext i16 %Y to i32           ; <i32> [#uses=1]
              %mul = mul i32 %promote, %X             ; <i32> [#uses=1]
              %promote3 = sitofp i32 %mul to float            ; <float> [#uses=1]
              %add = add float %promote3, %Z          ; <float> [#uses=1]
              %conv = fptosi float %add to i32                ; <i32> [#uses=1]
              ret i32 %conv
      }
      
      with:
      
      $ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis
      
      llvm-svn: 39652
      53621a53
  11. Jun 12, 2007
    • Chris Lattner's avatar
      Pretty print if/else/elseif chains nicer, like this: · c0a38dd3
      Chris Lattner authored
      void printutf8(unsigned int X) {
        if (X <= 127)
          printf("%c", (char)X);
        else if (X <= 2047)
          printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
        else if (X <= 65535)
          printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
        else
          printf("UNKNOWN %d\n", X);
      
      instead of:
      
        if (X <= 127)
          printf("%c", (char)X);
        else
          if (X <= 2047)
            printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
          else
            if (X <= 65535)
              printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
            else
              printf("UNKNOWN %d\n", X);
      
      llvm-svn: 39648
      c0a38dd3
  12. Jun 11, 2007
  13. Jun 09, 2007
    • Steve Naroff's avatar
      Bug #: · b309644a
      Steve Naroff authored
      Submitted by:
      Reviewed by:
      Lot's of attribute scaffolding.
      Modernized ParseArraySubscriptExpr...call DefaultFunctionArrayConversion (which
      simplified the logic considerably) and upgrade Diags to use the range support.
      
      llvm-svn: 39628
      b309644a
    • Chris Lattner's avatar
      Finally break down and chain together decls that are defined with common declspecs, · 776fac87
      Chris Lattner authored
      like: int X, Y, Z;
      
      This is required for the code gen to get to all of the declarations in a
      DeclStmt, and should simplify some other code.
      
      llvm-svn: 39623
      776fac87
  14. Jun 08, 2007
  15. Jun 05, 2007
    • Chris Lattner's avatar
    • 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
  16. Jun 03, 2007
  17. Jun 02, 2007
Loading