summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement array subscripts for non-vla types.Chris Lattner2007-06-083-0/+37
| | | | llvm-svn: 39622
* implement codegen of string literals.Chris Lattner2007-06-062-1/+25
| | | | llvm-svn: 39597
* implement the real int/fp conversionsChris Lattner2007-06-061-5/+49
| | | | llvm-svn: 39596
* implement support for casts to/from pointers.Chris Lattner2007-06-062-6/+21
| | | | llvm-svn: 39595
* implement codegen of a bunch more loop constructs and most expressionsChris Lattner2007-06-054-100/+597
| | | | llvm-svn: 39593
* implement codegen of while stmts and lvalue evaluation of paren exprs :)Chris Lattner2007-06-053-5/+50
| | | | llvm-svn: 39582
* Type::isSignedInteger() and isUnsignedInteger() did not properly account forChris Lattner2007-06-032-4/+4
| | | | | | | | | | '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
* Implement EmitUsualArithmeticConversions, so we can add shorts to floats andChris Lattner2007-06-032-5/+101
| | | | | | | | | | | 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
* Change EmitUsualArithmeticConversions to use EmitExprWithUsualUnaryConversions.Chris Lattner2007-06-021-3/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* implement a first hack at codegen'ing the usual unary conversions.Chris Lattner2007-06-023-7/+62
| | | | | | | | | | | | | | | | | | | | | | 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
* Implement translation of pointer, reference and simple array types. We nowChris Lattner2007-06-022-6/+22
| | | | | | | | | | | | | | | | 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
* Implement a trivial optimization to reduce the number of compares emitted.Chris Lattner2007-06-021-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Refactor EvaluateScalarValueToBool out of if statement emission, so it canChris Lattner2007-06-023-57/+107
| | | | | | | | | | | | | | | | | | | | | | | 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
* Implement scaffolding for lvalues. Implement block vardecl lvalues.Chris Lattner2007-06-022-4/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add initial support for fixed-size local vardecls. This allows us to compile:Chris Lattner2007-06-023-6/+52
| | | | | | | | | | | | | | | | | | int func() { register int X; { int Y; into: define i32 @func() { entry: %X = alloca i32 ; <i32*> [#uses=0] %Y = alloca i32 ; <i32*> [#uses=0] %allocapt = bitcast i32 undef to i32 ; <i32> [#uses=0] ... llvm-svn: 39553
* Start stubbing out decl codegen.Chris Lattner2007-06-024-0/+78
| | | | llvm-svn: 39550
* implement codegen support for return of void and simple scalars.Chris Lattner2007-06-023-0/+39
| | | | llvm-svn: 39547
* Add support for functions that return non-void.Chris Lattner2007-06-021-5/+10
| | | | llvm-svn: 39546
* stub out codegen of binary plus. We now compile:Chris Lattner2007-06-023-4/+51
| | | | | | | | | | | | | | | if (11 + 42) { to: %tmp = add i32 11, 42 ; <i32> [#uses=1] %tobool = icmp ne i32 %tmp, 0 ; <i1> [#uses=1] br i1 %tobool, label %ifthen, label %ifend but this doesn't handle any of the interesting/hard stuff yet. llvm-svn: 39545
* split stmt/expr codegen into their own files.Chris Lattner2007-06-013-185/+227
| | | | llvm-svn: 39540
* emit a return at the end of the function. Run the llvm verifier.Chris Lattner2007-05-301-0/+8
| | | | llvm-svn: 39534
* Add support for codegen'ing paren exprs and if stmts. We can now codegen:Chris Lattner2007-05-302-9/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void test() { goto l; l: if (11) { j: ; } } into: define void @test() { entry: br label %l l: ; preds = %entry icmp ne i32 11, 0 ; <i1>:0 [#uses=1] br i1 %0, label %ifthen, label %ifend ifthen: ; preds = %l br label %j j: ; preds = %ifthen br label %ifend ifend: ; preds = %j, %l } whoa... :) llvm-svn: 39533
* implement codegen of integer literals.Chris Lattner2007-05-302-2/+63
| | | | llvm-svn: 39530
* Implement codegen support for labels and gotos. We now compile:Chris Lattner2007-05-302-4/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void test1() { foo: goto foo; goto foo; goto foo; } void test() { goto l; l: ; } into: define void @test1() { entry: br label %foo foo: ; preds = %0, %foo, %entry br label %foo ; No predecessors! br label %foo ; No predecessors! } define void @test() { entry: br label %l l: ; preds = %entry } llvm-svn: 39524
* Add codegen support for NullStmt and CompoundStmt. {;;{};;} is now ours!Chris Lattner2007-05-293-5/+53
| | | | llvm-svn: 39522
* Implement conversion of clang ast types to LLVM types, at least for some trivialChris Lattner2007-05-294-3/+101
| | | | | | cases. llvm-svn: 39519
* Reorganize codegen files.Chris Lattner2007-05-285-12/+95
| | | | llvm-svn: 39504
* Initial scaffolding for an -emit-llvm mode. This requires the LLVM VMCoreChris Lattner2007-05-243-0/+103
library to be built for the driver to link. llvm-svn: 39495
OpenPOWER on IntegriCloud