Anders Carlsson
f087c0c1c6
Add preliminary support for converting struct types.
...
llvm-svn: 41145
2007-08-17 22:00:32 +00:00
Chris Lattner
6278e6ac30
start splitting out aggregate value computation from EmitExpr into EmitAggExpr.
...
aggregate value and scalar expression computation are very different, this
gets them away from each other. This causes a temporary regression on some
complex number examples.
llvm-svn: 41014
2007-08-11 00:04:45 +00:00
Chris Lattner
d79671fdf2
New file, just a placeholder for now.
...
llvm-svn: 41002
2007-08-10 20:13:28 +00:00
Chris Lattner
8eab8ff127
fix a codegen bug handling ocuvector element exprs.
...
llvm-svn: 40995
2007-08-10 17:10:08 +00:00
Chris Lattner
90d9120453
implement initial codegen for aggregate return functions. This implements
...
codegen for:
_Complex double bar(int);
void test(_Complex double*);
void test2(int c) {
_Complex double X;
X = bar(1);
test(&X);
}
llvm-svn: 40993
2007-08-10 17:02:28 +00:00
Chris Lattner
02697701d9
Fix a bug handling function -> pointer decay and avoid emitting a noop
...
bitcast.
llvm-svn: 40992
2007-08-10 16:33:59 +00:00
Chris Lattner
87f4836184
now that implicit conversions are explicit, we can eliminate
...
EmitUsualArithmeticConversions.
llvm-svn: 40931
2007-08-08 17:49:18 +00:00
Chris Lattner
5ebb2fed89
now that implicit conversions are explicit, we can eliminate
...
EmitExprWithUsualUnaryConversions.
llvm-svn: 40929
2007-08-08 17:43:05 +00:00
Chris Lattner
81a9688e93
Implement codegen for __builtin_choose_expr. For example:
...
struct X { int A; };
void foo() {
struct X s;
int i;
i = __builtin_choose_expr(0, s, i);
}
compiles to:
%tmp = load i32* %i ; <i32> [#uses=1]
store i32 %tmp, i32* %i
wow :)
llvm-svn: 40801
2007-08-04 00:20:15 +00:00
Chris Lattner
4048005ad8
implement codegen support for __builtin_types_compatible_p
...
llvm-svn: 40788
2007-08-03 17:51:03 +00:00
Chris Lattner
d268a7a268
Rename AddrLabel and OCUVectorComponent -> AddrLabelExpr and OCUVectorElementExpr respectively. This is for consistency with other expr nodes end with *Expr.
...
llvm-svn: 40785
2007-08-03 17:31:20 +00:00
Chris Lattner
3a44aa7461
implement codegen for multidest ocuvector expressions, like:
...
vec2.yx = vec2; // reverse
llvm-svn: 40782
2007-08-03 16:37:04 +00:00
Chris Lattner
41d480e4d8
add codegen support for storing into a single-element ocu lvalue, such as:
...
vec2.x = f;
llvm-svn: 40781
2007-08-03 16:28:33 +00:00
Chris Lattner
40ff701674
refactor handling of ocuvector lvalue->rvalue codegen into its own method.
...
llvm-svn: 40780
2007-08-03 16:18:34 +00:00
Chris Lattner
fb837dccac
In the common case where we are shuffling a vector, emit an
...
llvm vector shuffle instead of a bunch of insert/extract operations.
For: vec4 = vec4.yyyy; // splat
Emit:
%tmp1 = shufflevector <4 x float> %tmp, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 >
instead of:
%tmp1 = extractelement <4 x float> %tmp, i32 1
%tmp2 = insertelement <4 x float> undef, float %tmp1, i32 0
%tmp3 = extractelement <4 x float> %tmp, i32 1
%tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1
%tmp5 = extractelement <4 x float> %tmp, i32 1
%tmp6 = insertelement <4 x float> %tmp4, float %tmp5, i32 2
%tmp7 = extractelement <4 x float> %tmp, i32 1
%tmp8 = insertelement <4 x float> %tmp6, float %tmp7, i32 3
llvm-svn: 40779
2007-08-03 16:09:33 +00:00
Chris Lattner
a1036f9155
Add support for scalar-returning element accesses like V.x
...
llvm-svn: 40777
2007-08-03 15:52:31 +00:00
Chris Lattner
73ab9b3c14
implement lvalue to rvalue conversion for ocuvector components. We can now compile stuff
...
like this:
typedef __attribute__(( ocu_vector_type(4) )) float float4;
float4 test1(float4 V) {
return V.wzyx+V;
}
to:
_test1:
pshufd $27, %xmm0, %xmm1
addps %xmm0, %xmm1
movaps %xmm1, %xmm0
ret
and:
_test1:
mfspr r2, 256
oris r3, r2, 4096
mtspr 256, r3
li r3, lo16(LCPI1_0)
lis r4, ha16(LCPI1_0)
lvx v3, r4, r3
vperm v3, v2, v2, v3
vaddfp v2, v3, v2
mtspr 256, r2
blr
llvm-svn: 40771
2007-08-03 00:16:29 +00:00
Chris Lattner
9e751cae27
add support for codegen of an OCUVectorComponent as an lvalue.
...
We can now codegen:
vec4.xy;
as nothing!
llvm-svn: 40769
2007-08-02 23:37:31 +00:00
Chris Lattner
acbd22aaec
silence some warnings.
...
llvm-svn: 40761
2007-08-02 21:50:34 +00:00
Chris Lattner
7b9f04eb19
update this to build with LLVM ToT
...
llvm-svn: 40665
2007-08-01 06:24:52 +00:00
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