- Jun 06, 2007
-
-
Chris Lattner authored
llvm-svn: 39595
-
- Jun 05, 2007
-
-
Chris Lattner authored
llvm-svn: 39594
-
Chris Lattner authored
llvm-svn: 39593
-
Chris Lattner authored
llvm-svn: 39592
-
Chris Lattner authored
llvm-svn: 39591
-
Chris Lattner authored
llvm-svn: 39590
-
Steve Naroff authored
Submitted by: Reviewed by: Touch up a couple comments (one was incorrect/out-of-date). llvm-svn: 39589
-
Chris Lattner authored
llvm-svn: 39588
-
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
-
Chris Lattner authored
on complete types. llvm-svn: 39586
-
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
-
Chris Lattner authored
isConstantExpr into just isIntegerConstantExpr in preparation for other changes. llvm-svn: 39584
-
Chris Lattner authored
llvm-svn: 39583
-
Chris Lattner authored
llvm-svn: 39582
-
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
-
- Jun 03, 2007
-
-
Steve Naroff authored
Submitted by: Reviewed by: Apply UsualUnaryConversion() to statement conditions that expect scalars. UsualUnaryConversion() converts function/arrays to pointers. This fixes the following... int func() { int A[10]; while (A) { } if (A) ; for (; A; ) ; } llvm-svn: 39580
-
Bill Wendling authored
llvm-svn: 39579
-
Chris Lattner authored
llvm-svn: 39578
-
Chris Lattner authored
'char', which varies based on the target. Instead of spreading target knowledge throughout the compiler, bifurcate char into Char_S and Char_U, and have ASTContext create the right one based on the target, when it starts up. llvm-svn: 39577
-
Chris Lattner authored
ints to long long etc. For int to longlong, we now get: %tmp = load i64* %F ; <i64> [#uses=1] %tmp1 = load i32* %D ; <i32> [#uses=1] %promote = sext i32 %tmp1 to i64 ; <i64> [#uses=1] %tmp2 = add i64 %tmp, %promote ; <i64> [#uses=0] llvm-svn: 39576
-
Chris Lattner authored
llvm-svn: 39575
-
Chris Lattner authored
ds.c:11:16: error: case label does not reduce to an integer constant case 0 ? 0 : foo(): ~~~~~~~~^~~~~ llvm-svn: 39574
-
Bill Wendling authored
- Small error fix. llvm-svn: 39573
-
Bill Wendling authored
Reviewed by: Chris Lattner - Add a reference decl type. llvm-svn: 39572
-
Bill Wendling authored
Reviewed by: Chris Lattner - Diagnostic messages for invalid reference usage. llvm-svn: 39571
-
Bill Wendling authored
Reviewed by: Chris Lattner - Method declaration. llvm-svn: 39570
-
Bill Wendling authored
Reviewed by: Chris Lattner - Disallow references to references, pointers to references, or arrays of references. llvm-svn: 39569
-
Bill Wendling authored
Reviewed by: Chris Lattner - If the LHS and/or RHS is a reference, then see if they're compatible. If so, the type is that of the LHS. llvm-svn: 39568
-
Bill Wendling authored
Reviewed by: Chris Lattner - Update the parsing of references. We allow "restrict" but not "const" or "volatile". llvm-svn: 39567
-
Bill Wendling authored
Reviewed by: Chris Lattner - Added a method to determine if two types, where at least one is a reference, are compatible. That is you can assign the RHS to the LHS. llvm-svn: 39566
-
Chris Lattner authored
This allows us to compile: register short X; { int Y; return 1+X+Y; into: %tmp = load i16* %X ; <i16> [#uses=1] %promote = sext i16 %tmp to i32 ; <i32> [#uses=1] %tmp1 = add i32 1, %promote ; <i32> [#uses=1] %tmp2 = load i32* %Y ; <i32> [#uses=1] %tmp3 = add i32 %tmp1, %tmp2 ; <i32> [#uses=1] ret i32 %tmp3 Look at the amazing sign extension, so much happier than an assertion failure. :) llvm-svn: 39565
-
Chris Lattner authored
This allows us to compile: int func() { int A[10]; if (!A) { to: define i32 @func() { entry: %A = alloca [10 x i32] ; <[10 x i32]*> [#uses=1] %arraydecay = getelementptr [10 x i32]* %A, i32 0, i32 0 ; <i32*> [#uses=1] %tobool = icmp ne i32* %arraydecay, null ; <i1> [#uses=1] %lnot = xor i1 %tobool, true ; <i1> [#uses=1] br i1 %lnot, label %ifthen, label %ifend -Chris llvm-svn: 39564
-
Chris Lattner authored
llvm-svn: 39563
-
Chris Lattner authored
typedef information associated with the input. llvm-svn: 39562
-
- Jun 02, 2007
-
-
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
-
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
-
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
-
Chris Lattner authored
llvm-svn: 39558
-
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
-
Chris Lattner authored
llvm-svn: 39556
-