Commit Graph

777 Commits

Author SHA1 Message Date
Daniel Dunbar 8a9f3fd8bb Set the calling convention based on the CGFunctionInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 22:25:00 +00:00
Daniel Dunbar bac7c250c9 Add CallingConvention argument to CGFunctionInfo.
- Currently unused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 22:24:53 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Owen Anderson 0032b2781b Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:57:51 +00:00
Ryan Flynn 76168e289c map previously ignored __attribute((malloc)) to noalias attribute of llvm function's return
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78541 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-09 20:07:29 +00:00
Anders Carlsson 89ed31d3f9 Add support for global initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78515 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-08 23:24:23 +00:00
Daniel Dunbar 0ab9a25101 Use Twine instead of utostr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-02 01:43:57 +00:00
Owen Anderson c9c88b4159 Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 20:28:54 +00:00
John McCall 0cfeb63f53 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 01:00:58 +00:00
Owen Anderson a1cf15f468 Update for LLVM API change, and contextify a bunch of related stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75705 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:10:40 +00:00
Argyrios Kyrtzidis 17945a0f64 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis 40b598eea1 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30 02:34:44 +00:00
Bill Wendling 4ebe3e4c81 Make the StackProtector bitfield use enums instead of obscure numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 23:01:01 +00:00
Bill Wendling 45483f7a1b 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28 07:36:13 +00:00
Chris Lattner d6bebbfd51 fix PR4423.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 01:38:41 +00:00
Douglas Gregor 68584ed35a Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:11:24 +00:00
Chris Lattner 5db7ae59bb Fix PR4372, another case where non-prototyped functions can prevent
always_inline from working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73273 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 00:26:38 +00:00
Anton Korobeynikov cc6fa88666 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-06 09:36:29 +00:00
Anton Korobeynikov c4a59eb306 Factor out TargetABIInfo stuff into separate file. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 22:08:42 +00:00
Devang Patel acebb397fa Set function Attribute::NoImplicitFloat appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 22:05:48 +00:00
Daniel Dunbar fdf4986c4c 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72932 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 07:58:54 +00:00
Devang Patel 24095dad88 Set function attribute llvm::Attribute::NoRedZone appropriately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 23:32:02 +00:00
Daniel Dunbar 86e13eeb65 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 16:37:37 +00:00
Daniel Dunbar 3a5f5c57e0 x86_64 ABI: Account for sret parameters consuming an integer register.
- PR4242.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 17:33:44 +00:00
Torok Edwin 6857d9d43b Set correct calling convention even if there is a bitcast in the way.
This attempts to fix PR4239.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 07:25:06 +00:00
Jay Foad beaaccd8e2 Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:52:38 +00:00
Anders Carlsson 4029ca7ae9 Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 00:24:07 +00:00
Anders Carlsson b4aa4664ec Pass the destination QualType to EmitStoreOfScalar. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 18:50:41 +00:00
Eli Friedman ac8d6298a8 Clean up some unnecessary includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 04:30:57 +00:00
Mike Stump f5408fe484 Reflow some comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71937 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16 07:57:57 +00:00
Daniel Dunbar 7ef455be9b 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13 18:54:26 +00:00
Chris Lattner 3eb67ca786 static methods don't get this pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 20:27:19 +00:00
Daniel Dunbar 836a0641ba Darwin x86-32 ABI: Now that structure passing is farther along, we
don't need special treatment for unions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 17:00:20 +00:00
Daniel Dunbar 20e95c5eb4 x86-64 ABI: clang incorrectly passes union { long double, float } in
register.
 - Merge algorithm was returning MEMORY as it should.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71556 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12 15:22:40 +00:00
Daniel Dunbar cc401dc651 Darwin x86-32: Multi-dimensional arrays were not handled correctly,
spotted by Eli!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71490 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 23:01:34 +00:00
Daniel Dunbar 573b907e8b Darwin x86_32: Treat records with unnamed bit-fields as "empty".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11 18:58:49 +00:00
Duncan Sands 9408c45009 Correct for renaming PaddedSize -> AllocSize in
LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09 07:08:47 +00:00
Daniel Dunbar 8236bf1800 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 22:26:44 +00:00
Daniel Dunbar 2e0011650f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:30:11 +00:00
Daniel Dunbar fcab2ca966 Darwin x86_32: Ignore padding bit-fields when looking for "single
element" structures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 21:04:47 +00:00
Daniel Dunbar eedd292ea0 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:55:49 +00:00
Daniel Dunbar f7fff322de Darwin x86_32: Ignore arrays of empty structures inside records.
- This eliminates 5/1000 failures on return-types-32, on the current
   ABITest config.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08 20:21:04 +00:00
