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
Daniel Dunbar
9bfb4de38b
ABI: Correctly handle load/store of values which have a different LLVM
...
memory representation (e.g., bool).
- This upgrades (downgrades) MultiSource/Applications/ClamAV/clamscan
to a miscompile and fixes
SingleSource/UnitTests/2003-05-31-CastToBool.
llvm-svn: 64194
2009-02-10 01:51:39 +00:00
Daniel Dunbar
d5f1f55e28
Make sure to initialize local variables, even if they were ignored by
...
ABI.
llvm-svn: 64187
2009-02-10 00:06:49 +00:00
Daniel Dunbar
ee9e4c274b
Set load/store alignment when doing ABI coercions.
...
- Currently, this is producing poor code, but we prefer correctness
to performance for now. Eventually we should be able to generally
avoid having to set the alignment when we control the alignment of
the alloca.
- This knocks out 33/1000 failures on my single argument ABI tests,
down to 22/1000 and 18 of these appear to be gcc bugs. Woot.
llvm-svn: 64001
2009-02-07 02:46:03 +00:00
Daniel Dunbar
5d3dbd64e1
Implement Direct ABIInfo semantics.
...
- No intended functionality change, this is essentially enabling
direct passing of complex and aggregate values, which no ABI is
using.
llvm-svn: 63863
2009-02-05 11:13:54 +00:00
Daniel Dunbar
cea3af4e54
Simplify test for whether we need an alloca to hold an indirect return
...
value.
- No functionality change.
llvm-svn: 63859
2009-02-05 09:24:53 +00:00
Daniel Dunbar
747865af0c
Implement ABI Indirect sematics for arguments.
...
- No intended functionality change, all current ABI implementations
were only using indirect for complex/aggregate types, which were
being passed indirectly with the Direct ABIInfo kind.
llvm-svn: 63858
2009-02-05 09:16:39 +00:00
Daniel Dunbar
b8b1c679c4
Merge ABIInfo StructRet/ByVal into Indirect.
...
- No (intended) functionality change, the semantic changes are to come.
llvm-svn: 63850
2009-02-05 08:00:50 +00:00
Daniel Dunbar
c79407fc40
Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
...
llvm-svn: 63845
2009-02-05 07:09:07 +00:00
Daniel Dunbar
70245be397
x86-32: Use Ignore to avoid passing empty structs (instead of Expand).
...
llvm-svn: 63813
2009-02-05 01:50:07 +00:00
Daniel Dunbar
0103574d55
Honor ByVal alignment. Patch by Nate Begeman!
...
llvm-svn: 63811
2009-02-05 01:31:19 +00:00
Daniel Dunbar
fff09f335d
Unbreak CGFunctionInfo::Profile method and reenable caching of ABI
...
information.
llvm-svn: 63799
2009-02-05 00:00:23 +00:00
Daniel Dunbar
56e7552c73
Add ABIArgInfo::dump()
...
llvm-svn: 63794
2009-02-04 23:24:38 +00:00
Daniel Dunbar
fb5fdf1f14
Temporarily disable caching of ABI results; this is going horribly
...
wrong in some cases.
llvm-svn: 63780
2009-02-04 21:36:22 +00:00
Daniel Dunbar
a45bdbbb6a
Add asserts that the function signature matches the other arguments provide
...
to CGCall functions.
llvm-svn: 63775
2009-02-04 21:17:21 +00:00
Daniel Dunbar
6e3b7df125
Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
...
llvm-svn: 63726
2009-02-04 07:22:24 +00:00
Daniel Dunbar
a33461150d
Use ConvertTypeForMem when creating alloca for scalar argument.
...
llvm-svn: 63681
2009-02-03 23:04:57 +00:00
Daniel Dunbar
fc7c76159c
x86_64 ABI: Initial implementation of ABI compliant parameter passing.
...
- Now only 27/500 failures on ABITest single argument tests; from
350/500. :)
- As with return types, a large percentage of these are likely to be
gcc bugs, not yet reviewed.
Also, fix bug in handling of Ignore ABI type in argument lists.
llvm-svn: 63654
2009-02-03 20:00:13 +00:00
Daniel Dunbar
2f219b0770
ABI handling: Implement coercion for argument types (in addition to
...
return types).
llvm-svn: 63645
2009-02-03 19:12:28 +00:00
Daniel Dunbar
32931eb21d
Change ABIInfo to compute information for a full signature at a time
...
(the main point of this restructing).
llvm-svn: 63619
2009-02-03 06:51:18 +00:00
Daniel Dunbar
0136282a9c
Remove ABIArgInfo::Default kind, ABI is now responsible for specifying
...
acceptable kind with more precise semantics.
llvm-svn: 63617
2009-02-03 06:30:17 +00:00
Daniel Dunbar
67dace890f
Add ABIArgInfo::Direct kind, which passes arguments using whatever the
...
native IRgen type is. This is like Default, but without any extra
semantics (like automatic tweaking of structures or void).
llvm-svn: 63615
2009-02-03 06:17:37 +00:00
Daniel Dunbar
5a0acdc982
Add two FIXMEs.
...
llvm-svn: 63613
2009-02-03 06:02:10 +00:00
Daniel Dunbar
b52d077d8b
Always use CGFunctionInfo to access ABI information.
...
llvm-svn: 63612
2009-02-03 05:59:18 +00:00
Daniel Dunbar
313321ea23
Move ABIArgInfo into CGFunctionInfo, computed on creation.
...
- Still have to convert some consumers over.
llvm-svn: 63610
2009-02-03 05:31:23 +00:00
Daniel Dunbar
6d6b0d309a
Move ABIInfo/ABIArgInfo classes into ABIInfo.h
...
llvm-svn: 63586
2009-02-03 01:05:53 +00:00
Daniel Dunbar
e0be82956b
Memoize CGFunctionInfo construction.
...
llvm-svn: 63576
2009-02-03 00:07:12 +00:00
Daniel Dunbar
3668cb2d3c
Change CGFunctionInfo args iterator to not include the return type.
...
llvm-svn: 63571
2009-02-02 23:43:58 +00:00
Daniel Dunbar
bf8c24ad89
Thread CGFunctionInfo construction through CodeGenTypes.
...
- Inefficient & leaks memory currently, will be cleaned up subsequently.
llvm-svn: 63567
2009-02-02 23:23:47 +00:00
Daniel Dunbar
d931a87f90
More ABI API cleanup.
...
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
EmitFunction{Epi,Pro}log.
llvm-svn: 63553
2009-02-02 22:03:45 +00:00
Daniel Dunbar
7633cbf005
ABI handling API changes.
...
- Lift CGFunctionInfo creation up to callers of EmitCall.
- Move isVariadic bit out of CGFunctionInfo, take as argument to
GetFunctionType instead.
No functionality change.
llvm-svn: 63550
2009-02-02 21:43:58 +00:00
Daniel Dunbar
f5589ac5a9
Shuffle some functions around, no functionality change.
...
llvm-svn: 63538
2009-02-02 19:06:38 +00:00
Daniel Dunbar
50f520171c
Add FIXME.
...
llvm-svn: 63531
2009-02-02 18:06:39 +00:00
Daniel Dunbar
5df2b0baaa
Remove unused overload of GetFunctionType.
...
llvm-svn: 63472
2009-01-31 03:05:44 +00:00
Daniel Dunbar
a8b7f6bb13
Initialize CGFunctionInfo isVariadic bit correctly.
...
llvm-svn: 63471
2009-01-31 02:54:56 +00:00
Daniel Dunbar
a37249c663
Err, unbreak my previous "no functionality change commit", will fix properly later.
...
llvm-svn: 63467
2009-01-31 02:20:43 +00:00
Daniel Dunbar
3cd20632ff
Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
...
function/call info.
llvm-svn: 63466
2009-01-31 02:19:00 +00:00
Daniel Dunbar
34aa3ca8c4
x86_64 ABI: Retool classification to compute lo & hi classifications
...
in terms of where the type resides in the containing object. This is a
more clear embodiement of the spec & fixes a merging issue with
unions. Down to 3/1000 failures.
llvm-svn: 63455
2009-01-31 00:06:58 +00:00
Daniel Dunbar
6a046c64d9
x86_64 ABI: Fix more thinkos, straddling computation for complex was
...
computing in bytes not bits. We are now down to 22/1000 failures on
the return types tests, and 18 of those are gcc bugs I believe.
llvm-svn: 63438
2009-01-30 22:40:15 +00:00
Daniel Dunbar
c35dca92f5
x86_64 ABI: Fix thinko in prev commit, 64-bit vectors should have SSE
...
class, not integer.
llvm-svn: 63426
2009-01-30 21:50:20 +00:00
Daniel Dunbar
4d22eaeb44
x86_64 ABI: Pass <1 x double> in memory. This is arguably wrong, but
...
matches gcc 4.2 (not llvm-gcc).
llvm-svn: 63413
2009-01-30 19:38:39 +00:00
Daniel Dunbar
7da8d0b321
Remove testing -use-x86_64-abi option; current implementation is
...
robust enough for general use.
llvm-svn: 63406
2009-01-30 18:47:53 +00:00
Daniel Dunbar
890c6b5520
x86_64 ABI: Split small vectors which cross an eightbyte boundary. Down to 33/500 return type failures.
...
llvm-svn: 63404
2009-01-30 18:40:10 +00:00
Daniel Dunbar
f5222fa0ad
x86_64 ABI: Implement classification for arrays.
...
- This brings us down to an 8% failure rate on the first 500 return
types tests (from 12%).
llvm-svn: 63383
2009-01-30 08:09:32 +00:00
Daniel Dunbar
62dc51c395
Use uint64_t not unsigned for type sizes/offsets.
...
llvm-svn: 63352
2009-01-30 00:47:38 +00:00
Daniel Dunbar
5537b8bc6c
x86_64 ABI: Handle fields / complex components which straddle
...
eightbyte boundaries.
- Getting harder to test now that we handle cases gcc & llvm-gcc get
wrong ( { _Complex char; _Complex int; } is a good example). :)
llvm-svn: 63305
2009-01-29 09:42:07 +00:00
Daniel Dunbar
7cd7d47c5c
x86_64 ABI: Tweak merging algorithm so that we always bail early when
...
we see a Memory classification.
llvm-svn: 63295
2009-01-29 08:35:40 +00:00
Daniel Dunbar
012468aa7f
ABI: When emitting calls which return an ignored argument, make sure
...
to still return an RValue of the correct type.
llvm-svn: 63294
2009-01-29 08:24:57 +00:00
Daniel Dunbar
17aa941534
x86_64 ABI: Implement classification for records.
...
- This is my best initial guess at what the "spec" means, although it is not
particularly clear on a number of points. Will refine through testing.
llvm-svn: 63292
2009-01-29 08:13:58 +00:00
Daniel Dunbar
227e1a77ff
x86_64: Support cases which map to returning multiple values in LLVM
...
(e.g., _Complex double -> { double, double } return).
llvm-svn: 63285
2009-01-29 07:36:07 +00:00
Daniel Dunbar
8e6652affc
x86_64 ABI: Classify _Complex ints as integer.
...
llvm-svn: 63283
2009-01-29 07:22:20 +00:00
Daniel Dunbar
d678d3d970
x86_64: Classify __m64 and __m128 "correctly".
...
- gcc appears to be classifying <1 x double> as INTEGER which is
odd. Will investigate later.
llvm-svn: 63086
2009-01-27 02:01:34 +00:00
Daniel Dunbar
0f4aa3cbb1
Implement support for coercion to wider types during ABI handling.
...
- Code quality is poor, but simple.
llvm-svn: 63083
2009-01-27 01:36:03 +00:00
Daniel Dunbar
94a6f25738
Add Ignore ABIArgInfo kind, for handling void & empty structures.
...
llvm-svn: 63039
2009-01-26 21:26:08 +00:00
Daniel Dunbar
3334a44501
Start filling in x86_64 ABI implementation.
...
- No functionality change, moved behind -use-x86_64-abi option until
it becomes non-experimental.
llvm-svn: 62915
2009-01-24 08:32:22 +00:00
Daniel Dunbar
707f6436e0
Add dummy X86_64 ABIInfo implementation.
...
llvm-svn: 62268
2009-01-15 18:18:40 +00:00
Douglas Gregor
ffca3a21f1
Provide a new kind of iterator, the specific_decl_iterator, that
...
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.
llvm-svn: 61994
2009-01-09 17:18:27 +00:00
Daniel Dunbar
9ae0afdcd6
Allow ABI to use StructRet even for scalar values.
...
- Update comment to reflect fact that StructRet is now supported for
any type (modulo LLVM support).
- No functionality change, no scalar types currently use this
feature.
llvm-svn: 61192
2008-12-18 04:52:14 +00:00
Anders Carlsson
32ef8ceaa1
Handle returning complex types that get coerced. Fixes PR3131
...
llvm-svn: 60058
2008-11-25 22:21:48 +00:00
Chris Lattner
1cbaacc4a0
Migrate some stuff from NamedDecl::getName() to
...
NamedDecl::getNameAsString() to make it more explicit.
llvm-svn: 59937
2008-11-24 04:00:27 +00:00
Anders Carlsson
312045115e
Fix silly bug spotted by Daniel Dunbar
...
llvm-svn: 59358
2008-11-15 06:35:36 +00:00
Anders Carlsson
d0e4f2b106
Handle complex return values.
...
llvm-svn: 59345
2008-11-15 01:29:05 +00:00
Daniel Dunbar
d9eff3d4e4
Lift out ABIInfo abstract base class.
...
- Currently still lives in CGCall.cpp but is intended to be the
target specific place for hooking ABI information.
- Select ABIInfo to use based on Target's prefix and pointer width.
llvm-svn: 57445
2008-10-13 17:02:26 +00:00
Anders Carlsson
b83162840f
Implement support for the const and pure attributes.
...
llvm-svn: 57142
2008-10-05 23:32:53 +00:00
Devang Patel
597e70876e
Now Attributes are divided in three groups
...
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn
Return attributes use 0 as the index.
Function attributes use ~0U as the index.
llvm-svn: 56705
2008-09-26 22:53:57 +00:00
Devang Patel
322300d1c2
Large mechanical patch.
...
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
llvm-svn: 56623
2008-09-25 21:02:23 +00:00