Chris Lattner
871e0ceffb
explicitly document that return statement argument does not necessarily follow the result type of the function. Add testcase.
...
llvm-svn: 46823
2008-02-06 21:20:34 +00:00
Eli Friedman
220ee41011
Fix the codegen of structs with flexible array members.
...
llvm-svn: 46806
2008-02-06 05:33:51 +00:00
Chris Lattner
a5e4d30942
Finish off the refactoring of type handling stuff. Now we recompile every
...
tag decl after it has been completed
llvm-svn: 46798
2008-02-06 04:51:19 +00:00
Chris Lattner
b5eda6253b
pull .ll and .bc writing out of the ASTConsumer destructors into some top
...
level code in clang. This is a cleanup, but does implement "-o" for
-emit-llvm. One effect of this is that "clang foo.c -emit-llvm" will now
emit into foo.ll instead of stdout. Use "clang foo.c -emit-llvm -o -" or
"clang < foo.c -emit-llvm" to get the old behavior.
llvm-svn: 46791
2008-02-06 01:42:25 +00:00
Chris Lattner
b1537ebdd4
rewrite some of the type refinement code to eliminate dangling pointers
...
simplify the code and generally make it more robust.
llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Chris Lattner
b977b6a59b
Relax an assertion, fixing PR1968
...
llvm-svn: 46742
2008-02-05 06:37:34 +00:00
Devang Patel
a703a67384
Cleanup InitListExpr code generation code.
...
Handle padding fields while initializing struct (fix PR 1962)
llvm-svn: 46736
2008-02-05 02:39:50 +00:00
Christopher Lamb
da8e5d979e
Add ending newline to test.
...
llvm-svn: 46692
2008-02-04 02:35:11 +00:00
Christopher Lamb
025b5fb883
Add experimental support for address space qualified types. Address space
...
qualifiers use the __attribute__((address_space(id))) syntax.
llvm-svn: 46691
2008-02-04 02:31:56 +00:00
Anders Carlsson
6fa0813186
Add RUN line.
...
llvm-svn: 46663
2008-02-02 04:49:12 +00:00
Chris Lattner
bfc2d8acd9
testcase for previous patch.
...
llvm-svn: 46662
2008-02-02 04:45:42 +00:00
Anders Carlsson
53fef5d9d6
Add trailing newline.
...
llvm-svn: 46652
2008-02-01 23:27:51 +00:00
Anders Carlsson
0b05d041f2
Only OCU vectors can be splatted.
...
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Chris Lattner
a94035bbb8
Fix PR1921 by promoting negative indices to intptrty.
...
llvm-svn: 46599
2008-01-31 04:12:50 +00:00
Lauro Ramos Venancio
86b99c1b79
getLLVMFieldNo can't be called before emitting the base value.
...
llvm-svn: 46576
2008-01-30 21:23:20 +00:00
Lauro Ramos Venancio
f5291d2871
A pointer to an opaque type is an "opaque type definition".
...
llvm-svn: 46575
2008-01-30 21:21:08 +00:00
Eli Friedman
1bc0fed9a5
Fix codegen for conditionals with incommpatible pointer types. Code
...
that causes this isn't really correct, but if we're going to accept
this, it should come up with a consistent AST.
llvm-svn: 46557
2008-01-30 17:02:03 +00:00
Chris Lattner
05ba4cbe17
fix a problem reported by Eli, caused by not keeping bool as i1
...
when in a register.
llvm-svn: 46552
2008-01-30 07:01:17 +00:00
Devang Patel
45a65d2ee1
Handle incomplete struct initializer.
...
llvm-svn: 46534
2008-01-29 23:23:18 +00:00
Eli Friedman
7031d734ed
Fix a bug where CodeGen would attempt to erase an instruction that was
...
already used.
llvm-svn: 46519
2008-01-29 18:13:51 +00:00
Anders Carlsson
ce0740e1f5
Handle binary or in constant expressions.
...
llvm-svn: 46482
2008-01-29 01:33:32 +00:00
Anders Carlsson
0674a7417f
Correctly handle constants that refer to enums.
...
llvm-svn: 46481
2008-01-29 01:28:48 +00:00
Anders Carlsson
6f2a10e8c9
Correctly handle scalars in braces.
...
llvm-svn: 46480
2008-01-29 01:15:48 +00:00
Nate Begeman
43eec490fb
Support checking and codegen of constant vector globals
...
llvm-svn: 46343
2008-01-25 05:34:48 +00:00
Lauro Ramos Venancio
09af71c2a6
Implement bitfield write.
...
llvm-svn: 46258
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio
2ddcb25a3b
Implement bitfield read.
...
llvm-svn: 46257
2008-01-22 20:17:04 +00:00
Lauro Ramos Venancio
37bae3e8aa
Simplify the bitfield codegen.
...
llvm-svn: 46230
2008-01-21 22:54:57 +00:00
Anders Carlsson
60bfc161a0
Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.
...
llvm-svn: 46158
2008-01-18 02:25:57 +00:00
Chris Lattner
a65e1f3b31
Move promoteExprToType from being a static method in SemaExpr.cpp to being
...
a method named ImpCastExprToType in Sema.
Use this method to insert implicit casts for case statements from their
operand type to the condition type of the switch. This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.
llvm-svn: 46083
2008-01-16 19:17:22 +00:00
Anders Carlsson
1ba25ca171
Add codegen upport for implicit casts to aggregate exprs.
...
llvm-svn: 45954
2008-01-14 06:28:57 +00:00
Chris Lattner
41a1ef0dfe
implement proper support for _Bool in memory, which is usually i8, not i1.
...
This fixes a crash reported by Seo Sanghyeon
llvm-svn: 45778
2008-01-09 18:47:25 +00:00
Chris Lattner
20455f204f
Fix a crash reported by Seo Sanghyeon.
...
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Chris Lattner
7977cca8e8
Fix PR1895: a crash on an ugly gcc extension.
...
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Nate Begeman
330aaa79e0
Allow implicit casts during arithmetic for OCUVector operations
...
Add codegen support and test for said casts.
llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Christopher Lamb
d91c3d4926
Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
...
llvm-svn: 45395
2007-12-29 05:02:41 +00:00
Chris Lattner
807979824e
use -emit-llvm-bc
...
llvm-svn: 45372
2007-12-27 20:35:58 +00:00
Chris Lattner
40ad6cd854
no need to verify this, no errors/warnings are expected.
...
llvm-svn: 45371
2007-12-27 20:31:56 +00:00
Seo Sanghyeon
acb00f4a73
Remove broken assert from CodeGen. Better check is done in Sema.
...
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Seo Sanghyeon
6f1b274976
String literal in aggregate expression
...
llvm-svn: 45330
2007-12-23 03:11:58 +00:00
Devang Patel
505b4f1fd4
Convert opaque type when struct definition is seen.
...
llvm-svn: 45287
2007-12-21 19:35:28 +00:00
Chris Lattner
37bd2ecb11
local static vars are globals also. This fixes a testcase
...
reported by Seo.
llvm-svn: 45156
2007-12-18 08:16:44 +00:00
Seo Sanghyeon
d4d8c3c717
Array subscription in aggregate expression
...
llvm-svn: 45023
2007-12-14 02:04:12 +00:00
Seo Sanghyeon
3abb6d8435
Implement dereference operator in aggregate expression
...
llvm-svn: 45020
2007-12-14 01:09:11 +00:00
Chris Lattner
c6208a72f7
Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
...
llvm-svn: 44908
2007-12-12 04:13:20 +00:00
Devang Patel
b37b12d102
Match union field type when member expression is u->x
...
llvm-svn: 44879
2007-12-11 21:33:16 +00:00
Chris Lattner
11fbda2b5a
Reimplement support for strings that initialize global inits now that
...
the types are right in sema. Thanks Steve.
llvm-svn: 44834
2007-12-11 01:38:45 +00:00
Devang Patel
ab6aadb34a
Add support to share llvm fields for bit-fields.
...
For example, struct { char a; short b:2; };
llvm-svn: 44830
2007-12-11 00:49:18 +00:00
Steve Naroff
f727faf2ed
Explicitly set the string literal type from "char *" to "constant array of char".
...
At this point, I am fairly certain the front-end is correct. Unfortunately, the back-end is still unhappy.
That said, I've commented out the two lines in globalinit.c that are causing problems.
Chris, please have a look...thanks!
llvm-svn: 44823
2007-12-11 00:00:01 +00:00
Chris Lattner
433fb26707
add support for implicit cast from array to pointer that is not the element
...
type.
llvm-svn: 44809
2007-12-10 19:50:32 +00:00
Chris Lattner
e665077f9a
disable case that makes this fail.
...
llvm-svn: 44807
2007-12-10 19:44:50 +00:00
Devang Patel
bb5c0d8960
Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout.
...
llvm-svn: 44798
2007-12-10 18:25:34 +00:00
Chris Lattner
686628e052
extend or truncate the initializer for a string initializer to match its type.
...
llvm-svn: 44751
2007-12-10 00:00:56 +00:00
Chris Lattner
c25c42f3ca
Implement codegen support for:
...
char text[8] = "string";
Big fixme remains.
llvm-svn: 44750
2007-12-09 23:49:42 +00:00
Chris Lattner
283d094b75
implement support for functions that initialize globals.
...
llvm-svn: 44730
2007-12-09 00:36:01 +00:00
Devang Patel
65a2288eef
More struct bitfields layout work. Now handle,
...
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4} stb2;
llvm-svn: 44664
2007-12-06 19:16:05 +00:00
Seo Sanghyeon
3d072bea09
Ignore typedefs in pointer arithmetic codegen.
...
llvm-svn: 44529
2007-12-03 06:23:43 +00:00
Seo Sanghyeon
828429fea9
Fix isStructureType and isUnionType to ignore typedefs, as stated
...
in the header. Patch by Cédric Venet.
llvm-svn: 44519
2007-12-02 16:57:27 +00:00
Christopher Lamb
0cbd8723f3
Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
...
llvm-svn: 44518
2007-12-02 08:49:54 +00:00
Christopher Lamb
39aeb4069b
Commit test for CL 44440.
...
llvm-svn: 44514
2007-12-02 07:47:19 +00:00
Chris Lattner
e4f0feb534
Fix buggy test
...
llvm-svn: 44513
2007-12-02 07:46:00 +00:00
Chris Lattner
d8d18d561e
add codegen support for global inits that require array decay.
...
llvm-svn: 44511
2007-12-02 07:30:13 +00:00
Chris Lattner
5bcdf24a50
Handle global variable definitions which change the type of a definition, such as:
...
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }
llvm-svn: 44509
2007-12-02 07:09:19 +00:00
Chris Lattner
41af8182d8
implement codegen for functions whose function body type don't match
...
their prototype.
llvm-svn: 44506
2007-12-02 06:27:33 +00:00
Oliver Hunt
aefc8fd415
Support initalisers for more than just int-typed static variables.
...
We now use the CodeGenModule logic for generating the constant
initialiser expression, so happily further initialiser fixes should
automatically work for statics as well.
llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Chris Lattner
9e137aad78
fix a couple switch codegen problems Oliver reported.
...
llvm-svn: 44484
2007-12-01 05:27:33 +00:00
Chris Lattner
1386de8757
fix a bug handling typedefs in member expr codegen. Patch
...
by Seo Sanghyeon
llvm-svn: 44455
2007-11-30 18:02:19 +00:00
Chris Lattner
b6a7b582ee
Fix a codegen crash on void ?: reported by Oliver
...
llvm-svn: 44454
2007-11-30 17:56:23 +00:00
Chris Lattner
aa0b570dfb
Support fully general case expressions, patch by Sanghyeon Seo!
...
llvm-svn: 44453
2007-11-30 17:44:57 +00:00
Oliver Hunt
93c4ce650c
Fix typo in writable string test
...
llvm-svn: 44398
2007-11-28 06:52:03 +00:00
Oliver Hunt
a951571941
Adding code gen tests for writable and shared string literals.
...
llvm-svn: 44397
2007-11-28 06:27:12 +00:00
Chris Lattner
2ab40a6207
Fix sema support for the gnu ?: expression with a
...
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right
result type. This fixes PR1824.
llvm-svn: 44322
2007-11-26 01:40:58 +00:00
Chris Lattner
a3ee6fa84f
this works.
...
llvm-svn: 44321
2007-11-26 01:39:17 +00:00
Chris Lattner
136449a6d7
improve codegen for global variable initializers, implementing
...
test/CodeGen/global-with-initialiser.c
Patch by Oliver Hunt!
llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson
9c1011c090
Put back the flags field in the constant CF string type.
...
llvm-svn: 44222
2007-11-19 00:25:30 +00:00
Anders Carlsson
bfd60eedd7
Generate code for member exprs.
...
llvm-svn: 43641
2007-11-02 16:59:10 +00:00
Devang Patel
ad175428c6
start adding pading fields.
...
llvm-svn: 43590
2007-11-01 00:07:12 +00:00
Anders Carlsson
e89b84ab29
Fix a typo that prevented pointer-to-int conversions from working.
...
llvm-svn: 43588
2007-10-31 23:18:02 +00:00
Anders Carlsson
0370eb2034
Handle function calls that return aggregate expressions.
...
llvm-svn: 43581
2007-10-31 22:04:46 +00:00
Devang Patel
cc4c2930ae
New test to verify llvm struct layout.
...
llvm-svn: 43577
2007-10-31 21:02:10 +00:00
Chris Lattner
595db86c9d
__real__ and __imag__ can be lvalues. Add support to ast and codegen for them.
...
llvm-svn: 43525
2007-10-30 22:53:42 +00:00
Devang Patel
ed93c3c3b3
Codegen union member references.
...
llvm-svn: 43390
2007-10-26 19:42:18 +00:00
Devang Patel
7718d7a2eb
Handle non LValue base expressions.
...
llvm-svn: 43387
2007-10-26 18:15:21 +00:00
Devang Patel
ffdb07c939
Code gen static initializer.
...
llvm-svn: 43386
2007-10-26 17:50:58 +00:00
Devang Patel
8717417b3b
Codegen array initializers.
...
llvm-svn: 43385
2007-10-26 17:44:44 +00:00
Devang Patel
19c2b9a66f
Codegen global array initializers.
...
llvm-svn: 43383
2007-10-26 16:31:40 +00:00
Devang Patel
b989c9e65c
Fix "strbuf += stufflen;" crash.
...
llvm-svn: 43365
2007-10-25 22:19:13 +00:00
Devang Patel
d68df20620
Handle
...
foo()->a = 42;
llvm-svn: 43315
2007-10-24 22:26:28 +00:00
Devang Patel
b67e596d86
Handle non-constant initializers.
...
llvm-svn: 43301
2007-10-24 18:05:48 +00:00
Devang Patel
61eaea88f8
Fix typo.
...
llvm-svn: 43269
2007-10-23 23:29:51 +00:00
Devang Patel
65c4afb940
Handle nested structs.
...
typdef struct A { int i; struct A *next; } A
llvm-svn: 43268
2007-10-23 23:26:46 +00:00
Devang Patel
30efa2eec9
Handle simple struct member expr.
...
llvm-svn: 43258
2007-10-23 20:28:39 +00:00
Devang Patel
152f18f671
Recognize while(1) and avoid extra blocks.
...
llvm-svn: 42811
2007-10-09 20:51:27 +00:00
Devang Patel
f8a76755df
new test
...
llvm-svn: 42810
2007-10-09 20:37:41 +00:00
Devang Patel
1166312e8b
Code gen case statement ranges.
...
llvm-svn: 42766
2007-10-08 20:57:48 +00:00
Devang Patel
64a9ca7c58
Support case statement ranges.
...
llvm-svn: 42648
2007-10-05 20:54:07 +00:00
Devang Patel
da5d6bbc40
switch statement code gen.
...
llvm-svn: 42616
2007-10-04 23:45:31 +00:00
Chris Lattner
8a241f9359
Teach Type::is[un]SignedIntegerType about enum decls. This allows the code generator
...
to emit signed comparisons when needed for enum decl references. This implements
test/CodeGen/enum.c. I think enums should be good now.
llvm-svn: 41572
2007-08-29 17:48:46 +00:00
Chris Lattner
23bf38b8c5
add some more testcases now that sema is happier :)
...
llvm-svn: 41492
2007-08-27 16:37:44 +00:00
Chris Lattner
61f6077814
testcase that doesn't work quite yet
...
llvm-svn: 41478
2007-08-27 05:23:45 +00:00
Chris Lattner
02aac86549
new testcases
...
llvm-svn: 41465
2007-08-26 22:41:57 +00:00
Chris Lattner
1bc6fac5c6
new testcase
...
llvm-svn: 41406
2007-08-25 21:57:08 +00:00
Chris Lattner
9f0ad96b3e
implement codegen for real/imag. TODO: imag of non-complex.
...
llvm-svn: 41376
2007-08-24 21:20:17 +00:00
Chris Lattner
3d966d6556
Teach emit-llvm for scalars to properly handle compound assignment
...
operators in all their glory :)
llvm-svn: 41373
2007-08-24 21:00:35 +00:00
Chris Lattner
afd455c0cf
make this harder
...
llvm-svn: 41346
2007-08-23 23:49:47 +00:00
Chris Lattner
725c6a4279
this test is passing, though it is generating bogus code at the moment.
...
llvm-svn: 41314
2007-08-23 05:47:53 +00:00
Chris Lattner
76ba849ed3
Fix array->pointer decay. This unbreaks test/CodeGen/array.c
...
llvm-svn: 41202
2007-08-20 22:37:10 +00:00
Chris Lattner
afada9b077
xfail this for now.
...
llvm-svn: 41015
2007-08-11 00:05:07 +00:00
Chris Lattner
e9a91ae4ea
make this harder
...
llvm-svn: 40994
2007-08-10 17:02:59 +00:00
Chris Lattner
b20b94de3a
testcase for vector element access stuff.
...
llvm-svn: 40783
2007-08-03 16:42:43 +00:00
Gabor Greif
e97cd7e65c
add FIXME and un-XFAIL test
...
llvm-svn: 39858
2007-07-14 20:05:18 +00:00
Gabor Greif
03a0073b36
fix type of main, use !=
...
llvm-svn: 39842
2007-07-13 23:40:27 +00:00
Gabor Greif
d4606aa36e
implement _Complex * == and !=
...
llvm-svn: 39841
2007-07-13 23:33:18 +00:00
Gabor Greif
f7b1f667d4
a simple _Complex testcase
...
llvm-svn: 39836
2007-07-13 22:15:44 +00:00
Chris Lattner
91dacfec85
Check in these testcases.
...
llvm-svn: 39829
2007-07-13 20:18:44 +00:00