Commit Graph

181 Commits

Author SHA1 Message Date
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