summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* DebugInfo: Use enum instead of unsignedEd Maste2014-05-072-11/+13
| | | | | | | | This makes debuging DebugInfo generation with LLDB a little more pleasant. Differential Revision: http://reviews.llvm.org/D3626 llvm-svn: 208203
* ARM: Fix assertion caused by passing bitfield struct using ↵Oliver Stannard2014-05-071-1/+2
| | | | | | | | | | | | ABIArgInfo::getExpandWithPadding In cases where a struct must, according to the AAPCS, not be split between general purpose and floating point registers, we use ABIArgInfo::getExpandWithPadding to add the padding arguments. However, ExpandWithPadding does not work if the struct contains bitfields, so we instead must use ABIArgInfo::getDirect. llvm-svn: 208185
* [OPENMP] Fixed problem with temp removal on some platforms in codegen for ↵Alexey Bataev2014-05-072-10/+7
| | | | | | '#pragma omp parallel' llvm-svn: 208162
* PR19562: Fix memory leak when ObjC interface types cause the creation of ↵David Blaikie2014-05-071-1/+5
| | | | | | further interfaces. llvm-svn: 208161
* Include translation unit filename in global ctor symbol names.Nico Weber2014-05-061-3/+16
| | | | | | | | | | | | | | | | | This makes it easier to see where a global ctor comes from, and it also makes ASan's init order analyzer output easier to understand. gcc does this too, but only in -fPIC mode for some reason. Don't do this for constructors with explicit init priority. Also prepend "sub_" before the 'I', that way regular constructors stay lexicographically after symbols with init priority (because ord('s') > ord('I')). gold seems to ignore the name of constructor symbols, and ld only looks at the symbol if it includes an init priority, which this patch doesn't change. Before: __GLOBAL_I_a Now: __GLOBAL_sub_I_myfile.cc llvm-svn: 208128
* Reapply: DebugInfo: Emit the definition of enums when the definition ↵David Blaikie2014-05-063-0/+35
| | | | | | | | | | | | | | | | | | | preceeds the declaration and initial use. Reverting r208106 to reapply r208065 with a fix for the regression. The issue was that the enum tried to be built even if the declaration hadn't been constructed for debug info - presenting problems for enum templates and typedefs of enums with names for linkage purposes. Original commit message: This regressed a little further 208055 though it was already a little broken. While the requiresCompleteType optimization should be implemented here. Future (possibly near future) work. llvm-svn: 208114
* Revert "DebugInfo: Emit the definition of enums when the definition preceeds ↵David Blaikie2014-05-063-35/+0
| | | | | | | | | | | the declaration and initial use." This is breaking the compiler-rt build. Reverting while I investigate/fix. This reverts commit r208065. llvm-svn: 208106
* [OPENMP] Initial codegen for '#pragma omp parallel'Alexey Bataev2014-05-0610-5/+457
| | | | llvm-svn: 208077
* XCore target: fix initialization bug found by MSan Bot.Robert Lytton2014-05-061-0/+1
| | | | llvm-svn: 208072
* DebugInfo: Emit the definition of enums when the definition preceeds the ↵David Blaikie2014-05-063-0/+35
| | | | | | | | | | | | declaration and initial use. This regressed a little further 208055 though it was already a little broken. While the requiresCompleteType optimization should be implemented here. Future (possibly near future) work. llvm-svn: 208065
* PR19598: Ensure temporary metadata nodes used in debug info are destroyed.David Blaikie2014-05-062-40/+34
| | | | | | | | | | | | | | | | | | | CGDebugInfo and DIBuilder were lax in their handling of temporary MDNodes. All temporary nodes need to be deleted, which means they need to be RAUW'd with a permanent node. This was not happening. To ensure this, leverage DIBuilder's new ability to create both permanent and temporary declarations. Ensure all temporary declarations are RAUW'd, even with itself. (DIDescriptor::RAUW handles the case where it is replaced with itself and creates a new, duplicate permanent node to replace itself with) This means that all temporary declarations must be added to the ReplacementMap even if they're never upgraded to definitions - so move the point of insertion into the map to the point of creation of the declarations. llvm-svn: 208055
* Build debug info for ObjC interface types at the end of the translation unit ↵David Blaikie2014-05-052-107/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | to ensure all ivars are included. This takes a different approach than the completedType/requiresCompleteType work which relies on AST callbacks to upgrade the type declaration to a definition. Instead, just defer constructing the definition to the end of the translation unit. This works because the definition is never needed by other debug info (so far as I know), whereas the definition of a struct may be needed by other debug info before the end of the translation unit (such as emitting the definition of a member function which must refer to that member function's declaration). If we had a callback for whenever an IVar was added to an ObjC interface we could use that, and remove the need for the ObjCInterfaceCache, which might be nice. (also would need a callback for when it was more than just a declaration so we could get properties, etc). A side benefit is that we also don't need the CompletedTypeCache anymore. Just rely on the declaration-ness of a type to decide whether its definition is yet to be emitted. There's still the PR19562 memory leak, but this should hopefully make that a bit easier to approach. llvm-svn: 208015
* Simplify replacement map by avoiding duplicate values and ensuring the ↵David Blaikie2014-05-051-15/+9
| | | | | | | | | | | | | values it does contain are necessary. Items were being redundantly added to the replacement map (both when the declaration was created, and then again when its definition was constructed) which caused extra handling to be required when walking the map (as elements may've already been replaced due to prior entries). By avoiding adding the duplicates, the checks in the replacement handling can be replaced with assertions. llvm-svn: 208000
* MS ABI: Emit an error during IRgen on C++ exception handlingReid Kleckner2014-05-051-0/+10
| | | | | | | | | | | | | | | | Currently, users get error messages about RTTI descriptor mangling with no useful source location. This addresses that. Another approach would be to disable C++ exceptions by default in the driver when using the Microsoft C++ ABI. However, this makes it impossible to parse system headers that use exception handling constructs. By delaying the error to IRgen, we can figure out if we actually need to emit code for this construct. Additionally, users who are only interested in building refactoring tools on Windows still get a correct AST without having to add flags. Finally, this is consistent with what we do for SEH. llvm-svn: 207999
* Fix pr19653.Rafael Espindola2014-05-052-11/+25
| | | | | | Warn if an alias requests a section other than the aliasee section. llvm-svn: 207997
* Small refactoring, no functionality change.Rafael Espindola2014-05-051-3/+4
| | | | llvm-svn: 207991
* CodeGen: Assign linkage to thread-wrappers correctlyDavid Majnemer2014-05-051-2/+3
| | | | | | | | | | We would sometimes incorrectly give a thread-wrapper external linkage instead of internal linkage if we had only CodeGen'd it's declaration, not it's definition. This fixes PR19655. llvm-svn: 207988
* CodeGen: Cleanup visibility in RTTIBuilderDuncan P. N. Exon Smith2014-05-051-9/+5
| | | | | | No functionality change. llvm-svn: 207978
* CodeGen: complete ARM ACLE hint 8.4 supportSaleem Abdulrasool2014-05-041-5/+20
| | | | | | | Add support for the remaining hints from the ACLE. Although __dbg is listed as a hint, it is handled different, so it is not covered by this change. llvm-svn: 207930
* [leaks] Re-shuffle code such that we don't create a basic block forChandler Carruth2014-05-031-9/+11
| | | | | | | | | | initializing an array unless we need it. Specifically, position the creation of a new basic block after we've checked all of the cases that bypass the need for it. Fixes another leak in test/CodeGen* found by LSan. llvm-svn: 207900
* MS ABI x64: Pass small objects with dtors but no copy ctors directlyReid Kleckner2014-05-032-16/+38
| | | | | | | | | | | | | | | Passing objects directly (in registers or memory) creates a second copy of the object in the callee. The callee always destroys its copy, but we also have to destroy any temporary created in the caller. In other words, copy elision of these kinds of objects is impossible. Objects larger than 8 bytes with non-trivial dtors and trivial copy ctors are still passed indirectly, and we can still elide copies of them. Fixes PR19640. llvm-svn: 207889
* [leaks] Fix a leak of a basic block when we successfully fold a switchChandler Carruth2014-05-031-7/+10
| | | | | | | | | | | condition to a constant and emit only the relevant statement. In that case, we were previously creating the epilog jump destination, a cleanup scope, and emitting any condition variable into it. Instead, we can emit the condition variable (if we have one) into the cleanup scope used for the entire folded case sequence. We avoid creating a jump dest, a basic block, and an extra cleanup scope. Win! llvm-svn: 207888
* Small formatting change.Eric Christopher2014-05-021-1/+1
| | | | llvm-svn: 207852
* XCore target: fix bug in dereferencing null pointer.Robert Lytton2014-05-021-6/+7
| | | | | | Also add basic cpp ABI tests where they differ from C ABI output. llvm-svn: 207834
* XCore target: Add TypeString meta data to IR output.Robert Lytton2014-05-023-0/+551
| | | | | | | This includes the addition of the virtual function: TargetCodeGenInfo::EmitTargetMD() llvm-svn: 207832
* CodeGen: rename __builtin_arm_sevl to __sevlSaleem Abdulrasool2014-05-021-5/+5
| | | | | | | ACLE adds the __sevl() extension. Rename the hint from a custom name to the ACLE specified name. llvm-svn: 207829
* Remove unused variable that I missed in my rush to fix the botsReid Kleckner2014-05-021-1/+1
| | | | llvm-svn: 207820
* Win64: Use ConvertType instead of checking the MS inheritanceReid Kleckner2014-05-021-12/+5
| | | | | | | | dependent-type-member-pointer.cpp is failing on a win64 bot because -fms-extensions is not enabled. Use ConvertType rather than relying on the inheritance attributes. It's less code, but probably slower. llvm-svn: 207819
* Win64: Pass member pointers larger than 8 bytes by referenceReid Kleckner2014-05-021-6/+23
| | | | | | | | | | | | | The Win64 ABI docs on MSDN say that arguments bigger than 8 bytes are passed by reference. Prior to this change, we were only applying this logic to RecordType arguments. This affects both the Itanium and Microsoft C++ ABIs. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D3587 llvm-svn: 207817
* MS ABI: Fix logic bug in member pointer null test codeReid Kleckner2014-05-021-1/+1
| | | | | | | | | This code is trying to test if the pointer is *not* null. Therefore we should use 'or' instead of 'and' to combine the results of 'icmp ne'. This logic is consistent with the general member pointer comparison code in EmitMemberPointerComparison. llvm-svn: 207815
* PR19623: Support typedefs (and alias templates) of void.David Blaikie2014-05-011-3/+0
| | | | llvm-svn: 207781
* AST: Mangle reference temporaries reliablyDavid Majnemer2014-05-011-1/+2
| | | | | | | | | | | | | | | Summary: Previously, we would generate a single name for all reference temporaries and allow LLVM to rename them for us. Instead, number the reference temporaries as we build them in Sema. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3554 llvm-svn: 207776
* MS ABI x64: Don't destroy arguments twice on x64Reid Kleckner2014-05-011-4/+11
| | | | | | | | We were destroying them in the callee, and then again in the caller. We should use an EH-only cleanup and disable it at the point of the call for win64, even though we don't use inalloca. llvm-svn: 207733
* [ARM64] Add arm64_be where it was accidentally missed from a bunch of ↵James Molloy2014-04-301-0/+1
| | | | | | | | | if-conditions. I think this is the last commit for ARM64 big endian in clang. This commit makes arm_neon.h compile correctly. llvm-svn: 207624
* Drop non-cfi assembly support from clang.Rafael Espindola2014-04-301-2/+0
| | | | | | | | | | | | | | After this patch clang will ignore -fdwarf2-cfi-asm and -ffno-dwarf2-cfi-asm and always print assembly that uses cfi directives. In llvm, MC itself supports cfi since the end of 2010 (support started in r119972, is reported in the 2.9 release notes). In binutils the support has been around for much longer. It looks like support started to be added in May 2003. It is available in 2.15 (31-Aug-2011, 2.14 is from 12-Jun-2003). llvm-svn: 207602
* CodeGen: Reference temporaries inherit visibilityDavid Majnemer2014-04-291-0/+3
| | | | | | | Reference temporaries inherited many properties from the variable that they correspond to but visibility wasn't one of them. llvm-svn: 207496
* Debug info: Improve line table for functions with cleanups an early exitAdrian Prantl2014-04-291-0/+20
| | | | | | | | | | | | | and no return expr at the end of the function. The "function has only simple returns" check in FinishFunction tests whether the number of simple return exprs equals the number of return exprs, but so far a fallthrough at the end of a function was not counted as a return, which would result in cleanup code being associated with the wrong source line. rdar://problem/16733984. llvm-svn: 207480
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-284-102/+110
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 llvm-svn: 207451
* [ARM64]Fix a bug cannot select UQSHL/SQSHL with constant i64 shift amount.Hao Liu2014-04-281-10/+6
| | | | llvm-svn: 207401
* CodeGen: remove an unused variableSaleem Abdulrasool2014-04-281-3/+0
| | | | llvm-svn: 207390
* remove useless codeSylvestre Ledru2014-04-271-1/+0
| | | | llvm-svn: 207360
* Fixed Assert In CGRecordLoweringWarren Hunt2014-04-251-6/+23
| | | | | | | | | | | Prior to this patch, CGRecordLower assumed that virtual bases could not be placed before the nvsize of an object. This isn't true in Itanium mode, virtual bases are placed at dsize rather than vnsize and in the case of zero sized non-virtual bases nvsize can be larger than dsize. This patch fixes CGRecordLowering to avoid an assert and to clip bitfields properly in this case. A test case is included. llvm-svn: 207280
* CodeGen: add __yield intrinsic for ARMSaleem Abdulrasool2014-04-251-0/+5
| | | | | | | | | The __yield intrinsic generates a hint instruction to indicate that the thread is not performing any useful operations at the moment. This is for compatibility with MSVC, although, the intrinsic is also part of the ACLE, and is enabled globally as a result. llvm-svn: 207275
* CodeGen: replace use of @llvm.arm.sevl with @llvm.arm.hintSaleem Abdulrasool2014-04-251-2/+2
| | | | | | | Use the new generic @llvm.arm.hint hint intrinsic rather than the specialised @llvm.arm.sevl hint instruction. llvm-svn: 207243
* CodeGen: Cleanup variable linkage calculationDavid Majnemer2014-04-251-9/+18
| | | | | | | | | | Almost all linkage calculation for VarDecls occured inside of GetLLVMLinkageVarDefinition except for static data members. Centralize the logic so that it can be more readily reused. No functionality change. llvm-svn: 207241
* CodeGen: Refactor linkage/visibility calculationDavid Majnemer2014-04-251-33/+27
| | | | | | | | | | It turns out that linkage and visibility have rather similar logic for both functions and non-variable globals. Split the calculation out so that both sides may share this code. No functionality change. llvm-svn: 207239
* CodeGen: Avoid instrumenting implicit Decls more effectivelyJustin Bogner2014-04-251-2/+4
| | | | | | | | | | We don't assign counters for implicit Decls, but we were emitting code to increment the (non-existent) counters and adding empty counter lists in the output. This fixes the checks in assignRegionCounters and emitInstrumentationData to do the right thing, and adds an assert for the pathological case of emitting zero counters. llvm-svn: 207203
* MS ABI: Use a different guard variable for each weak globalReid Kleckner2014-04-231-11/+16
| | | | | | | | | | We were using the same guard variable and failing to initialize the second global. Clang is still not MS ABI compatible in this area. Fixing that is PR16959, which will require LLVM changes to @llvm.global_ctors. llvm-svn: 207008
* Objective-C [IRGen]. Fixes a crash in IRGen involving use ofFariborz Jahanian2014-04-231-1/+4
| | | | | | | 'typeof' to extract type of an @encode expression used in an initializer. // rdar://16655340 llvm-svn: 207004
* [ARM64] Add a missed case label for arm64_be, and enable the aarch64-varargs ↵James Molloy2014-04-231-1/+2
| | | | | | | | test for arm64_be. This ensures that r203917 (cpirker "AArch64_be varargs processing for ARM ABI") is ported to ARM64. llvm-svn: 206961
OpenPOWER on IntegriCloud