Commit Graph

35 Commits

Author SHA1 Message Date
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
Devang Patel e2aef07b2d Adjust whitespaces.
llvm-svn: 56538
2008-09-24 01:03:00 +00:00
Devang Patel 3e1f51b53f s/ParamAttrsWithIndex/FnAttributeWithIndex/g
Rename to match changes done on llvm side.

llvm-svn: 56537
2008-09-24 01:01:36 +00:00
Daniel Dunbar 86d97c7985 Improve x86 ABI compatibility.
- Enables use of ABIArgInfo::Expand when needed. This greatly
   improves our x86 ABI compatibility.

 - As the infrastructure for target specific ABI handling isn't built
   yet, this change means ABI compatibility on other platforms is once
   again broken in a different way than before.

 - Upcoming: Figure out how to refactor ABI handling into
   targets. More documentation.

llvm-svn: 56293
2008-09-17 21:22:33 +00:00
Daniel Dunbar d34d6dc458 Drop CodeGenTypes parameter to classifyArgumentType.
Ensure that ABIArgInfo::Default implementation for aggregrate types
is sensible (StructRet on return and ByVal on arguments).

No functionality change.

llvm-svn: 56289
2008-09-17 20:11:04 +00:00
Daniel Dunbar 8fc81b02e2 Add support for ABIArgInfo::Expand
- No functionality change.

llvm-svn: 56269
2008-09-17 00:51:38 +00:00
Daniel Dunbar d3674e6f40 Use ABIArgInfo for decisions about function arguments (not just return
value).
 - Added ABIArgInfo::ByVal (mostly supported) and ABIArgInfo::Expand
   (asserted out).

 - Added classifyArgumentType which currently just uses
   ABIArgInfo::Default or ByVal. This nearly matches old behavior, but
   we now set ByVal in a few situations we may have left it off before
   (on complex, for example).

llvm-svn: 56086
2008-09-11 01:48:57 +00:00
Daniel Dunbar 83876b4594 Bug fix, apply default argument promotion in message sends for which
no method declaration was found.
 - This was allowing arrays to pass "by value" among other things.

Add assert in CodeGen that arguments cannot have array type.

llvm-svn: 56080
2008-09-11 00:04:36 +00:00
Daniel Dunbar 573884eaf7 Implement ABIArgType::Coerce support.
- As a test, enable basic usage for some common x86-32 cases. This
    increases our x86-32 compliance (on other targets our compliance
    will just be broken in a different way).

llvm-svn: 56051
2008-09-10 07:04:09 +00:00
Daniel Dunbar b8b4759462 Add CodeGenTypes::GetFunctionType overload for getting the effective
type of a call.

Change NeXT runtime to use this instead of trying to bitcasting
internally (which doesn't respect the ABI).

Fix subtle bug, use of ConvertTypeRecursive instead of ConvertType is
bad inside GetFunctionType.

llvm-svn: 56050
2008-09-10 07:00:50 +00:00
Daniel Dunbar 7a95ca3197 Move FunctionType conversion into CGCall.cpp:
- Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo.
 - Updated Obj-C runtimes to use this instead of rolling the
   llvm::FunctionType by hand.
 - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}.

Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.

llvm-svn: 56047
2008-09-10 04:01:49 +00:00
Daniel Dunbar a72d4aece6 Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.

llvm-svn: 56046
2008-09-10 02:41:04 +00:00
Daniel Dunbar c68897d2c3 Tweak CGCall functions again:
- Realized these functions will eventually need access to more data,
   moved to CodeGenModule. Eventually they should probably live
   together in some other helper class.

llvm-svn: 56039
2008-09-10 00:41:16 +00:00
Daniel Dunbar 76c8eb75b1 Tweak CGCall functions:
- Move actual param attr list creation to
   CodeGenFunction::ConstructParamAttrList.
 - Make ReturnTypeUsesSret static.

llvm-svn: 56038
2008-09-10 00:32:18 +00:00
Daniel Dunbar 81cf67fa0b Add CodeGenFunction::ReturnTypeUsesSret
- Hook so NeXT runtime doesn't depend on ABI.

llvm-svn: 56034
2008-09-09 23:48:28 +00:00
Daniel Dunbar 613855c8af Move ABI specific code for functions / calls to CGCall.cpp:
- Factor out EmitFunction{Pro,Epi}log

llvm-svn: 56031
2008-09-09 23:27:19 +00:00
Daniel Dunbar 41cf9dedc6 Change CodeGen to emit calls using (RValue,Type) list:
- Add CodeGenFunction::EmitAnyExprToTemp
   o Like EmitAnyExpr, but emits aggregates to a temporary location if
     none is available. Seems like this should be simpler (even aside
     from using first class aggregates).

 - Killed CodeGenFunction::EmitCallArg (just append the pair)

 - Conversion of RValues to actual call arguments is now isolated in
   CodeGenFunction::EmitCall.

llvm-svn: 55970
2008-09-09 01:06:48 +00:00
Daniel Dunbar 3d7c90b8ec Refactor parameter attribute handling:
- Add CGCall.h for dealing with ABI issues related to calls.
  - Add CGFunctionInfo and CGCallInfo for capturing ABI relevant
    information about functions and calls.
  - Isolate LLVM parameter attribute handling inside CGCall.cpp

llvm-svn: 55963
2008-09-08 21:33:45 +00:00