Anders Carlsson
625bfc8716
Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__
...
llvm-svn: 40162
2007-07-21 05:21:51 +00:00
Chris Lattner
2ac26568d4
silence a warning by treating ocuvectors the same as vectors.
...
llvm-svn: 40037
2007-07-19 05:13:51 +00:00
Chris Lattner
3f8c6e6e74
implement codegen support for sizeof/alignof
...
llvm-svn: 40009
2007-07-18 18:12:07 +00:00
Chris Lattner
e73e4322d6
Implement break and continue. Patch by Anders Carlsson!
...
llvm-svn: 39927
2007-07-16 21:28:45 +00:00
Chris Lattner
651f0e9c8f
Add a hack (mirroring llvm-gcc) to pointer difference
...
codegen to compile:
int test(int *A, int *B) {
return A-B;
}
into:
_test:
movl 4(%esp), %eax
subl 8(%esp), %eax
sarl $2, %eax
ret
instead of:
_test:
movl 4(%esp), %eax
subl 8(%esp), %eax
movl %eax, %ecx
sarl $31, %ecx
shrl $30, %ecx
addl %ecx, %eax
sarl $2, %eax
ret
llvm-svn: 39902
2007-07-16 05:43:05 +00:00
Chris Lattner
0e9d6226ca
Refactor code so that isIntegerConstantExpr has an ASTContext available.
...
llvm-svn: 39884
2007-07-15 23:26:56 +00:00
Gabor Greif
e97cd7e65c
add FIXME and un-XFAIL test
...
llvm-svn: 39858
2007-07-14 20:05:18 +00:00
Chris Lattner
4481b428db
A significant refactoring of the type size stuff to also
...
compute type alignment. This info is needed for struct layout.
llvm-svn: 39850
2007-07-14 01:29:45 +00:00
Chris Lattner
9d3b0e0001
Implement trivial integer initializers, like 'int X = 4;' for global
...
vars. Approach suggested by Keith.
llvm-svn: 39849
2007-07-14 00:23:28 +00:00
Chris Lattner
6ee31f5df8
In "int X,Y;", compile both X and Y.
...
llvm-svn: 39848
2007-07-14 00:16:50 +00:00
Chris Lattner
027f21dd72
add a fixme
...
llvm-svn: 39847
2007-07-14 00:01:01 +00:00
Gabor Greif
d4606aa36e
implement _Complex * == and !=
...
llvm-svn: 39841
2007-07-13 23:33:18 +00:00
Chris Lattner
983a8bbbb2
Move getSize() out of type, into ASTContext, where it has target info, and
...
where ASTContext can manage caches for struct layout, etc.
llvm-svn: 39835
2007-07-13 22:13:22 +00:00
Chris Lattner
388cf760e2
implement codegen support for implicit casts.
...
llvm-svn: 39831
2007-07-13 20:25:53 +00:00
Chris Lattner
a5ba0cb772
silence a bogus gcc warning.
...
llvm-svn: 39824
2007-07-13 20:07:11 +00:00
Chris Lattner
6e9d9b350e
"Codegen for Character Literals and Conditional Operator
...
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
2007-07-13 05:18:11 +00:00
Chris Lattner
d14bfa94a6
implement support for basic codegen of global variables with no initializers.
...
llvm-svn: 39795
2007-07-13 05:13:43 +00:00
Chris Lattner
fc7634f2ab
"Someone typed "PtrToInt" where they meant "IntToPtr".
...
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."
Patch by Keith Bauer
llvm-svn: 39794
2007-07-13 03:25:53 +00:00
Chris Lattner
d2b88ab313
Implement codegen for + and - with pointers. Patch contributed by
...
Keith Bauer.
llvm-svn: 39793
2007-07-13 03:05:23 +00:00
Chris Lattner
bd4de5df77
Fix "no newline at end of file" warnings. Patch contributed by
...
Benoit Boissinot!
llvm-svn: 39780
2007-07-12 15:43:07 +00:00
Chris Lattner
07eb733ef8
Evaluate the initializer for automatic variables.
...
llvm-svn: 39771
2007-07-12 00:39:48 +00:00
Chris Lattner
dcca487cfa
implement codegen support for pre/post inc/dec.
...
llvm-svn: 39765
2007-07-11 23:43:46 +00:00
Chris Lattner
c14236b8ae
implement codegen support for the "default argument promotions" (C99 6.5.2.2p6).
...
Not having this prevented promoting float arguments to double when passed
into printf, for example.
llvm-svn: 39727
2007-07-10 22:18:37 +00:00
Chris Lattner
a779b3df28
implement codegen support for rvalue-only vector subscripts, such as:
...
float4 test(void);
float test2() {
return test()[1];
}
llvm-svn: 39725
2007-07-10 21:58:36 +00:00
Chris Lattner
08c4b9ffec
Add support for codegen'ing vector subscripts, at least when they are lvalues.
...
llvm-svn: 39724
2007-07-10 21:17:59 +00:00
Chris Lattner
50d4abd24c
Add support for vector formal arguments.
...
llvm-svn: 39721
2007-07-10 00:28:12 +00:00
Chris Lattner
6eea886b9e
implement support for llvm codegen of vectors. That was much easier than
...
I expected :)
llvm-svn: 39720
2007-07-10 00:23:39 +00:00
Chris Lattner
2ada32ed7d
implement codegen support for FP literals
...
llvm-svn: 39718
2007-07-09 23:03:16 +00:00
Chris Lattner
47c247e7bf
add codegen support for <<= and >>=.
...
llvm-svn: 39713
2007-06-29 17:26:27 +00:00
Chris Lattner
b25a94383a
Implement the rest of the compound assignment operators, except shifts.
...
llvm-svn: 39712
2007-06-29 17:03:06 +00:00
Chris Lattner
cd215f00ee
refactor some code, implement -=
...
llvm-svn: 39711
2007-06-29 16:52:55 +00:00
Chris Lattner
9369a563b4
Rename ArithAssignBinaryOperator -> CompoundAssignOperator, implement
...
codegen support for +=.
llvm-svn: 39710
2007-06-29 16:31:29 +00:00
Chris Lattner
69e70e506a
fix codegen of void return functions
...
llvm-svn: 39694
2007-06-27 18:10:00 +00:00
Chris Lattner
c8c3dadaa0
fix codegen of void-returning functions
...
llvm-svn: 39693
2007-06-27 18:08:49 +00:00
Chris Lattner
54fb19efaa
implement support for struct and complex returns.
...
llvm-svn: 39674
2007-06-22 22:02:34 +00:00
Chris Lattner
e9a6453ded
add some infrastructure for codegen'ing complex numbers. implement addition
...
of complex. We now produce optimal code for:
void test(_Complex float *Y) {
*Y = *Y + *Y;
}
$ clang -emit-llvm cg.c | llvm-as | opt -std-compile-opts | llc -march=x86-64
...
_test:
movss (%rdi), %xmm0
addss %xmm0, %xmm0
movss 4(%rdi), %xmm1
movss %xmm0, (%rdi)
addss %xmm1, %xmm1
movss %xmm1, 4(%rdi)
ret
llvm-svn: 39673
2007-06-22 21:44:33 +00:00
Chris Lattner
c6395936ae
Split complex types out from being members of BuiltinType to being their own
...
types.
llvm-svn: 39672
2007-06-22 20:56:16 +00:00
Chris Lattner
f033c147c9
remove location tracking for target info
...
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner
0fb8465981
Don't forget to set this
...
llvm-svn: 39670
2007-06-22 18:57:44 +00:00
Chris Lattner
09153c0a8c
Build enough support for aggregates to be able to compile this:
...
void test(int A, _Complex float Y) {
_Complex float X;
X = X;
}
llvm-svn: 39669
2007-06-22 18:48:09 +00:00
Chris Lattner
3e3a1e9cda
implement lowering of complex types
...
llvm-svn: 39668
2007-06-22 18:15:26 +00:00
Chris Lattner
f39b03d98b
fix naming of aggregate arguments.
...
llvm-svn: 39667
2007-06-22 18:15:16 +00:00
Chris Lattner
1fde0b345b
implement codegen of the relational operations
...
One major FIXME though.
llvm-svn: 39666
2007-06-20 18:30:55 +00:00
Chris Lattner
273c63d450
Implement the equality operators for simple types
...
llvm-svn: 39665
2007-06-20 18:02:30 +00:00
Chris Lattner
e1e93a5e5d
assert, don't crash, on int[]
...
llvm-svn: 39664
2007-06-20 17:12:11 +00:00
Chris Lattner
b6984c4854
Hook up global function and variable handling. We can now compile:
...
int X, bar(int,int,int);
short Y;
double foo() {
return bar(X, Y, 3);
}
into:
@X = external global i32 ; <i32*> [#uses=1]
@Y = external global i16 ; <i16*> [#uses=1]
define double @foo() {
entry:
%tmp = load i32* @X ; <i32> [#uses=1]
%tmp1 = load i16* @Y ; <i16> [#uses=1]
%promote = sext i16 %tmp1 to i32 ; <i32> [#uses=1]
%call = tail call i32 @bar( i32 %tmp, i32 %promote, i32 3 ) ; <i32> [#uses=1]
%conv = sitofp i32 %call to double ; <double> [#uses=1]
ret double %conv
}
declare i32 @bar(i32, i32, i32)
llvm-svn: 39663
2007-06-20 04:44:43 +00:00
Chris Lattner
2ccb73bc8b
Refactor CodeGenTypes out to CodeGenModule so it can be used for functions
...
and globals.
llvm-svn: 39661
2007-06-16 00:16:26 +00:00
Chris Lattner
2052bc8107
Split type analysis out to its own file, now the integer constant expr evaluation
...
is ready.
llvm-svn: 39660
2007-06-16 00:12:05 +00:00
Chris Lattner
23b7eb677d
Finally bite the bullet and make the major change: split the clang namespace
...
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
2007-06-15 23:05:46 +00:00
Chris Lattner
2b228c95aa
implement codegen of calls. We can now compile:
...
double foo( int (*FP)(int, int, int)) {
return FP(1, 2, 3);
}
to:
define double @foo(i32 (i32, i32, i32)* %FP) {
entry:
%call = tail call i32 %FP( i32 1, i32 2, i32 3 )
%conv = sitofp i32 %call to double
ret double %conv
}
llvm-svn: 39658
2007-06-15 21:34:29 +00:00