Chris Lattner ae69e005a9 fix i128 to return in 2 64-bit registers (rax/rdx on x86-64)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 06:22:07 +00:00
Chris Lattner 2df9ced9fd 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70464 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 02:43:43 +00:00
Daniel Dunbar 8e03444e92 x86-32 ABI: Fix crash on return of structure with flexible array
member.

Also, spell bitfield more consistently as bit-field.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 18:31:32 +00:00
Eli Friedman 9a901bb639 Remove getIntegerConstantExprValue in favor of using EvaluateAsInt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 19:19:15 +00:00
Sanjiv Gupta 70aa5f9e9f Pass and return aggregate types directly to function calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 06:01:16 +00:00
Anders Carlsson af23f69aa6 Make CodeGenFunction::EmitCallArgs a template function that takes a generic "Type Info" parameter. The type info parameter knows how to iterate over its arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 20:20:22 +00:00
Daniel Dunbar b11fa0d25d Update to use hasAttr() instead of getAttr().
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 21:08:27 +00:00
Daniel Dunbar 64c2e07626 Don't set both readnone and readonly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68833 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 22:14:52 +00:00
Douglas Gregor 6ab3524f72 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 21:40:53 +00:00
Anders Carlsson 0139bb9649 Add code for emitting call arguments (not used yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 20:47:54 +00:00
Anders Carlsson a17d7ccc2e Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 02:55:55 +00:00
Anders Carlsson 5529b24500 Add a getFunctionInfo that takes a BlockPointerType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68452 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 18:05:26 +00:00
Anton Korobeynikov 1102f4282c Basic support for regparm codegen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68414 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 00:49:24 +00:00
Anders Carlsson f6f8ae561e Add a getFunctionInfo that takes a CXXMethodDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 22:48:58 +00:00
Daniel Dunbar cf6bde343f 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 07:45:00 +00:00
Daniel Dunbar dfc6b80ee1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 07:08:38 +00:00
Daniel Dunbar 360431660b x86-32 Darwin ABI: Handle direct return of vectors.
- Current return-arguments-32 status is: 8 out of 1000 failures (-7)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68192 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 06:13:08 +00:00
Daniel Dunbar 5bde6f4150 x86_32 Darwin ABI: Treat empty unions like empty structures.
- Current return-arguments-32 status: 15/1000 failures


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 19:01:39 +00:00
Eli Friedman a027ea94d6 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:15:25 +00:00
Eli Friedman 9fd58e85d5 Fix the ABI convention for struct returns on x86 outside of Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 23:26:24 +00:00
Chris Lattner 3403084886 don't set the name of a call instruction to "call" in release-asserts
build.  This shaves another 3% off.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67460 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 00:32:22 +00:00
Daniel Dunbar 0ac86f0821 PR3835: Interaction with ABI structure passing can inhibit
readnone/readonly attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 19:51:01 +00:00
Daniel Dunbar e06a75f4c8 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 22:05:26 +00:00
Daniel Dunbar 4a77edb3f0 Remove some now-unneeded calls to llvm::errs().flush().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:00:19 +00:00
Daniel Dunbar 100f402451 x86_64 ABI: Handle long double in union when upper eightbyte results
in a lone X87 class.
 - PR3735.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66277 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 17:50:25 +00:00
Daniel Dunbar d14151d5f5 Cleanup handling of function attributes in calls.
- No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 04:32:35 +00:00
Douglas Gregor 72564e7327 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...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 23:50:07 +00:00
Daniel Dunbar 8958891f5f Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer.

 - Use to replace ExprConstant.cpp:HasPointerEvalType,
   CodeGenFunction::isObjCPointerType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65569 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 20:52:22 +00:00
Daniel Dunbar 24a9f6e11d Drop uses of isPointerLikeType.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 19:03:24 +00:00
Anders Carlsson 708762b66a Classify enum types correctly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 17:31:15 +00:00
Daniel Dunbar 9a8c2e9051 x86_64 ABI: Qualified id types are passed as pointers.
- <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 07:21:35 +00:00
Daniel Dunbar 0334a4ec63 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 20:59:29 +00:00
Daniel Dunbar 9834ffbe54 Add low level support for generating invoke instead of calls.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23 17:26:39 +00:00
Daniel Dunbar 245f5534a5 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65278 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 08:17:51 +00:00
Daniel Dunbar 775e43b3bd 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 07:22:25 +00:00
Daniel Dunbar e28099bf30 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 04:48:22 +00:00
Daniel Dunbar 0af9929e1b 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 04:16:10 +00:00
Daniel Dunbar f4fe0f082f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 18:54:31 +00:00
Daniel Dunbar c0ef9f5993 Set call attribute for direct calls (i.e. noreturn).
- Remove an unused variant of EmitCallExpr overload.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65130 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 18:06:48 +00:00
Chris Lattner 2073216a10 switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 06:23:21 +00:00
Daniel Dunbar 570f0cf734 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 22:28:45 +00:00
Daniel Dunbar 90dafa1638 x86_64 ABI: Fix thinko in computation of bound for "passed in SSE regs" test.
Two more gcc/x86_64 failures down.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 22:19:44 +00:00
Daniel Dunbar f231346438 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 22:05:01 +00:00
Daniel Dunbar 3e030b4c04 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
--


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 03:44:19 +00:00
Daniel Dunbar 6e53e9b879 x86_64 ABI: Fix assert on return of _Complex long double.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64756 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 07:55:55 +00:00
Daniel Dunbar dd81d44fac x86_64 ABI: Implement classification for bit-fields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64727 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 02:45:44 +00:00
Daniel Dunbar c5bcee4dce x86_64 ABI: Handle va_arg arguments with alignment > 8.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 23:38:56 +00:00
Daniel Dunbar 3327f6ead9 x86_64 ABI: Need to use canonical types when comparing against
ASTContext types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 02:45:45 +00:00
Daniel Dunbar 644f4c3fe4 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64529 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 02:09:24 +00:00
Daniel Dunbar 55e5d8956b x86_64 ABI: Support va_arg passed in mixed registers.
- Now at 1274 passes on gcc compat suite vs 1262.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:46:31 +00:00
Daniel Dunbar be9eb0937c 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 09:04:14 +00:00
Daniel Dunbar b4094ea09e Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 20:44:09 +00:00
Daniel Dunbar 3b4e9cd065 Tweak x86-64 ABI to allow reuse for vararg handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 17:06:09 +00:00
Daniel Dunbar adc8bdd6ab 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 01:51:39 +00:00
Daniel Dunbar 8b979d9e4c Make sure to initialize local variables, even if they were ignored by
ABI.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 00:06:49 +00:00
Daniel Dunbar 386621f5e1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64001 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 02:46:03 +00:00
Daniel Dunbar 2fbf2f547c Implement Direct ABIInfo semantics.
- No intended functionality change, this is essentially enabling
   direct passing of complex and aggregate values, which no ABI is
   using.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 11:13:54 +00:00
Daniel Dunbar 2969a0243b Simplify test for whether we need an alloca to hold an indirect return
value.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 09:24:53 +00:00
Daniel Dunbar 1f7459814e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 09:16:39 +00:00
Daniel Dunbar 11e383aa49 Merge ABIInfo StructRet/ByVal into Indirect.
- No (intended) functionality change, the semantic changes are to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63850 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 08:00:50 +00:00
Daniel Dunbar 13e81737a4 Pull CodeGenFunction::GetUndefRValue() out of EmitUnsupportedRValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 07:09:07 +00:00
Daniel Dunbar 3170c93d26 x86-32: Use Ignore to avoid passing empty structs (instead of Expand).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 01:50:07 +00:00
Daniel Dunbar ca008822e8 Honor ByVal alignment. Patch by Nate Begeman!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 01:31:19 +00:00
Daniel Dunbar 35e67d4387 Unbreak CGFunctionInfo::Profile method and reenable caching of ABI
information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 00:00:23 +00:00
Daniel Dunbar 6f7279bf98 Add ABIArgInfo::dump()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 23:24:38 +00:00
Daniel Dunbar 747f06a264 Temporarily disable caching of ABI results; this is going horribly
wrong in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63780 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 21:36:22 +00:00
Daniel Dunbar 4b5f0a4bd6 Add asserts that the function signature matches the other arguments provide
to CGCall functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63775 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 21:17:21 +00:00
Daniel Dunbar 8b29a38778 Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 07:22:24 +00:00
Daniel Dunbar 5a1be6e16b Use ConvertTypeForMem when creating alloca for scalar argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63681 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 23:04:57 +00:00
Daniel Dunbar 59e5a0e4f1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 20:00:13 +00:00
Daniel Dunbar 89c9d8e7f0 ABI handling: Implement coercion for argument types (in addition to
return types).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 19:12:28 +00:00
Daniel Dunbar 6bad2658b4 Change ABIInfo to compute information for a full signature at a time
(the main point of this restructing).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 06:51:18 +00:00
Daniel Dunbar 0bcc52114e Remove ABIArgInfo::Default kind, ABI is now responsible for specifying
acceptable kind with more precise semantics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63617 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 06:30:17 +00:00
Daniel Dunbar 46327aaf03 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63615 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 06:17:37 +00:00
Daniel Dunbar 5251afa21d Add two FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63613 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 06:02:10 +00:00
Daniel Dunbar b225be44aa Always use CGFunctionInfo to access ABI information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 05:59:18 +00:00
Daniel Dunbar 88c2fa96be Move ABIArgInfo into CGFunctionInfo, computed on creation.
- Still have to convert some consumers over.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 05:31:23 +00:00
Daniel Dunbar 9eb5c6d324 Move ABIInfo/ABIArgInfo classes into ABIInfo.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63586 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 01:05:53 +00:00
Daniel Dunbar 40a6be686e Memoize CGFunctionInfo construction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63576 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 00:07:12 +00:00
Daniel Dunbar a0a99e02f5 Change CGFunctionInfo args iterator to not include the return type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63571 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 23:43:58 +00:00
Daniel Dunbar 541b63b1a9 Thread CGFunctionInfo construction through CodeGenTypes.
- Inefficient & leaks memory currently, will be cleaned up subsequently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 23:23:47 +00:00
Daniel Dunbar 88b5396b08 More ABI API cleanup.
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
   EmitFunction{Epi,Pro}log.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 22:03:45 +00:00
Daniel Dunbar bb36d331f4 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 21:43:58 +00:00
Daniel Dunbar 275e10d62a Shuffle some functions around, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63538 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 19:06:38 +00:00
Daniel Dunbar 9a82b52ae8 Add FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63531 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 18:06:39 +00:00
Daniel Dunbar 36b5f5ee02 Remove unused overload of GetFunctionType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63472 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 03:05:44 +00:00
Daniel Dunbar 6f6b0367ba Initialize CGFunctionInfo isVariadic bit correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 02:54:56 +00:00
Daniel Dunbar 21a4f62fa4 Err, unbreak my previous "no functionality change commit", will fix properly later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 02:20:43 +00:00
Daniel Dunbar 725ad31086 Kill off CGCallInfo, always use CGFunctionInfo for encapsulating
function/call info.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63466 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 02:19:00 +00:00
Daniel Dunbar c450357c43 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 00:06:58 +00:00
Daniel Dunbar cdf920ed6c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 22:40:15 +00:00
Daniel Dunbar 71e62a9281 x86_64 ABI: Fix thinko in prev commit, 64-bit vectors should have SSE
class, not integer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 21:50:20 +00:00
Daniel Dunbar d4cd1b0716 x86_64 ABI: Pass <1 x double> in memory. This is arguably wrong, but
matches gcc 4.2 (not llvm-gcc).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 19:38:39 +00:00
Daniel Dunbar 11a76ed8e3 Remove testing -use-x86_64-abi option; current implementation is
robust enough for general use.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 18:47:53 +00:00
Daniel Dunbar e33edf150a x86_64 ABI: Split small vectors which cross an eightbyte boundary. Down to 33/500 return type failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63404 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 18:40:10 +00:00
Daniel Dunbar 8562ae74ae 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%).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 08:09:32 +00:00
Daniel Dunbar e620ecdd41 Use uint64_t not unsigned for type sizes/offsets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 00:47:38 +00:00
Daniel Dunbar f04d69bbb2 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). :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63305 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 09:42:07 +00:00
Daniel Dunbar 7f102f8c81 x86_64 ABI: Tweak merging algorithm so that we always bail early when
we see a Memory classification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 08:35:40 +00:00
Daniel Dunbar cc039fea2e ABI: When emitting calls which return an ignored argument, make sure
to still return an RValue of the correct type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 08:24:57 +00:00
Daniel Dunbar 99037e5a21 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 08:13:58 +00:00
Daniel Dunbar b0e14f2a87 x86_64: Support cases which map to returning multiple values in LLVM
(e.g., _Complex double -> { double, double } return).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63285 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 07:36:07 +00:00
Daniel Dunbar eac48dc189 x86_64 ABI: Classify _Complex ints as integer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29 07:22:20 +00:00
Daniel Dunbar 7a6605d8be x86_64: Classify __m64 and __m128 "correctly".
- gcc appears to be classifying <1 x double> as INTEGER which is
   odd. Will investigate later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 02:01:34 +00:00
