Anders Carlsson
2ee3c011d9
Implement code generation of member function pointer calls. Fixes PR5121.
...
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
John McCall
8ccfcb51ee
Refactor the representation of qualifiers to bring ExtQualType out of the
...
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.
llvm-svn: 82705
2009-09-24 19:53:00 +00:00
John McCall
9dd450bb78
Change all the Type::getAsFoo() methods to specializations of Type::getAs().
...
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Anders Carlsson
20759ad54c
x86-64 ABI: If a type is a C++ record with either a non-trivial destructor or a non-trivial copy constructor, it should be passed in a pointer. Daniel, plz review.
...
llvm-svn: 82050
2009-09-16 15:53:40 +00:00
Daniel Dunbar
0ef3479cb7
Change CodeGenModule::ConstructTypeAttributes to return the calling convention
...
to use, and allow the ABI implementation to override the calling convention.
llvm-svn: 81593
2009-09-12 00:59:20 +00:00
Daniel Dunbar
bbaeca4fef
Set the calling convention based on the CGFunctionInfo.
...
llvm-svn: 81582
2009-09-11 22:25:00 +00:00
Daniel Dunbar
7feafc70d9
Add CallingConvention argument to CGFunctionInfo.
...
- Currently unused.
llvm-svn: 81581
2009-09-11 22:24:53 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Owen Anderson
41a750271b
Update for LLVM API change.
...
llvm-svn: 78946
2009-08-13 21:57:51 +00:00
Ryan Flynn
1f1fdc070e
map previously ignored __attribute((malloc)) to noalias attribute of llvm function's return
...
llvm-svn: 78541
2009-08-09 20:07:29 +00:00
Anders Carlsson
b8be93fc92
Add support for global initializers.
...
llvm-svn: 78515
2009-08-08 23:24:23 +00:00
Daniel Dunbar
4074b93184
Use Twine instead of utostr
...
llvm-svn: 77848
2009-08-02 01:43:57 +00:00
Owen Anderson
0b75f23b94
Update for LLVM API change.
...
llvm-svn: 77722
2009-07-31 20:28:54 +00:00
John McCall
caa1945306
Allow functions to be marked "implicit return zero" and so mark main().
...
Codegen by initializing the return value with its LLVM type's null value.
llvm-svn: 77288
2009-07-28 01:00:58 +00:00
Owen Anderson
170229f68d
Update for LLVM API change, and contextify a bunch of related stuff.
...
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Argyrios Kyrtzidis
cfbfe78e9e
De-ASTContext-ify DeclContext.
...
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.
llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis
b4b64ca752
Remove the ASTContext parameter from the attribute-related methods of Decl.
...
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext.
This commit touches a lot of files since call sites for these methods are everywhere.
I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it.
llvm-svn: 74501
2009-06-30 02:34:44 +00:00
Bill Wendling
1835107ed0
Make the StackProtector bitfield use enums instead of obscure numbers.
...
llvm-svn: 74414
2009-06-28 23:01:01 +00:00
Bill Wendling
d63bbadbef
Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
...
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.
llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Chris Lattner
4c8da96ea9
fix PR4423.
...
llvm-svn: 73938
2009-06-23 01:38:41 +00:00
Douglas Gregor
78bd61f661
Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
...
llvm-svn: 73702
2009-06-18 16:11:24 +00:00
Chris Lattner
4ca97c3b9e
Fix PR4372, another case where non-prototyped functions can prevent
...
always_inline from working.
llvm-svn: 73273
2009-06-13 00:26:38 +00:00
Anton Korobeynikov
18adbf5f07
Add new ABIArgInfo kind: Extend. This allows target to implement its own argument
...
zero/sign extension logic (consider, e.g. target has only 64 bit registers and thus
i32's should be extended as well).
llvm-svn: 72998
2009-06-06 09:36:29 +00:00
Anton Korobeynikov
244360d62b
Factor out TargetABIInfo stuff into separate file. No functionality change.
...
llvm-svn: 72962
2009-06-05 22:08:42 +00:00
Devang Patel
9e24386c65
Set function Attribute::NoImplicitFloat appropriately.
...
llvm-svn: 72961
2009-06-05 22:05:48 +00:00
Daniel Dunbar
4be99ff767
ABI handling: Fix nasty thinko where IRgen could generate an out-of-bounds read
...
when generating a coercion for ABI handling purposes.
- This may only manifest itself when building at -O0, but the practical effect
is that other arguments may get clobbered.
- <rdar://problem/6930451> [irgen] ABI coercion clobbers other arguments
llvm-svn: 72932
2009-06-05 07:58:54 +00:00
Devang Patel
6e467b1a46
Set function attribute llvm::Attribute::NoRedZone appropriately.
...
llvm-svn: 72902
2009-06-04 23:32:02 +00:00
Daniel Dunbar
1518b64ddc
When trying to pass an argument on the stack, assume LLVM will do the right
...
thing for non-aggregate types.
- Otherwise we unnecessarily pin values to the stack and currently end up
triggering a backend bug in one case.
- This loose cooperation with LLVM to implement the ABI is pretty ugly.
- <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on
x86-64
llvm-svn: 72419
2009-05-26 16:37:37 +00:00
Daniel Dunbar
499f3f9c5d
x86_64 ABI: Account for sret parameters consuming an integer register.
...
- PR4242.
llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Torok Edwin
5b34933b90
Set correct calling convention even if there is a bitcast in the way.
...
This attempts to fix PR4239.
llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Jay Foad
7d0479f2c2
Use v.data() instead of &v[0] when SmallVector v might be empty.
...
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Anders Carlsson
6f5a015bd9
Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
...
llvm-svn: 72147
2009-05-20 00:24:07 +00:00
Anders Carlsson
8370964257
Pass the destination QualType to EmitStoreOfScalar. No functionality change.
...
llvm-svn: 72118
2009-05-19 18:50:41 +00:00
Eli Friedman
cec35d7e6a
Clean up some unnecessary includes.
...
llvm-svn: 72101
2009-05-19 04:30:57 +00:00
Mike Stump
18bb9284ff
Reflow some comments.
...
llvm-svn: 71937
2009-05-16 07:57:57 +00:00
Daniel Dunbar
ffdb8439d7
ABI handling: Fix invalid assertion, it is possible for a valid
...
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.
llvm-svn: 71695
2009-05-13 18:54:26 +00:00
Chris Lattner
bea5b622be
static methods don't get this pointers.
...
llvm-svn: 71586
2009-05-12 20:27:19 +00:00
Daniel Dunbar
bbfd054746
Darwin x86-32 ABI: Now that structure passing is farther along, we
...
don't need special treatment for unions.
llvm-svn: 71559
2009-05-12 17:00:20 +00:00
Daniel Dunbar
203e2e8dd8
x86-64 ABI: clang incorrectly passes union { long double, float } in
...
register.
- Merge algorithm was returning MEMORY as it should.
llvm-svn: 71556
2009-05-12 15:22:40 +00:00
Daniel Dunbar
097353cbb5
Darwin x86-32: Multi-dimensional arrays were not handled correctly,
...
spotted by Eli!
llvm-svn: 71490
2009-05-11 23:01:34 +00:00
Daniel Dunbar
2ce6b3f91c
Darwin x86_32: Treat records with unnamed bit-fields as "empty".
...
llvm-svn: 71461
2009-05-11 18:58:49 +00:00
Duncan Sands
c76fe8b611
Correct for renaming PaddedSize -> AllocSize in
...
LLVM.
llvm-svn: 71350
2009-05-09 07:08:47 +00:00
Daniel Dunbar
b997f3bcc3
x86_64 ABI: Ignore padding bit-fields during classification.
...
- {return-types,single-args}-{32,64} pass the first 1k ABI tests with
bit-fields enabled.
llvm-svn: 71272
2009-05-08 22:26:44 +00:00
Daniel Dunbar
4752783057
Darwin x86_32: When coercing a "single element" structure, make sure
...
to use a wide enough type. This might be wider than the "single
element"'s type in the presence of padding bit-fields.
- Darwin x86_32 now passes the first 1k ABI tests with bit-field
generation enabled.
llvm-svn: 71270
2009-05-08 21:30:11 +00:00
Daniel Dunbar
fdda3501a0
Darwin x86_32: Ignore padding bit-fields when looking for "single
...
element" structures.
llvm-svn: 71266
2009-05-08 21:04:47 +00:00
Daniel Dunbar
4861346c44
Darwin x86_32: Improve bit-field handling for returning records.
...
- This turns out to be a no-op now that most of the handling for
everything else is in place.
llvm-svn: 71261
2009-05-08 20:55:49 +00:00
Daniel Dunbar
85f4028f2e
Darwin x86_32: Ignore arrays of empty structures inside records.
...
- This eliminates 5/1000 failures on return-types-32, on the current
ABITest config.
llvm-svn: 71250
2009-05-08 20:21:04 +00:00
Chris Lattner
b822fad20f
fix i128 to return in 2 64-bit registers (rax/rdx on x86-64)
...
llvm-svn: 70481
2009-04-30 06:22:07 +00:00
Chris Lattner
f122cef4df
initial support for __[u]int128_t, which should be basically
...
compatible with VC++ and GCC. The codegen/mangling angle hasn't
been fully ironed out yet. Note that we accept int128_t even in
32-bit mode, unlike gcc.
llvm-svn: 70464
2009-04-30 02:43:43 +00:00
Daniel Dunbar
01910a50c4
x86-32 ABI: Fix crash on return of structure with flexible array
...
member.
Also, spell bitfield more consistently as bit-field.
llvm-svn: 70220
2009-04-27 18:31:32 +00:00
Eli Friedman
1c4a175aef
Remove getIntegerConstantExprValue in favor of using EvaluateAsInt.
...
llvm-svn: 70145
2009-04-26 19:19:15 +00:00
Sanjiv Gupta
4c5dfd3c45
Pass and return aggregate types directly to function calls.
...
llvm-svn: 69668
2009-04-21 06:01:16 +00:00
Anders Carlsson
603d6aff8b
Make CodeGenFunction::EmitCallArgs a template function that takes a generic "Type Info" parameter. The type info parameter knows how to iterate over its arguments.
...
llvm-svn: 69469
2009-04-18 20:20:22 +00:00
Daniel Dunbar
4184ac847f
Update to use hasAttr() instead of getAttr().
...
- No functionality change.
llvm-svn: 68987
2009-04-13 21:08:27 +00:00
Daniel Dunbar
8c920c9220
Don't set both readnone and readonly.
...
llvm-svn: 68833
2009-04-10 22:14:52 +00:00
Douglas Gregor
bcced4ec31
Propagate the ASTContext to various AST traversal and lookup functions.
...
No functionality change (really).
llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Anders Carlsson
60ce3fe140
Add code for emitting call arguments (not used yet).
...
llvm-svn: 68639
2009-04-08 20:47:54 +00:00
Anders Carlsson
a60cbcdfe6
Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
...
llvm-svn: 68583
2009-04-08 02:55:55 +00:00
Anders Carlsson
6f811f149b
Add a getFunctionInfo that takes a BlockPointerType.
...
llvm-svn: 68452
2009-04-06 18:05:26 +00:00
Anton Korobeynikov
c847824e8e
Basic support for regparm codegen
...
llvm-svn: 68414
2009-04-04 00:49:24 +00:00
Anders Carlsson
b15b55c2d0
Add a getFunctionInfo that takes a CXXMethodDecl.
...
llvm-svn: 68411
2009-04-03 22:48:58 +00:00
Daniel Dunbar
e80bd1897c
x86-32 Darwin ABI: Handle small structures correctly.
...
- Small structures are returned in a register if:
1. They fit nicely in a register.
2. All fields fit nicely in a register.
(more or less)
- We now pass the first 5000 ABITests if unions are disabled.
- <rdar://problem/6497882> [irgen] x86-32 ABI compatibility with
small structs
llvm-svn: 68197
2009-04-01 07:45:00 +00:00
Daniel Dunbar
58e2971bb0
x86-32 Darwin ABI: Single element arrays can be part of "single
...
element structures", which have different ABI rules.
- Current return-arguments-32 status is: 1 out of 1000 failures (-7)
- Also, vectors inside "single element structs" require special
handling.
llvm-svn: 68196
2009-04-01 07:08:38 +00:00
Daniel Dunbar
cd76e673eb
x86-32 Darwin ABI: Handle direct return of vectors.
...
- Current return-arguments-32 status is: 8 out of 1000 failures (-7)
llvm-svn: 68192
2009-04-01 06:13:08 +00:00
Daniel Dunbar
35579146aa
x86_32 Darwin ABI: Treat empty unions like empty structures.
...
- Current return-arguments-32 status: 15/1000 failures
llvm-svn: 68132
2009-03-31 19:01:39 +00:00
Eli Friedman
bbcf49e410
Initial implementation of ARM ABI. Mostly untested. Note that I'm not
...
really intending to take ownership of this; I wrote this mostly because
I was curious about how the ARM ABI works. It should be a decent start,
though.
llvm-svn: 67969
2009-03-29 00:15:25 +00:00
Eli Friedman
2dc5f29ff2
Fix the ABI convention for struct returns on x86 outside of Darwin.
...
llvm-svn: 67577
2009-03-23 23:26:24 +00:00
Chris Lattner
e09ad90882
don't set the name of a call instruction to "call" in release-asserts
...
build. This shaves another 3% off.
llvm-svn: 67460
2009-03-22 00:32:22 +00:00
Daniel Dunbar
c230443178
PR3835: Interaction with ABI structure passing can inhibit
...
readnone/readonly attributes.
llvm-svn: 67224
2009-03-18 19:51:01 +00:00
Daniel Dunbar
8ce48d8c10
x86_32 ABI: Don't try and expand structures with bitfields.
...
- This is an ABI incompatiblity, but this is not likely to be a huge
deal in practice. For now we at least generate self consistent code
instead of crashing.
- <rdar://problem/6657601> x86-32 ABI: Bitfields in small structures
are not passed correctly
llvm-svn: 66713
2009-03-11 22:05:26 +00:00
Daniel Dunbar
4095d89532
Remove some now-unneeded calls to llvm::errs().flush().
...
llvm-svn: 66555
2009-03-10 18:00:19 +00:00
Daniel Dunbar
94911a91d5
x86_64 ABI: Handle long double in union when upper eightbyte results
...
in a lone X87 class.
- PR3735.
llvm-svn: 66277
2009-03-06 17:50:25 +00:00
Daniel Dunbar
b960b7b7c7
Cleanup handling of function attributes in calls.
...
- No intended functionality change.
llvm-svn: 65805
2009-03-02 04:32:35 +00:00
Douglas Gregor
deaad8cc34
Create a new TypeNodes.def file that enumerates all of the types,
...
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.
Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.
As part of this, some types have been renamed:
TypeOfExpr -> TypeOfExprType
FunctionTypeProto -> FunctionProtoType
FunctionTypeNoProto -> FunctionNoProtoType
There shouldn't be any functionality change...
llvm-svn: 65591
2009-02-26 23:50:07 +00:00
Daniel Dunbar
76ba41ce4f
Add Type::hasPointerRepresentation predicate.
...
- For types whose native representation is a pointer.
- Use to replace ExprConstant.cpp:HasPointerEvalType,
CodeGenFunction::isObjCPointerType.
llvm-svn: 65569
2009-02-26 20:52:22 +00:00
Daniel Dunbar
e2617d97a5
Drop uses of isPointerLikeType.
...
- No functionality change.
llvm-svn: 65560
2009-02-26 19:03:24 +00:00
Anders Carlsson
600183db9e
Classify enum types correctly
...
llvm-svn: 65533
2009-02-26 17:31:15 +00:00
Daniel Dunbar
b98d1f7140
x86_64 ABI: Qualified id types are passed as pointers.
...
- <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.
llvm-svn: 65510
2009-02-26 07:21:35 +00:00
Daniel Dunbar
4208835eec
Temporarily disable clearing of insert point (to indicate unreachable
...
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.
llvm-svn: 65473
2009-02-25 20:59:29 +00:00
Daniel Dunbar
1234749853
Add low level support for generating invoke instead of calls.
...
- No functionality change.
llvm-svn: 65325
2009-02-23 17:26:39 +00:00
Daniel Dunbar
bb525c3c7f
x86_64 ABI: Actually, we can always pass things we want to pass in
...
memory using Indirect; this was a holdover from when CGCall wasn't as
robust.
llvm-svn: 65278
2009-02-22 08:17:51 +00:00
Daniel Dunbar
075d642e24
x86_64 ABI: Make sure to pass vectors that we want to pass in memory
...
as byval. Otherwise LLVM will have its own opinion about where to put
things.
We now pass all gcc dg.compat tests on x86_64.
llvm-svn: 65266
2009-02-22 07:22:25 +00:00
Daniel Dunbar
c64c481d18
x86_64 ABI: Pass 32-bit vectors as Integer to match gcc. We don't care
...
about these much but <2 x i16> shows up in the gcc test suite.
llvm-svn: 65264
2009-02-22 04:48:22 +00:00
Daniel Dunbar
f25afad9e5
x86_64 ABI: Classify <1 x i64> as INTEGER (match gcc not llvm-gcc).
...
Also, make sure to pass <1 x i64> as i64 (not <1 x i64>, which doesn't
quite work yet in the backend).
llvm-svn: 65262
2009-02-22 04:16:10 +00:00
Daniel Dunbar
5006f4a5f0
Take advantage of noreturn attribute to add unreachable instruction &
...
clear insertion point. The rest of IRgen should theoretically take
advantage of this to avoid emitting dead code. Theory != Practice.
llvm-svn: 65141
2009-02-20 18:54:31 +00:00
Daniel Dunbar
cdbb5e336d
Set call attribute for direct calls (i.e. noreturn).
...
- Remove an unused variant of EmitCallExpr overload.
llvm-svn: 65130
2009-02-20 18:06:48 +00:00
Chris Lattner
90669d0500
switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
...
llvm-svn: 65114
2009-02-20 06:23:21 +00:00
Daniel Dunbar
8cdb9dae45
i386 ABI: Offset computation in va_arg was incorrect for sizeof(Ty)>4.
...
We are down to only failing gcc.dg/compat/vector-[12] (8 tests total).
llvm-svn: 64967
2009-02-18 22:28:45 +00:00
Daniel Dunbar
e60ec0abca
x86_64 ABI: Fix thinko in computation of bound for "passed in SSE regs" test.
...
Two more gcc/x86_64 failures down.
llvm-svn: 64963
2009-02-18 22:19:44 +00:00
Daniel Dunbar
e3bba6e3d0
x86_64 ABI: "is passed in regs" computation for va_arg was broken for
...
things passed in mixed registers.
This knocks out 8 x86_64 failures.
llvm-svn: 64958
2009-02-18 22:05:01 +00:00
Daniel Dunbar
617e89231d
x86_64 ABI: Two bug fixes.
...
1. Return of _Complex long double used wrong type.
2. va_arg of types passed in two SSE registers didn't account for
extra space in register save area.
Down to 18 failures on gcc/compat/x86_64. Combined 32/64 results are:
--
=== gcc Summary ===
# of expected passes 1292
# of unexpected failures 34
# of unsupported tests 2
--
llvm-svn: 64880
2009-02-18 03:44:19 +00:00
Daniel Dunbar
0ee13255ee
x86_64 ABI: Fix assert on return of _Complex long double.
...
llvm-svn: 64756
2009-02-17 07:55:55 +00:00
Daniel Dunbar
7f0e2368bb
x86_64 ABI: Implement classification for bit-fields.
...
llvm-svn: 64727
2009-02-17 02:45:44 +00:00
Daniel Dunbar
f2c6198eef
x86_64 ABI: Handle va_arg arguments with alignment > 8.
...
llvm-svn: 64701
2009-02-16 23:38:56 +00:00
Daniel Dunbar
3d88672f64
x86_64 ABI: Need to use canonical types when comparing against
...
ASTContext types.
llvm-svn: 64533
2009-02-14 02:45:45 +00:00
Daniel Dunbar
019ef0bbfe
x86_64 ABI: Pass simple types directly when possible. This is
...
important for both keeping the generated LLVM simple and for ensuring
that integer types are passed/promoted correctly.
llvm-svn: 64529
2009-02-14 02:09:24 +00:00
Daniel Dunbar
abe6ef932f
x86_64 ABI: Support va_arg passed in mixed registers.
...
- Now at 1274 passes on gcc compat suite vs 1262.
llvm-svn: 64469
2009-02-13 17:46:31 +00:00
Daniel Dunbar
753cc07d13
x86_64: Initial varargs support.
...
- Doesn't yet handle case where values are passed in mixed (general
purpose & floating point) registers; otherwise largely
functional. Code still needs some cleaning.
Fixes:
MultiSource/Applications/lua/lua
MultiSource/Applications/siod/siod
MultiSource/Applications/sqlite3/sqlite3
SingleSource/Regression/C/PR640
SingleSource/UnitTests/2003-07-09-SignedArgs
SingleSource/UnitTests/2007-03-02-VaCopy
gcc compat test suite results (Darwin x86-32 & -64):
--
# of expected passes 1262
# of unexpected failures 56
# of unresolved testcases 34
# of unsupported tests 2
Compare to: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090209/012050.html
llvm-svn: 64370
2009-02-12 09:04:14 +00:00
Daniel Dunbar
2d0746fb97
Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
...
llvm-svn: 64235
2009-02-10 20:44:09 +00:00
Daniel Dunbar
9403cd6d85
Tweak x86-64 ABI to allow reuse for vararg handling.
...
llvm-svn: 64221
2009-02-10 17:06:09 +00:00