summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Declutter the emitVirtualObjectDelete interfaceDavid Majnemer2014-11-014-23/+24
| | | | | | No functionality change intended. llvm-svn: 221043
* CodeGen: Virtual dtor thunks shouldn't have this marked as 'returned'David Majnemer2014-11-013-12/+11
| | | | | | | The ARM ABI virtual destructor thunks cannot be marked as 'returned' because they return undef. llvm-svn: 221042
* clang/lib/CodeGen/TargetInfo.cpp: Fix a couple of warnings. ↵NAKAMURA Takumi2014-11-011-2/+2
| | | | | | [-Winconsistent-missing-override] llvm-svn: 221039
* Silence a warning from MSVC "14" by making an enum unsignedReid Kleckner2014-10-312-3/+3
| | | | | | | | | | It says there is a narrowing conversion when we assign it to an unsigned 3 bit bitfield. Also, use unsigned instead of size_t for the Size field of the struct in question. Otherwise they won't run together in MSVC or clang-cl. llvm-svn: 221019
* Implement IRGen for the x86 vectorcall conventionReid Kleckner2014-10-313-28/+143
| | | | | | | | | | | | | | | The most complex aspect of the convention is the handling of homogeneous vector and floating point aggregates. Reuse the homogeneous aggregate classification code that we use on PPC64 and ARM for this. This convention also has a C mangling, and we apparently implement that in both Clang and LLVM. Reviewed By: majnemer Differential Revision: http://reviews.llvm.org/D6063 llvm-svn: 221006
* MS ABI: Properly call global delete when invoking virtual destructorsDavid Majnemer2014-10-318-114/+175
| | | | | | | | | | | | | | | | | | | | Summary: The Itanium ABI approach of using offset-to-top isn't possible with the MS ABI, it doesn't have that kind of information lying around. Instead, we do the following: - Call the virtual deleting destructor with the "don't delete the object flag" set. The virtual deleting destructor will return a pointer to 'this' adjusted to the most derived class. - Call the global delete using the adjusted 'this' pointer. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5996 llvm-svn: 220993
* ignore -mconstructor-aliases when adding field paddings for asanKostya Serebryany2014-10-311-0/+5
| | | | | | | | | | | | | | | | | | Summary: When we are adding field paddings for asan even an empty dtor has to remain in the code, so we ignore -mconstructor-aliases if the paddings are going to be added. Test Plan: added a test Reviewers: rsmith, rnk, rafael Reviewed By: rafael Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6038 llvm-svn: 220986
* Fix ARM HVA classification of classes with non-virtual basesReid Kleckner2014-10-313-148/+162
| | | | | | | | | | | | | | | | Reuse the PPC64 HVA detection algorithm for ARM and AArch64. This is a nice code deduplication, since they are roughly identical. A few virtual method extension points are needed to understand how big an HVA can be and what element types it can have for a given architecture. Also make the record expansion code work in the presence of non-virtual bases. Reviewed By: uweigand, asl Differential Revision: http://reviews.llvm.org/D6045 llvm-svn: 220972
* Remove CastKind typedef from CastExpr since CastKind is in the clang namespace.Craig Topper2014-10-311-2/+2
| | | | llvm-svn: 220955
* Get rid of SanitizerOptions::Disabled global. NFC.Alexey Samsonov2014-10-307-50/+47
| | | | | | | | | SanitizerOptions is not even a POD now, so having global variable of this type, is not nice. Instead, provide a regular constructor and clear() method, and let each CodeGenFunction has its own copy of SanitizerOptions it uses. llvm-svn: 220920
* CodeGen: add __readfsdword builtinSaleem Abdulrasool2014-10-291-0/+8
| | | | | | | | | The Windows NT SDK uses __readfsdword and declares it as a compiler provided builtin (#pragma intrinsic(__readfsword). Because intrin.h is not referenced by winnt.h, it is not possible to provide an out-of-line definition for the intrinsic. Provide a proper compiler builtin definition. llvm-svn: 220859
* Pass aggregates on the stack without splitting in NVPTX.Eli Bendersky2014-10-291-0/+4
| | | | | | | | | | | Following the NVVM IR specifications, arguments of aggregate type should be passed on the stack without splitting (byval). http://reviews.llvm.org/D6020 Patch by Jacques Pienaar. llvm-svn: 220854
* [PowerPC ABI] Bug 21398 - Consider C++ base classes in HA classificationUlrich Weigand2014-10-291-0/+16
| | | | | | | | As discussed in bug 21398, PowerPC ABI code needs to consider C++ base classes when classifying a class as homogeneous aggregate (or not) for ABI purposes. llvm-svn: 220852
* Improved capturing variable-length array types in CapturedStmt.Alexey Bataev2014-10-292-29/+26
| | | | | | | | An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas. This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP. Differential Revision: http://reviews.llvm.org/D5099 llvm-svn: 220850
* Objective-C. revert patch for rdar://17554063.Fariborz Jahanian2014-10-282-17/+4
| | | | llvm-svn: 220812
* Update for LLVM API change.Rafael Espindola2014-10-281-1/+1
| | | | llvm-svn: 220742
* Use the newer/simple API for passing a diagnostic handler to the IR linker.Rafael Espindola2014-10-271-16/+5
| | | | llvm-svn: 220733
* Fix unicode chars into ascii in comment lines.NAKAMURA Takumi2014-10-271-1/+1
| | | | llvm-svn: 220668
* Fix 80-column and other odd formatting.Eric Christopher2014-10-261-427/+388
| | | | llvm-svn: 220659
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-6/+3
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Update for LLVM api change.Rafael Espindola2014-10-251-6/+31
| | | | llvm-svn: 220609
* CodeGen: Don't form weak dllexport aliasesDavid Majnemer2014-10-241-0/+5
| | | | | | | | | | | The MS linker cannot do anything interesting with these, it doesn't make sense to emit them. This fixes PR21373. Differential Revision: http://reviews.llvm.org/D5986 llvm-svn: 220595
* CodeGen: correct materialize temporary aggregates in ARC modeSaleem Abdulrasool2014-10-241-3/+17
| | | | | | | | | | | | | | | | | | Avoid an assertion when materializing a lifetime type aggregate temporary. When performing CodeGen for ObjC++, we could generate a lifetime-only aggregate temporary by using an initializer list (which is effectively an array). We would reach through the temporary expression, fishing out the inner expression. If this expression was a lifetime expression, we would attempt to emit this as a scalar. This would eventually result in an assertion as the emission would eventually assert that the expression being emitted has a scalar evaluation kind. Add a case to handle the aggregate expressions. Use the EmitAggExpr to emit the aggregate expression rather than the EmitScalarInit. Addresses PR21347. llvm-svn: 220590
* CodeGen: trivial conversion to range based loopSaleem Abdulrasool2014-10-241-4/+4
| | | | | | Switch to a range-based for loop. NFC. llvm-svn: 220587
* CodeGen: GLValue exprs in template parameters should have reference typeDavid Majnemer2014-10-241-0/+2
| | | | | | | | This fixes a corner-case where __uuidof as a template argument would result in us trying to emit a GLValue as an RValue. This would lead to a crash down the road. llvm-svn: 220585
* Add frontend support for __vectorcallReid Kleckner2014-10-241-1/+7
| | | | | | | | | | | | | Wire it through everywhere we have support for fastcall, essentially. This allows us to parse the MSVC "14" CTP headers, but we will miscompile them because LLVM doesn't support __vectorcall yet. Reviewed By: Aaron Ballman Differential Revision: http://reviews.llvm.org/D5808 llvm-svn: 220573
* [mips] Mark aggregate arguments passed in registers with the inreg attributeDaniel Sanders2014-10-241-2/+5
| | | | | | | | | | | | | | | | | | | Summary: This allows us to easily identify them in the backend which in turn allows us to handle them correctly for big-endian targets (where they must be shifted into the upper bits of the register). Depends on D5961 Reviewers: atanasyan Reviewed By: atanasyan Subscribers: cfe-commits, theraven Differential Revision: http://reviews.llvm.org/D5962 llvm-svn: 220566
* [mips] Promote all integral/enumeration types to the GPR widthDaniel Sanders2014-10-241-1/+2
| | | | | | | | | | | | | | | | | | Summary: Ensure all integral/enumeration types are appropriately annotated with signext/zeroext. In particular, i32 now has these attributes when using the N32/N64 ABI. This paves the way for accurately representing the way the N32/N64 ABI's promotes integer arguments to i64. Reviewers: atanasyan Reviewed By: atanasyan Subscribers: cfe-commits, theraven Differential Revision: http://reviews.llvm.org/D5961 llvm-svn: 220563
* Add a new -fmerge-functions -cc1 flag that enables function merging.Nick Lewycky2014-10-241-0/+1
| | | | llvm-svn: 220543
* Don't emit strong vtable definitions for imported classes with key functions ↵Hans Wennborg2014-10-231-1/+2
| | | | | | | | | | | | | | | | | | | (PR21355) Clang would previously assert on the following code when targeting MinGW: struct __declspec(dllimport) S { virtual ~S(); }; S::~S() {} Because ~S is a key function and the class is dllimport, we would try to emit a strong definition of the vtable, with dllimport - which is a conflict. We should not emit strong vtable definitions for imported classes. Differential Revision: http://reviews.llvm.org/D5944 llvm-svn: 220532
* DebugInfo: Correctly describe the lexical decl context of static member ↵David Blaikie2014-10-231-2/+9
| | | | | | | | | | | | | | | | | | variable definitions. The previous IR representation used the non-lexical decl context, which placed the definitions in the same scope as the declarations (ie: within the class) - this was hidden by the fact that LLVM currently doesn't respect the context of global variable definitions at all, and always puts them at the top level (as direct children of the compile_unit). Having the correct lexical scope improves source fidelity and simplify backend global variable emission (with changes coming shortly). Doing something similar for non-member global variables would help simplify/cleanup things further (see FIXME in the commit) and provide similar source fidelity benefits to the final debug info. llvm-svn: 220488
* DebugInfo: Omit scopes in -gmlt to reduce metadata size (on disk and in memory)David Blaikie2014-10-221-5/+14
| | | | | | | I haven't done any actual impact analysis of this change as it's a strict improvement, but I'd be curious to know how much it helps. llvm-svn: 220408
* MS ABI: Emit more canonical vbptr stores and loadsReid Kleckner2014-10-221-4/+12
| | | | | | | | This eliminates some i8* GEPs and makes the IR that clang emits a bit more canonical. More work is needed for vftables, but that isn't a clear win so I plan to send it for review. llvm-svn: 220398
* R600: Update for div_fmas intrinsic changeMatt Arsenault2014-10-211-2/+11
| | | | llvm-svn: 220339
* Fixing the MSVC build by removing friendship with CodeGenFunction; NFC.Aaron Ballman2014-10-211-1/+0
| | | | llvm-svn: 220293
* [OPENMP] Codegen for 'private' clause in 'parallel' directive.Alexey Bataev2014-10-213-2/+37
| | | | | | | This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables. Differential Revision: http://reviews.llvm.org/D4752 llvm-svn: 220262
* Lower compound assignment for the missing type llvm::Type::FP128TyID.Jiangning Liu2014-10-211-0/+4
| | | | llvm-svn: 220257
* Fix whitespace introduced in r220221David Blaikie2014-10-201-1/+1
| | | | | | Post commit review feedback from Yaron Keren. llvm-svn: 220229
* PR21312: Fix a regression in non-type template parameters of function type ↵David Blaikie2014-10-201-2/+3
| | | | | | that are static member functions. llvm-svn: 220221
* Fix indentation.David Blaikie2014-10-201-1/+1
| | | | llvm-svn: 220216
* CodeGen: Update for LLVM API changeDavid Majnemer2014-10-201-1/+1
| | | | | | | Callers of DataLayout::RoundUpAlignment should switch to RoundUpToAlignment. llvm-svn: 220188
* CodeGen: ConstStructBuilder must verify packed constraints after paddingDavid Majnemer2014-10-191-14/+30
| | | | | | | | | | | | | | | | | | This reverts commit r220169 which reverted r220153. However, it also contains additional changes: - We may need to add padding *after* we've packed the struct. This occurs when the aligned next field offset is greater than the new field's offset. When this occurs, we make the struct packed. *However*, once packed the next field offset might be less than the new feild's offset. It is in this case that we might further pad the struct. - We would pad structs which were perfectly sized! This behavior is immensely old. This behavior came from blindly subtracting NextFieldOffsetInChars from RecordSize. This doesn't take into account the fact that the struct might have a greater overall alignment than the last field. llvm-svn: 220175
* Revert r220153: "CodeGen: ConstStructBuilder must verify packed constraints ↵Chandler Carruth2014-10-191-10/+9
| | | | | | | | | | after padding" This commit caused two tests in LNT to regress. I'm able to reproduce on any platform and will send reproduction steps to the original commit log. This should restore the LNT bots that have been failing. llvm-svn: 220169
* [complex] Teach the complex math IR gen to emit direct math andChandler Carruth2014-10-191-17/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | a NaN-test prior to the call to the library function. This should automatically make fastmath (including just non-NaNs) able to avoid the expensive libcalls and also open the door to more advanced folding in LLVM based on the rules for complex math. Two important notes to remember: first is that this isn't yet a proper limited range mode, it's still just improving the unlimited range mode. Also, it isn't really perfecet w.r.t. what an unlimited range mode should be doing because it isn't quite handling the flags produced by all the operations in the way desirable for that mode, but then neither is compiler-rt's libcall. When the compiler-rt libcall is improved to carefully manage flags, the code emitted here should be improved correspondingly. And it is still a long-term desirable thing to add a limited range mode to Clang that would be able to use direct math without library calls here. Special thanks to Steve Canon for the careful review on this patch and teaching me about these issues. =D Differential Revision: http://reviews.llvm.org/D5756 llvm-svn: 220167
* CodeGen: ConstStructBuilder must verify packed constraints after paddingDavid Majnemer2014-10-191-9/+10
| | | | | | | | | | | | Before, ConstStructBuilder::AppendBytes would check packed constraints prior to padding being added before the field's offset. However, adding this padding might force our struct to be packed. Because we wouldn't check *after* adding padding, ConstStructBuilder would be in an inconsistent state leading to a crash. This fixes PR21300. llvm-svn: 220153
* PR21305: Typedefs in non-type template parameters in member data pointers.David Blaikie2014-10-181-1/+1
| | | | | | Patch by Stephen Crane! llvm-svn: 220122
* [ASan] Improve blacklisting of global variables.Alexey Samsonov2014-10-174-7/+43
| | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the way we blacklist global variables in ASan. Now the global is excluded from instrumentation (either regular bounds checking, or initialization-order checking) if: 1) Global is explicitly blacklisted by its mangled name. This part is left unchanged. 2) SourceLocation of a global is in blacklisted source file. This changes the old behavior, where instead of looking at the SourceLocation of a variable we simply considered llvm::Module identifier. This was wrong, as identifier may not correspond to the file name, and we incorrectly disabled instrumentation for globals coming from #include'd files. 3) Global is blacklisted by type. Now we build the type of a global variable using Clang machinery (QualType::getAsString()), instead of llvm::StructType::getName(). After this commit, the active users of ASan blacklist files may have to revisit them (this is a backwards-incompatible change). llvm-svn: 220097
* fix -fsanitize-address-field-padding for the cases with virtual base classesKostya Serebryany2014-10-171-3/+1
| | | | | | | | | | | | | | | | Summary: Correctly compute the non-virtual size of a class. Test Plan: Build SPEC 2016 with -fsanitize-address-field-padding Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5848 llvm-svn: 220089
* Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarityDavid Blaikie2014-10-171-9/+6
| | | | | | Code review feedback from Richard Smith on r219900. llvm-svn: 220060
* complex long double support for PowerPCJoerg Sonnenberger2014-10-171-0/+4
| | | | llvm-svn: 220034
OpenPOWER on IntegriCloud