Chris Lattner
68be60694e
sink more of the type related code into CodeGenTypes.
...
llvm-svn: 46801
2008-02-06 05:08:19 +00:00
Chris Lattner
8b945ee058
codegen static variables in a function into a different namespace from
...
static variables outside functions.
llvm-svn: 46800
2008-02-06 04:54:32 +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
adf1f51fc5
move the codegen ASTConsumer out of the driver into libcodegen,
...
eliminating a bunch of forwarding methods and generally
simplifying things.
llvm-svn: 46792
2008-02-06 02:01:47 +00:00
Anders Carlsson
3ed4aea198
Even more inline asm codegen fixes.
...
llvm-svn: 46784
2008-02-06 00:11:32 +00:00
Nate Begeman
3399bb424c
simple implementation of __builtin_alloca
...
llvm-svn: 46783
2008-02-06 00:02:50 +00:00
Anders Carlsson
b737b6247f
Improvements to inline asm code generation.
...
llvm-svn: 46779
2008-02-05 23:18:57 +00:00
Anders Carlsson
fcbb11a86f
Add some binops.
...
llvm-svn: 46766
2008-02-05 20:54:21 +00:00
Anders Carlsson
b170d0cf7e
More improvements to inline asm CG.
...
llvm-svn: 46762
2008-02-05 20:01:53 +00:00
Anders Carlsson
d0cd0d89a0
Append input argument to args vector.
...
llvm-svn: 46751
2008-02-05 16:57:38 +00:00
Anders Carlsson
952a99592f
Add code generation for inline asm statements.
...
llvm-svn: 46750
2008-02-05 16:35:33 +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
86964a9653
Change the key of CGRecordLayouts from being an llvm type* to being a decl*. LLVM
...
Type*'s can change as types are refined, so we can't use them as a stable key in
the map. Decls don't change, so use them instead.
This patch was written by Anders, but he's too shy to commit it himself :)
llvm-svn: 46743
2008-02-05 06:55:31 +00:00
Chris Lattner
b977b6a59b
Relax an assertion, fixing PR1968
...
llvm-svn: 46742
2008-02-05 06:37:34 +00:00
Devang Patel
6c037da51c
Update outdated comment.
...
llvm-svn: 46737
2008-02-05 03:17:42 +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
Eli Friedman
26a6dd0877
Fix memory corruption from the type map being modified while a reference
...
to a cell is being held.
llvm-svn: 46735
2008-02-05 02:18:07 +00:00
Devang Patel
86e7166522
Keep track of padding fields.
...
llvm-svn: 46734
2008-02-05 01:40:48 +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
Chris Lattner
6cba8e9d66
minor tweak to anders patch: (only) ocu vectors support splatting, but
...
ocu vectors should not treat bitcasts from int <-> vector as a splat
unless it is of the element type.
llvm-svn: 46664
2008-02-02 04:51:41 +00:00
Chris Lattner
ce6ae5cb06
fix codegen on static variables which have multiple decl nodes. These
...
should be merged just like normal globals. This fixes this testcase
that Anders provided:
static struct s a;
static struct s *ap1 = &a;
static struct s a = { 10 };
llvm-svn: 46661
2008-02-02 04:43:11 +00:00
Anders Carlsson
0b05d041f2
Only OCU vectors can be splatted.
...
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Anders Carlsson
f4f3679eea
Generate correct code for __builtin_huge_val
...
llvm-svn: 46639
2008-02-01 16:06:34 +00:00
Anders Carlsson
b49fdfb5f0
Implement __builtin_huge_val.
...
llvm-svn: 46627
2008-02-01 00:44:41 +00:00
Lauro Ramos Venancio
bb733a2bdc
Implement review feedback. Use getAsPointerType instead of cast<PointerType>.
...
llvm-svn: 46613
2008-01-31 15:19:04 +00:00
Nate Begeman
4cd6689d1f
Remainder of the __builtin_overload feedback
...
llvm-svn: 46601
2008-01-31 05:38:29 +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
Nate Begeman
936b207407
Implement first round of feedback on __builtin_overload
...
llvm-svn: 46572
2008-01-30 20:50:20 +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
Chris Lattner
86f5e13224
move some constructors out of line and fix indentation in ObjCAtThrowStmt::getSourceRange.
...
llvm-svn: 46547
2008-01-30 05:01:46 +00:00
Eli Friedman
9d92ce8b3a
Make sure to emit all the arguments to a function call. This fixes the
...
codegen of calls to functions without a prototype and varargs functions,
including printf.
llvm-svn: 46543
2008-01-30 01:32:06 +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
a8dc3e6b52
Implement __builtin_offsetof.
...
llvm-svn: 46515
2008-01-29 15:56:48 +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
Anders Carlsson
8a88c3815a
Tweaks to EmitLValue in CGExprConstant. Patch by Eli Friedman.
...
llvm-svn: 46389
2008-01-26 04:30:23 +00:00
Anders Carlsson
a413911373
Add CodeGen for AddrOf in constant initializers. Original patch by Eli Friedman.
...
llvm-svn: 46388
2008-01-26 02:08:50 +00:00
Anders Carlsson
610ee7134e
Factor out the constant generation into its own file.
...
llvm-svn: 46386
2008-01-26 01:36:00 +00:00
Steve Naroff
fda820970a
Add more support for Apple's "private extern" extension...
...
llvm-svn: 46371
2008-01-25 22:14:40 +00:00
Nate Begeman
43eec490fb
Support checking and codegen of constant vector globals
...
llvm-svn: 46343
2008-01-25 05:34:48 +00:00
Fariborz Jahanian
0a71ad2e07
Problem with ObjC's type-encoding of nested structs causing infinit recursion.
...
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio
db449040aa
Fix a typo.
...
llvm-svn: 46259
2008-01-22 22:38:35 +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
0ae6cd5219
Fix two bugs in bitfield codegen.
...
llvm-svn: 46255
2008-01-22 19:15:30 +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
Nate Begeman
1c075a1c9d
Match change in EmitCallExpr
...
llvm-svn: 46136
2008-01-17 18:06:09 +00:00
Nate Begeman
d5b534e16f
Fix for EmitCallExpr changed in OverloadExpr patch
...
llvm-svn: 46135
2008-01-17 18:03:22 +00:00
Nate Begeman
1e36a85f64
Implement basic overload support via a new builtin, __builtin_overload.
...
__builtin_overload takes 2 or more arguments:
0) a non-zero constant-expr for the number of arguments the overloaded
functions will take
1) the arguments to pass to the matching overloaded function
2) a list of functions to match.
The return type of __builtin_overload is inferred from the function whose args
match the types of the arguments passed to the builtin. For example:
float a;
float sinf(float);
int sini(int);
float b = __builtin_overload(1, a, sini, sinf);
Says that we are overloading functions that take one argument, and trying to
pass an argument of the same type as 'a'. sini() does not match since it takes
and argument of type int. sinf does match, so at codegen time this will turn
into float b = sinf(a);
llvm-svn: 46132
2008-01-17 17:46:27 +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
a81a0279cc
Fix the type of predefined identifiers like __func__. Patch by
...
Eli Friedman!
llvm-svn: 45906
2008-01-12 08:14:25 +00:00
Chris Lattner
38376f1595
Add first pieces of support for parsing and representing
...
extern "C" in C++ mode. Patch by Mike Stump!
llvm-svn: 45904
2008-01-12 07:05:38 +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
Ted Kremenek
1b0ea82459
Substituted all instances of the string "Objc" for "ObjC". This fixes
...
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.
llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Chris Lattner
1800c18ebd
fix long lines.
...
llvm-svn: 45531
2008-01-03 07:05:49 +00:00
Chris Lattner
20455f204f
Fix a crash reported by Seo Sanghyeon.
...
llvm-svn: 45530
2008-01-03 06:36:51 +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
Nate Begeman
628028bd27
Allow codegen of vector fdiv
...
llvm-svn: 45440
2007-12-30 01:28:16 +00:00
Chris Lattner
a77acbdcae
implement codegen support for most unary operators when
...
initializing a global. This handles important cases like:
float foo3 = -0.01f;
llvm-svn: 45427
2007-12-29 23:43:37 +00:00
Chris Lattner
5926c0ebfb
remove attribution from makefiles.
...
llvm-svn: 45412
2007-12-29 20:02:25 +00:00
Chris Lattner
5b12ab8c93
Don't attribute in file headers anymore. See llvmdev for the
...
discussion of this change.
llvm-svn: 45410
2007-12-29 19:59:25 +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
Christopher Lamb
fd9af54ad1
Make MemberExpr code safe w.r.t. address spaces.
...
llvm-svn: 45394
2007-12-29 04:06:57 +00:00
Anders Carlsson
c9d41e7d27
No need to do work that the folding builder does for us.
...
llvm-svn: 45361
2007-12-26 18:20:19 +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
Devang Patel
016e41e8a6
Keep track of llvm struct size while adding fields.
...
Update addPaddingFields() interface.
llvm-svn: 45284
2007-12-21 18:43:53 +00:00
Chris Lattner
6c9ffe9529
Implement codegen for ordered comparison builtins.
...
llvm-svn: 45243
2007-12-20 00:44:32 +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
Anders Carlsson
aa5c91980e
Turns out the LLVMFoldingBuilder can fold InsertElement. Knowing this, we can get rid of our special casing of constants when creating vectors.
...
llvm-svn: 45145
2007-12-18 02:45:33 +00:00
Chris Lattner
b8be97e239
introduce a new CodeGenModule::getIntrinsic method, which wraps
...
Intrinsic::getDeclaration, allowing much more terse code.
llvm-svn: 45136
2007-12-18 00:25:38 +00:00
Fariborz Jahanian
24cb52c9b0
Patch to implemented objective-c's dynamic object pointer qualified with
...
the protocol list (id<P,...> types).
llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Chris Lattner
e6a76da763
Make the insertion point with an explicit new instead of the builder.
...
llvm-svn: 45118
2007-12-17 20:50:59 +00:00
Chris Lattner
28c91c5f35
add a hack so that codegen doesn't abort on missing sema of initializers, now
...
we emit stuff like this:
abort on missing sema of initializers, now
we emit stuff like this:
t3.c:1:24: warning: cannot codegen this initializer yet
const char x[2][4] = { { 'a', 'b', '\0', '\0' }, { 'c', 'd', 'e', '\0' } };
^~~~~~~~~~~~~~~~~~~~~~~~
This should be removed when sema is finished.
llvm-svn: 45086
2007-12-17 05:17:42 +00:00
Christopher Lamb
77560fbde7
Update to use new PointerType::getUnqual() api.
...
llvm-svn: 45081
2007-12-17 01:11:20 +00:00
Anders Carlsson
ca6bcae0be
Start generating SSE intrinsics.
...
llvm-svn: 45079
2007-12-16 22:33:50 +00:00
Anders Carlsson
f5f6544edc
We now support all MMX intrinsics. SSE intrinsics are next.
...
llvm-svn: 45062
2007-12-15 21:23:30 +00:00
Anders Carlsson
4d3094a9bb
Simplify the vector code. Add more shift intrinsics.
...
llvm-svn: 45035
2007-12-14 17:48:24 +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
eb13c73c36
minor cleanups
...
llvm-svn: 44996
2007-12-13 07:47:54 +00:00
Chris Lattner
13653d7668
simplify some code.
...
llvm-svn: 44994
2007-12-13 07:34:23 +00:00
Devang Patel
527048247b
Add assert to detect incomplete implementation work.
...
llvm-svn: 44974
2007-12-13 01:24:16 +00:00
Chris Lattner
70efff25be
builtin id 0 is invalid, don't use a slot for it.
...
llvm-svn: 44968
2007-12-13 00:38:03 +00:00
Chris Lattner
b8bd2db8b3
fix off-by-one error.
...
llvm-svn: 44963
2007-12-12 23:46:36 +00:00
Ted Kremenek
1daa3cfbae
TargetInfo no longer includes a reference to SourceManager.
...
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:
FullLoc.getManager().someMethod(FullLoc.getLocation());
instead we have:
FullLoc.someMethod();
Modified TextDiagnostics (and related classes) to use this short-hand.
llvm-svn: 44957
2007-12-12 22:39:36 +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
Ted Kremenek
d4e5fbacab
Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
...
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.
Modified all users of Diagnostics to comply with this new interface.
Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).
Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.
llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Devang Patel
e3f9fa6322
Refactor bit-field handling code into a separate method.
...
No functionality change.
llvm-svn: 44875
2007-12-11 19:51:39 +00:00
Chris Lattner
63ba2c06c4
fix a build issue with non-apple-gcc-4.0 compilers.
...
llvm-svn: 44844
2007-12-11 04:33:00 +00:00
Anders Carlsson
f1c18350e3
Generate more builtins.
...
llvm-svn: 44841
2007-12-11 03:09:22 +00:00
Anders Carlsson
eee7566205
Generate code for some more intrinsics.
...
llvm-svn: 44839
2007-12-11 02:25:54 +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