summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r177329.Rafael Espindola2013-03-191-2/+1
| | | | | | | | | If this should not happen, we should have an assert. If it should happen, we should have a test and remove the comment. In no case should we have this self inconsistent code. llvm-svn: 177399
* This code works around what appears to be a bug in another part of clang.Reed Kotler2013-03-181-1/+2
| | | | | | | | | | | | I have filed http://llvm.org/bugs/show_bug.cgi?id=15538 against clang. This code is safer anyway because "cast" assumes you really know that it's okay to make the cast. In this case isa should not be false and dyn_cast should not return null as far as I understand. But everything else is valid so I did not want to revert my previous patch for attributes mips16/nomips16 or use an llvm_unreachable here which would make a number of our tests fail for mips. llvm-svn: 177329
* Cause the mips16/nomips16 attribute to be passed to LLVM from ClangReed Kotler2013-03-131-4/+10
| | | | | | in the LLVM assembly language output. llvm-svn: 176971
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-1/+1
| | | | | | | | | | | | | | | aggregate types in a profoundly wrong way that has to be worked around in every call site, to getEvaluationKind, which classifies and distinguishes between all of these cases. Also, normalize the API for loading and storing complexes. I'm working on a larger patch and wanted to pull these changes out, but it would have be annoying to detangle them from each other. llvm-svn: 176656
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-28/+46
| | | | | | | | | | | | | | | | | | | | | | calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286
* Add support for AArch64 target.Tim Northover2013-01-311-0/+418
| | | | | | | | | | | | | In cooperation with the LLVM patch, this should implement all scalar front-end parts of the C and C++ ABIs for AArch64. This patch excludes the NEON support also reviewed due to an outbreak of batshit insanity in our legal department. That will be committed soon bringing the changes to precisely what has been approved. Further reviews would be gratefully received. llvm-svn: 174055
* [mips] Do not emit i32 padding if target ABI is O32. This was causing backendAkira Hatanaka2013-01-241-1/+2
| | | | | | to pass floating point arguments to be passed in integer registers. llvm-svn: 173375
* Use the AttributeSet when adding multiple attributes and an Attribute::AttrKindBill Wendling2013-01-231-2/+4
| | | | | | when adding a single attribute to the function. llvm-svn: 173211
* First step in implementation of mips16 and nomips16 attributes.Reed Kotler2013-01-161-0/+7
| | | | | | Waiting for new llvm attribute code for the next step. llvm-svn: 172626
* This patch addresses varargs processing for small complex types underBill Schmidt2013-01-141-1/+39
| | | | | | | | | | | | | | | | | | | the 64-bit PowerPC ELF ABI. The ABI requires that the real and imaginary parts of a complex argument each occupy their own doubleword. Arguments smaller than 8 bytes are right-adjusted within the doubleword. Clang expects EmitVAARG() to return a pointer to a structure in which the real and imaginary parts are packed adjacently in memory. To accomplish this, we generate code to load the code appropriately from the varargs location and pack the values into a temporary variable in the form Clang expects, returning a pointer to that structure. The test case demonstrates correct code generation for all "small" complex types on PPC64: int, short, char, and float. llvm-svn: 172438
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-2/+2
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* Rename llvm::Attributes to llvm::Attribute.Bill Wendling2012-12-201-5/+5
| | | | llvm-svn: 170722
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-5/+5
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-5/+5
| | | | | | single attribute in the future. llvm-svn: 170500
* This patch fixes PR13624, which notes a 64-bit PowerPC ELF ABIBill Schmidt2012-12-171-0/+3
| | | | | | | | | | incompatibility with how complex values are returned. It is sufficient to flag all complex types as direct rather than indirect. A new test case is provided that checks correct IR generation for the various supported flavors of _Complex. llvm-svn: 170302
* s/AttrListPtr/AttributeSet/g to better label what this class is going to be ↵Bill Wendling2012-12-071-1/+1
| | | | | | in the near future. llvm-svn: 169652
* Adapt to LLVM commit 169291 which streamlines the usage of NaCl/NativeClientEli Bendersky2012-12-041-4/+4
| | | | | | in the triple. llvm-svn: 169292
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fix a small calling-convention bug for x86-32. PR14453.Eli Friedman2012-11-291-2/+8
| | | | llvm-svn: 168959
* This patch addresses an incompatibility relative to the 64-bit PowerPCBill Schmidt2012-11-271-0/+3
| | | | | | | | | | | | | | | ELF ABI. Complex values are to be passed in registers as though the real and imaginary parts were passed as separate parameters. Prior to this patch, complex values were passed as byval aggregates. It turns out that specifying getDirect() for all complex types when classifying the argument type results in the desired behavior. The new Clang test case verifies that the correct LLVM IR is generated for caller and callee for each of the underlying types for _Complex. llvm-svn: 168673
* MSPGCC renamed ISR vectors from vector_<address> to __isr_<number>. This ↵Anton Korobeynikov2012-11-261-2/+2
| | | | | | | | patch makes Clang reflect this scheme. Patch by Job Noorman! llvm-svn: 168598
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-161-1/+1
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* Cleanup: 80-column violationManman Ren2012-11-061-4/+6
| | | | llvm-svn: 167476
* ARM byval: when type alignment is bigger than ABI alignment, instead ofManman Ren2012-11-061-5/+4
| | | | | | | | | | | | disabling byval, we set realign to true. It will perform an aligned alloca, and call memcpy to copy the byval argument to the local variable. Change the size threshold back to 64 bytes. rdar://12596507 llvm-svn: 167440
* ARM byval: when type alignment is bigger than ABI alignment, we can't guaranteeManman Ren2012-11-051-2/+10
| | | | | | | | | | | the type alignment of the byval argument. This patch will disable byval in this case, it also increases the size threshold for turning on byval. A backend fix will be attempted. rdar://12596507 llvm-svn: 167416
* On PowerPC64, integer arguments and return values need to be sign- orUlrich Weigand2012-11-051-0/+58
| | | | | | | | | | | | | | | | zero-extended to 64 bits. This information is currently provided to the back end by setting "signext" or "zeroext" attributes. However, this is done only for integer types *smaller* than i32, not for i32 itself. This causes clang to generate code violating the ABI, which results in a failure of the tramp3d-v4 test case (due to calling a system library routine without ABI-required extension). This patch implements custom versions of classifyArgumentType and classifyReturnType for PPC64_SVR4_ABIInfo, which are the same as the default versions except that they also classify "int" and "unsigned int" as types needing extending. This fixed tramp3d-v4 on PowerPC64. llvm-svn: 167393
* ARM AAPCS-VFP: fix tracking of allocated VFP registers.Manman Ren2012-10-311-24/+50
| | | | | | | According to the spec, we can backfill VFP registers that were skipped due to alignment constraints. llvm-svn: 167159
* ARM AAPCS-VFP: fix handling of homogeneous aggreate.Manman Ren2012-10-301-6/+80
| | | | | | | If HA can only partially fit into VFP registers, we add padding to make sure HA will be on stack and later VFP CPRCs will be on stack as well. llvm-svn: 167058
* This patch addresses a 64-bit PowerPC ELF ABI compatibility issue withBill Schmidt2012-10-261-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | varargs parameter passing. A strict reading of the ABI indicates that any argument with alignment greater than 8 may require skipping doublewords in the parameter save area to align the argument, and hence require skipping GPRs. In practice, this is not done by GCC. The alignment restriction is used for internal alignment of a structure, but a structure with 16-byte alignment, for example, is not itself 16-byte aligned in the parameter save area. Although this is messy, it has become the de facto standard used in building existing libraries. My initial varargs support followed the ABI language, but not the de facto standard. Running the GCC compatibility test suite exposed this issue, and indeed showed that LLVM didn't pass parameters self-consistently with my original logic. Removing the additional alignment logic allows the affected tests to now pass. I modified the ppc64-varargs-struct.c test case to remove the existing test for generation of alignment code, which is no longer appropriate. Built and tested on powerpc64-unknown-linux-gnu with no new regressions. llvm-svn: 166805
* Modify the targets to set appropriate calling convention defaults and C ↵David Tweed2012-10-251-3/+5
| | | | | | | | variables when using a gnueabihf or aapcs-vfp target. Tested by me and Wei-Ren Chen. llvm-svn: 166679
* Add padding inreg registers to cause llvm to skip ecx when needed withRafael Espindola2012-10-241-7/+14
| | | | | | the x86_fastcallcc calling convention. llvm-svn: 166538
* Add inreg markers with the x86_fastcallcc calling convention.Rafael Espindola2012-10-241-10/+39
| | | | llvm-svn: 166537
* Don't try to use inreg with 0 sized structs. Thanks to Eli for reporting theRafael Espindola2012-10-231-0/+4
| | | | | | regression. llvm-svn: 166461
* Move private classes into anonymous namespaces.Benjamin Kramer2012-10-201-0/+8
| | | | llvm-svn: 166377
* Fix handling of the regparm attribute in the presence of classes with copyRafael Espindola2012-10-191-41/+44
| | | | | | | | | | | | | constructors. When I first moved regparm support to TargetInfo.cpp I tried to isolate it in classifyArgumentTypeWithReg, but it is actually a lot easier to flip the code around and check for regparm at the end of the decision tree. Without this refactoring classifyArgumentTypeWithReg would have to duplicate the logic about when to use non-byval indirect arguments. llvm-svn: 166266
* Add pnaclcall convention to Native Client targets.Derek Schuff2012-10-161-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 166065
* ARM ABI: fix ABI alignment issues in varargs.Manman Ren2012-10-161-9/+6
| | | | | | | | We generalize r166040 to handle ABI alignment issues for all types. rdar://12439123 llvm-svn: 166052
* ARM ABI: passing illegal vector types as varargs.Manman Ren2012-10-161-2/+48
| | | | | | | | | | | | | | 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 llvm-svn: 166043
* ARM ABI: fix ABI alignment issues when passing legal vector types as varargs.Manman Ren2012-10-161-6/+38
| | | | | | | | | | 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 llvm-svn: 166040
* Move the Attributes::Builder outside of the Attributes class and into its ↵Bill Wendling2012-10-151-1/+1
| | | | | | own class named AttrBuilder. No functionality change. llvm-svn: 165961
* Use enum values instead of magic numbers for indexing into the attribute list.Bill Wendling2012-10-151-1/+2
| | | | llvm-svn: 165925
* Attributes RewriteBill Wendling2012-10-151-1/+1
| | | | | | | | 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. llvm-svn: 165918
* Use the Builder to create the stack alignment attribute.Bill Wendling2012-10-141-2/+3
| | | | llvm-svn: 165888
* This patch addresses PR13948.Bill Schmidt2012-10-121-7/+25
| | | | | | | | | | | | 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. llvm-svn: 165816
* Fix build failure from r165722Derek Schuff2012-10-111-1/+1
| | | | llvm-svn: 165731
* Properly factor Native Client defines to support NaCl as an OSDerek Schuff2012-10-111-2/+8
| | | | | | with x86/ARM architecture llvm-svn: 165722
* Make X86_64ABIInfo clean for ABIs with 32 bit pointers, such as X32Derek Schuff2012-10-111-6/+14
| | | | | | and Native Client llvm-svn: 165715
* Have 'addFnAttr' take the attribute enum value. Then have it build the ↵Bill Wendling2012-10-101-5/+6
| | | | | | attribute object and add it appropriately. No functionality change. llvm-svn: 165596
* Move TargetData to DataLayout.Micah Villmow2012-10-081-12/+12
| | | | llvm-svn: 165395
* This patch enables general varargs support for the 64-bit PPC SVR4 ABI.Bill Schmidt2012-10-031-4/+102
| | | | | | | | | | | | | | 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. llvm-svn: 165143
OpenPOWER on IntegriCloud