aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
AgeCommit message (Collapse)Author
2012-10-16Add pnaclcall convention to Native Client targets.Derek Schuff
Because PNaCl bitcode must be target-independent, it uses some different bitcode representations from other targets (e.g. byval and sret for structures). This means that without additional type information, it cannot meet some native ABI requirements for some targets (e.g. passing structures containing unions by value on x86-64). To allow generation of code which uses the correct native ABIs, we also support triples such as x86_64-nacl, which uses target-dependent IR (as opposed to le32-nacl, which uses byval and sret). To allow interoperation between the two types of code, this patch adds a calling convention attribute to be used in code compiled with the target-dependent triple, which will generate code using the le32-style bitcode. This calling convention does not need to be explicitly supported in the backend because it determines bitcode representation rather than native conventions (the backend just needs to undersand how to handle byval and sret for the Native Client OS). This patch implements __attribute__((pnaclcall)) to generate calls in bitcode according to the le32 bitcode conventions, an attribute which is accepted by any Native Client target, but issues a warning otherwise. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166065 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16ARM ABI: fix ABI alignment issues in varargs.Manman Ren
We generalize r166040 to handle ABI alignment issues for all types. rdar://12439123 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166052 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16ARM ABI: passing illegal vector types as varargs.Manman Ren
We expand varargs in clang and the call site is handled in the back end, it is hard to match exactly how illegal vectors are handled in the backend. Therefore, we legalize the illegal vector types in clang: if (Size <= 32), legalize to i32. if (Size == 64), legalize to v2i32. if (Size == 128), legalize to v4i32. if (Size > 128), use indirect. rdar://12439123 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166043 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-16ARM ABI: fix ABI alignment issues when passing legal vector types as varargs.Manman Ren
We create an aligned temporary space and copy the content over from ap.cur to the temporary space. This is necessary if the natural alignment of the type is greater than the ABI alignment. rdar://12439123 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166040 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling
own class named AttrBuilder. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165961 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15Use enum values instead of magic numbers for indexing into the attribute list.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165925 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15Attributes RewriteBill Wendling
Convert the uses of the Attributes class over to the new format. The Attributes::get method call now takes an LLVM context so that the attributes object can be uniquified and stored. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-14Use the Builder to create the stack alignment attribute.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-12This patch addresses PR13948.Bill Schmidt
For 64-bit PowerPC SVR4, an aggregate containing only one floating-point field (float, double, or long double) must be passed in a register as though just that field were present. This patch addresses the issue during Clang code generation by specifying in the ABIArgInfo for the argument that the underlying type is passed directly in a register. The included test case verifies flat and nested structs for the three data types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165816 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Fix build failure from r165722Derek Schuff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Properly factor Native Client defines to support NaCl as an OSDerek Schuff
with x86/ARM architecture git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165722 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Make X86_64ABIInfo clean for ABIs with 32 bit pointers, such as X32Derek Schuff
and Native Client git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165715 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10Have 'addFnAttr' take the attribute enum value. Then have it build the ↵Bill Wendling
attribute object and add it appropriately. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165596 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-08Move TargetData to DataLayout.Micah Villmow
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03This patch enables general varargs support for the 64-bit PPC SVR4 ABI.Bill Schmidt
Most of the pieces for this were already in place, but a proper EmitVAArg is needed for aggregates and complex numbers to be handled. Although the va_list for 64-bit PowerPC SVR4 consists of GPRs 3 through 10 together with the overflow portion of the parameter save area, we can treat va_list as pointing to contiguous memory for all parameters, since the back end forces the parameter GPRs to memory for varargs functions. There is no need at this time to model parameters and return values beyond what the DefaultABIInfo provides. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165143 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-27Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru
See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-27Fix a typo 'iff' => 'if'Sylvestre Ledru
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21Update for encapsulating the "construct*AlignmentFromInt" methods.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06Use custom ABIInfo for le32/PNaCl argument codegenDerek Schuff
This patch uses a new ABIInfo implementation specific to the le32 target, rather than falling back to DefaultABIInfo. Its behavior is basically the same, but it also allows the regparm argument attribute. It also includes basic tests for argument codegen and attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163333 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-02Rename ANDROIDEABI to Android.Logan Chien
Most of the code guarded with ANDROIDEABI are not ARM-specific, and having no relation with arm-eabi. Thus, it will be more natural to call this environment "Android" instead of "ANDROIDEABI". Note: We are not using ANDROID because several projects are using "-DANDROID" as the conditional compilation flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163088 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13ARM: enable struct byval for AAPCS-VFP.Manman Ren
rdar://9877866 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161790 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10Add comments for turning on byvalManman Ren
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161702 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10ARM: enable struct byval for AAPCS.Manman Ren
rdar://9877866 PR://13350 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161694 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-09Fix AAPCS ABI. I can't actually test this, but it restores the behavior ↵Eli Friedman
from before r159168. PR13562. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161554 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08clang support for Bitrig (an OpenBSD fork); patch by David Hill.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31Handle functions with struct arguments or return types and the regparmRafael Espindola
attribute. It is a variation of the x86_64 ABI: * A struct returned indirectly uses the first register argument to pass the pointer. * Floats, Doubles and structs containing only one of them are not passed in registers. * Other structs are split into registers if they fit on the remaining ones. Otherwise they are passed in memory. * When a struct doesn't fit it still consumes the registers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161022 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-24move X86_32ABIInfo::computeInfo out of line.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23Make classifyReturnType and classifyArgumentType private.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20Add "long double" to permitted list of ARM complex homogeneous aggregates.Tim Northover
Under AAPCS, long double is the same as double, which means it should be allowed as part of a homogeneous aggregate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160586 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-04Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer
instead. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159719 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03Make the following changes in the way Mips handles vector arguments and returnAkira Hatanaka
values: - Return integer vectors in integer registers. - Pass vector arguments in integer registers. - Set an upper bound for argument alignment. The largest alignment is 8-byte for O32 and 16-byte for N32/64. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159676 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-25ARM: enable struct byval for APCS.Manman Ren
Revert r136662 which disables ARM byval. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159168 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-06Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie
value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-05Fix a bug with va_arg and vectors on Darwin x86-32. <rdar://problem/11592208>.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158017 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24Replace PTX back-end with NVPTX back-end in all places where Clang caresJustin Holewinski
NV_CONTRIB git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157403 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-20Teach Clang about the NVPTX backend.Peter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157173 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-11Coerce byval aggregate arguments to integers whose size matches the integerAkira Hatanaka
register size of the target architecture. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156650 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-11Fix handling of vector return types.Akira Hatanaka
A vector should be returned via the hidden pointer argument except if its size is equal to or smaller than 16-bytes and the target ABI is N32 or N64. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156642 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-09Implement PPC64TargetCodeGenInfo.Roman Divacky
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156491 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie
filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13Step forward with supporting of ARM homogenous aggregates:Anton Korobeynikov
- Handle unions - Handle C++ classes git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154664 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-11Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie
(Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.Daniel Dunbar
- We do this when it is easy to determine that the backend will pass them on the stack properly by itself. Currently LLVM codegen is really bad in some cases with byval, for example, on the test case here (which is derived from Sema code, which likes to pass SourceLocations around):: struct s47 { unsigned a; }; void f47(int,int,int,int,int,int,struct s47); void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); } we used to emit code like this:: ... movl %esi, -8(%rbp) movl -8(%rbp), %ecx movl %ecx, (%rsp) ... to handle moving the struct onto the stack, which is just appalling. Now we generate:: movl %esi, (%rsp) which seems better, no? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152462 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-22Adding support for Microsoft's thiscall calling convention. Clang side of ↵Aaron Ballman
the patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151122 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17Whether an argument is required (in contrast with being anJohn McCall
optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09Class objects passed by value follow the same rules as structure objects.Akira Hatanaka
Double fields of by-value class objects should be passed in floating point registers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150200 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-09Fix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returningAkira Hatanaka
class objects follow the same rules as those returning struct objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150196 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08Do not return records with non trivial destructors or copy constructors inAkira Hatanaka
registers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150035 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-07simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner
CodeGenModule. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-25Add some ABI tweaks for i386-pc-win32 triple so that we return structs in an ↵Eli Friedman
MSVC-compatible way. Patch by Joe Groff. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148992 91177308-0d34-0410-b5e6-96231b3b80d8