Daniel Dunbar 54d1ccbfcf Implement support for coercion to wider types during ABI handling.
- Code quality is poor, but simple.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63083 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 01:36:03 +00:00
Daniel Dunbar 11434925bf Add Ignore ABIArgInfo kind, for handling void & empty structures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63039 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 21:26:08 +00:00
Daniel Dunbar 6f3e7fac42 Start filling in x86_64 ABI implementation.
- No functionality change, moved behind -use-x86_64-abi option until
   it becomes non-experimental.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-24 08:32:22 +00:00
Daniel Dunbar d4edfe4746 Add dummy X86_64 ABIInfo implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 18:18:40 +00:00
Douglas Gregor f8d49f64ef 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61994 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 17:18:27 +00:00
Daniel Dunbar 3aea8cac3e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61192 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 04:52:14 +00:00
Anders Carlsson ad3d6917da Handle returning complex types that get coerced. Fixes PR3131
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 22:21:48 +00:00
Chris Lattner 39f34e97d6 Migrate some stuff from NamedDecl::getName() to
NamedDecl::getNameAsString() to make it more explicit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:00:27 +00:00
Anders Carlsson 1385f8e826 Fix silly bug spotted by Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 06:35:36 +00:00
Anders Carlsson 0b685a5e4a Handle complex return values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 01:29:05 +00:00
Daniel Dunbar 6b1da0ea19 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57445 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-13 17:02:26 +00:00
Anders Carlsson 232eb7d33b Implement support for the const and pure attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 23:32:53 +00:00
Devang Patel a2c6912c41 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:53:57 +00:00
Devang Patel 761d7f78e2 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:02:23 +00:00
Devang Patel 0fb1d15c37 Adjust whitespaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 01:03:00 +00:00
Devang Patel d0646bd7c1 s/ParamAttrsWithIndex/FnAttributeWithIndex/g
Rename to match changes done on llvm side.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 01:01:36 +00:00
Daniel Dunbar 834af45658 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56293 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 21:22:33 +00:00
Daniel Dunbar f035738e34 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 20:11:04 +00:00
Daniel Dunbar 5627377df5 Add support for ABIArgInfo::Expand
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 00:51:38 +00:00
Daniel Dunbar 8951dbd225 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 01:48:57 +00:00
Daniel Dunbar 6660c8a4cc 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:04:36 +00:00
Daniel Dunbar 639ffe4709 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 07:04:09 +00:00
Daniel Dunbar 62d5c1b503 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 07:00:50 +00:00
Daniel Dunbar 45c25ba11c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 04:01:49 +00:00
Daniel Dunbar 2c8e0f32b9 Add ABIArgInfo class to encapsulate ABI decision of how to lower types
to LLVM.
 - Will move to target sometime soon.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:41:04 +00:00
Daniel Dunbar b768807c49 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 00:41:16 +00:00
Daniel Dunbar 5323a4b0a1 Tweak CGCall functions:
- Move actual param attr list creation to
   CodeGenFunction::ConstructParamAttrList.
 - Make ReturnTypeUsesSret static.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 00:32:18 +00:00
Daniel Dunbar 3913f184c8 Add CodeGenFunction::ReturnTypeUsesSret
- Hook so NeXT runtime doesn't depend on ABI.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:48:28 +00:00
Daniel Dunbar 17b708d618 Move ABI specific code for functions / calls to CGCall.cpp:
- Factor out EmitFunction{Pro,Epi}log


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:27:19 +00:00
Daniel Dunbar 46f45b9bec 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 01:06:48 +00:00
Daniel Dunbar 0dbe227fec 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 21:33:45 +00:00