summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Change memcpy/memset/memmove to have dest and source alignments.Pete Cooper2015-11-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | This is a follow on from a similar LLVM commit: r253511. Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html These intrinsics currently have an explicit alignment argument which is required to be a constant integer. It represents the alignment of the source and dest, and so must be the minimum of those. This change allows source and dest to each have their own alignments by using the alignment attribute on their arguments. The alignment argument itself is removed. The only code change to clang is hidden in CGBuilder.h which now passes both dest and source alignment to IRBuilder, instead of taking the minimum of dest and source alignments. Reviewed by Hal Finkel. llvm-svn: 253512
* Update for llvm change.Rafael Espindola2015-11-181-1/+1
| | | | llvm-svn: 253440
* [PGO] Removed unused code. [NFC]Betul Buyukkurt2015-11-181-1/+0
| | | | llvm-svn: 253404
* Correctly handle type mismatches in the __weak copy/move-initializationJohn McCall2015-11-161-2/+12
| | | | | | | | peephole I added in r250916. rdar://23559789 llvm-svn: 253255
* When producing error messages for always_inline functions with theEric Christopher2015-11-161-2/+5
| | | | | | | | | | target attribute, don't include "negative" subtarget features in the list of required features. Builtins are positive by default so don't need this change, but we pull the default list of features from the command line and so need to make sure that we only include features that are turned on for code generation in our error. llvm-svn: 253242
* [CGDebugInfo] Set the size and align for reference typesKeno Fischer2015-11-161-6/+7
| | | | | | | | | | In r253186, I changed the DIBuilder API to now take size and align for reference types as well. This was done in preparation for upcoming changes to the Verifier that will validate that sizes match between DI types and IR values that are declared as having those types. This updates clang to actually pass the information through. llvm-svn: 253190
* Add support for the always_inline + target feature diagnostic to printEric Christopher2015-11-141-6/+11
| | | | | | | out the first missing target feature that's required and reword the diagnostic accordingly. llvm-svn: 253121
* Clarify and elaborate the conditions on which we're checking targetEric Christopher2015-11-141-4/+6
| | | | | | features for calls. llvm-svn: 253117
* Add support for function attribute 'disable_tail_calls'.Akira Hatanaka2015-11-131-1/+5
| | | | | | | | | | | | | | | | | | | | | | The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside the marked function. For example, int callee(int); int foo(int a) __attribute__((disable_tail_calls)) { return callee(a); // This call is not tail-call optimized. } Note that this attribute is different from 'not_tail_called', which prevents tail-call optimization to the marked function. rdar://problem/8973573 Differential Revision: http://reviews.llvm.org/D12547 llvm-svn: 252986
* Correct atomic libcall support for __atomic_*_fetch builtins.James Y Knight2015-11-121-39/+39
| | | | | | | | | | | | | | In r244063, I had caused these builtins to call the same-named library functions, __atomic_*_fetch_SIZE. However, this was incorrect: while those functions are in fact supported by GCC's libatomic, they're not documented by the spec (and gcc doesn't ever call them). Instead, you're /supposed/ to call the __atomic_fetch_* builtins and then redo the operation inline to return the final value. Differential Revision: http://reviews.llvm.org/D14385 llvm-svn: 252920
* [C++] Add the "norecurse" attribute to main() if in C++ modeJames Molloy2015-11-121-0/+8
| | | | | | The C++ spec (3.6.1.3) says "The function `main` shall not be used within a program". This implies that it cannot recurse, so add the norecurse attribute to help the midend out a bit. llvm-svn: 252902
* Refactor out some common code from r252834David Blaikie2015-11-121-39/+26
| | | | llvm-svn: 252840
* Provide a frontend based error for always_inline functions that requireEric Christopher2015-11-122-25/+74
| | | | | | | | | | | | | | | target features that the caller function doesn't provide. This matches the existing backend failure to inline functions that don't have matching target features - and diagnoses earlier in the case of always_inline. Fix up a few test cases that were, in fact, invalid if you tried to generate code from the backend with the specified target features and add a couple of tests to illustrate what's going on. This should fix PR25246. llvm-svn: 252834
* Move checkTargetFeatures to CodeGenFunction.cpp to make itEric Christopher2015-11-122-42/+43
| | | | | | more obvious that it's generic. llvm-svn: 252833
* In preparation to use it in more places renameEric Christopher2015-11-122-14/+12
| | | | | | | checkBuiltinTargetFeatures to checkTargetFeatures and sink the error handling into the function. llvm-svn: 252832
* [TLS on Darwin] treat all Darwin platforms in the same way.Manman Ren2015-11-112-4/+4
| | | | | | rdar://problem/9001553 llvm-svn: 252820
* Extract out a function onto CodeGenModule for getting the map ofEric Christopher2015-11-115-44/+47
| | | | | | | features for a particular function, then use it to clean up some code. llvm-svn: 252819
* [TLS on Darwin] change how we handle globals with linkonce or weak linkage.Manman Ren2015-11-112-11/+16
| | | | | | | | | | | | This is about how we handle static member of a template. Before this commit, we use internal linkage for the IR thread-local variable, which is inefficient. With this commit, we will start to follow Itanium C++ ABI. rdar://problem/23415206 Reviewed by John McCall. llvm-svn: 252814
* [TLS] move setting tls_guard in tls_init.Manman Ren2015-11-111-4/+4
| | | | | | | | We used to emit the store prior to branch in the entry block. To make it more efficient, this commit moves it to the init block. We still mark as initialized before initializing anything else. llvm-svn: 252777
* [ASan] Allow -fsanitize-recover=address.Yury Gribov2015-11-111-4/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D14243 llvm-svn: 252721
* Fix a FIXME about using std::is_sorted.Eric Christopher2015-11-111-3/+4
| | | | llvm-svn: 252691
* [COFF] Don't try to emit weak aliases on COFFReid Kleckner2015-11-101-5/+10
| | | | | | | | | | | | | | | | | This comes up when a derived class destructor is equivalent to a base class destructor defined in the same TU, and we try to alias them. A COFF weak alias cannot satisfy a normal undefined symbol reference from another TU. The other TU must also mark the referenced symbol as weak, and we can't rely on that. Clang already has a special case here for dllexport, but we failed to realize that the problem also applies to other non-discardable symbols such as those from explicit template instantiations. Fixes PR25477. llvm-svn: 252659
* Atomics: support __c11_* calls on _Atomic struct types.Tim Northover2015-11-093-38/+67
| | | | | | | | | | | | | When a struct's size is not a power of 2, the corresponding _Atomic() type is promoted to the nearest. We already correctly handled normal C++ expressions of this form, but direct calls to the __c11_atomic_whatever builtins ended up performing dodgy operations on the smaller non-atomic types (e.g. memcpy too much). Later optimisations removed this as undefined behaviour. This patch converts EmitAtomicExpr to allocate its temporaries at the full atomic width, sidestepping the issue. llvm-svn: 252507
* [EABI] Add Clang support for -meabi flagRenato Golin2015-11-091-0/+8
| | | | | | | | | | | | | | The -meabi flag to control LLVM EABI version. Without '-meabi' or with '-meabi default' imply LLVM triple default. With '-meabi gnu' sets EABI GNU. With '-meabi 4' or '-meabi 5' set EABI version 4 and 5 respectively. A similar patch was introduced in LLVM. Patch by Vinicius Tinti. llvm-svn: 252463
* [PGO] Code cleanup [NFC]Xinliang David Li2015-11-091-43/+2
| | | | | | | Use interfaces defined in LLVM to create FuncName and FuncNameVar. llvm-svn: 252434
* Replace tab with 8 spaces, NFC.Yaron Keren2015-11-081-1/+1
| | | | llvm-svn: 252426
* Add support for function attribute 'not_tail_called'.Akira Hatanaka2015-11-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | This attribute is used to prevent tail-call optimizations to the marked function. For example, in the following piece of code, foo1 will not be tail-call optimized: int __attribute__((not_tail_called)) foo1(int); int foo2(int a) { return foo1(a); // Tail-call optimization is not performed. } The attribute has effect only on statically bound calls. It has no effect on indirect calls. Also, virtual functions and objective-c methods cannot be marked as 'not_tail_called'. rdar://problem/22667622 Differential Revision: http://reviews.llvm.org/D12922 llvm-svn: 252369
* CodeGen: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-11-0611-28/+30
| | | | | | | Make ilist iterator conversions explicit in clangCodeGen. Eventually I'll remove them everywhere. llvm-svn: 252358
* Fix __builtin_signbit for ppcf128 typePetar Jovanovic2015-11-061-3/+13
| | | | | | | | | | | Function__builtin_signbit returns wrong value for type ppcf128 on big endian machines. This patch fixes how value is generated in that case. Patch by Aleksandar Beserminji. Differential Revision: http://reviews.llvm.org/D14149 llvm-svn: 252307
* Fix crash in EmitDeclMetadata modeKeno Fischer2015-11-051-2/+4
| | | | | | | | | | | | | | | | | Summary: This fixes a bug that's easily encountered in LLDB (https://llvm.org/bugs/show_bug.cgi?id=22875). The problem here is that we mangle a name during debug info emission, but never actually emit the actual Decl, so we run into problems in EmitDeclMetadata (which assumes such a Decl exists). Fix that by just skipping metadata emissions for mangled names that don't have associated Decls. Reviewers: rjmccall Subscribers: labath, cfe-commits Differential Revision: http://reviews.llvm.org/D13959 llvm-svn: 252229
* CodeGen: Update for debug info API change.Peter Collingbourne2015-11-051-6/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D14266 llvm-svn: 252220
* PR25368: Replace workaround for build failure with modules enabled with a fixRichard Smith2015-11-052-1/+8
| | | | | | | | | | | for the root cause. The 'using llvm::isa;' declaration in Basic/LLVM.h only pulls the declarations of llvm::isa that were declared prior to it into namespace clang. In a modules build, this is a hermetic set of just the declarations from LLVM. In a non-modules build, we happened to also pull the declaration from lib/CodeGen/Address.h into namespace clang, which made the code in question accidentally compile. llvm-svn: 252211
* [WebAssembly] Update wasm builtin functions to match spec changes.Dan Gohman2015-11-051-7/+2
| | | | | | | The page_size operator has been removed from the spec, and the resize_memory operator has been changed to grow_memory. llvm-svn: 252201
* Use profile data template file for covmap func record (NFC)Xinliang David Li2015-11-051-11/+10
| | | | llvm-svn: 252147
* Allow compound assignment expressions to be contracted when licensed by the ↵Stephen Canon2015-11-041-1/+1
| | | | | | language or pragma. llvm-svn: 252050
* [Sema] Implement __make_integer_seqDavid Majnemer2015-11-041-0/+1
| | | | | | | | | | | | | | | | | | This new builtin template allows for incredibly fast instantiations of templates like std::integer_sequence. Performance numbers follow: My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz. __make_integer_seq<std::integer_sequence, int, 90000> takes 0.25 seconds. std::make_integer_sequence<int, 90000> takes unbound time, it is still running. Clang is consuming gigabytes of memory. Differential Revision: http://reviews.llvm.org/D13786 llvm-svn: 252036
* Remove unused #includeDavid Majnemer2015-11-031-1/+0
| | | | | | No functionality change is intended. llvm-svn: 251941
* Remove some legacy mingw-w64 gcc struct infoMartell Malone2015-11-031-4/+0
| | | | | | | | As of gcc 4.7 mingw-w64 no longer emits 128-bit structs as i128 Differential Revision: http://reviews.llvm.org/D14179 llvm-svn: 251930
* Stop back-patching 'readonly' Objective-C properties with 'readwrite' ones.Douglas Gregor2015-11-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A 'readonly' Objective-C property declared in the primary class can effectively be shadowed by a 'readwrite' property declared within an extension of that class, so long as the types and attributes of the two property declarations are compatible. Previously, this functionality was implemented by back-patching the original 'readonly' property to make it 'readwrite', destroying source information and causing some hideously redundant, incorrect code. Simplify the implementation to express how this should actually be modeled: as a separate property declaration in the extension that shadows (via the name lookup rules) the declaration in the primary class. While here, correct some broken Fix-Its, eliminate a pile of redundant code, clean up the ARC migrator's handling of properties declared in extensions, and fix debug info's naming of methods that come from categories. A wonderous side effect of doing this write is that it eliminates the "AddedObjCPropertyInClassExtension" method from the AST mutation listener, which in turn eliminates the last place where we rewrite entire declarations in a chained PCH file or a module file. This change (which fixes rdar://problem/18475765) will allow us to eliminate the rewritten-decls logic from the serialization library, and fixes a crash (rdar://problem/23247794) illustrated by the test/PCH/chain-categories.m example. llvm-svn: 251874
* Fix va_arg on watchOS.Tim Northover2015-11-021-0/+4
| | | | | | As in other contexts, alignments can go up to 16 bytes in a va_list. llvm-svn: 251821
* [MS ABI] Don't zero-initialize vbptrs in basesDavid Majnemer2015-11-024-14/+82
| | | | | | | | | | | | Certain CXXConstructExpr nodes require zero-initialization before a constructor is called. We had a bug in the case where the constructor is called on a virtual base: we zero-initialized the base's vbptr field. A complementary bug is present in MSVC where no zero-initialization occurs for the subobject at all. This fixes PR25370. llvm-svn: 251783
* [CodeGen] Call SetInternalFunctionAttributes to attach functionAkira Hatanaka2015-10-315-16/+26
| | | | | | | | | | | | | | | | | attributes to internal functions. This patch fixes CodeGenModule::CreateGlobalInitOrDestructFunction to use SetInternalFunctionAttributes instead of SetLLVMFunctionAttributes to attach function attributes to internal functions. Also, make sure the correct CGFunctionInfo is passed instead of always passing what arrangeNullaryFunction returns. rdar://problem/20828324 Differential Revision: http://reviews.llvm.org/D13610 llvm-svn: 251734
* CGExprConstant.cpp: Appease Modules.NAKAMURA Takumi2015-10-301-1/+1
| | | | llvm-svn: 251713
* ARMv7k: implement ABI changes for watchOS from standard iOS.Tim Northover2015-10-301-8/+63
| | | | llvm-svn: 251710
* Watch and TV OS: wire up basic ABI choicesTim Northover2015-10-305-2/+10
| | | | | | | This sets the mostly expected Darwin default ABI options for these two platforms. Active changes from these defaults for watchOS are in a later patch. llvm-svn: 251708
* Initialize @catch variables correctly in fragile-runtime ARC.John McCall2015-10-303-20/+31
| | | | llvm-svn: 251677
* Fix the emission of ARC ivar layouts in the non-fragile Mac runtime.John McCall2015-10-291-6/+11
| | | | | | | My previous change in this area accidentally broke the rule when InstanceBegin was not a multiple of the word size. llvm-svn: 251666
* Add support for __builtin_{add,sub,mul}_overflow.John McCall2015-10-291-1/+127
| | | | | | Patch by David Grayson! llvm-svn: 251651
* [WinEH] Mark calls inside cleanups as noinlineReid Kleckner2015-10-283-11/+27
| | | | | | | | | | | | | | | This works around PR25162. The MSVC tables make it very difficult to correctly inline a C++ destructor that contains try / catch. We've attempted to address PR25162 in LLVM's backend, but it feels pretty infeasible. MSVC and ICC both appear to avoid inlining such complex destructors. Long term, we want to fix this by making the inliner smart enough to know when it is inlining into a cleanup, so it can inline simple destructors (~unique_ptr and ~vector) while avoiding destructors containing try / catch. llvm-svn: 251576
* Fix the calling convention of Mingw64 long double valuesReid Kleckner2015-10-281-11/+22
| | | | | | | | | | GCC uses the x87DoubleExtended model for long doubles, and passes them indirectly by address through function calls. Also replace the existing mingw-long-double assembly emitting test with an IR-level test. llvm-svn: 251567
OpenPOWER on IntegriCloud