aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
AgeCommit message (Collapse)Author
2013-02-15Add the 'target-cpu' and 'target-features' attributes to functions.Bill Wendling
The back-end will use these values to reconfigure code generation for different features. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175308 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15Abstract out emitting the vdtor calls and do it properly when using -cxx-abi ↵Timur Iskhodzhanov
microsoft; also fix vdtor calls for the ARM ABI git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175271 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-14Revert accidental commit.Bill Wendling
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175143 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-14Pass the target options through to code generation.Bill Wendling
The code generation stuff is going to set attributes on the functions it generates. To do that it needs the target options. Pass them through. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175141 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,Richard Smith
base-to-derived casts have undefined behavior if the object is not actually an instance of the derived type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175078 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-13Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175045 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Properly assemble PHIs after a null-checked invoke of objc_msgSend.John McCall
rdar://12046763 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174946 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Call __cxa_begin_catch with the current exception beforeJohn McCall
calling std::terminate(). rdar://11904428 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Change some CGF parameters to CGMs.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174939 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12Backing out r174919 while I investigate a self-host bug on Takumi's builder.Lang Hames
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174925 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12In ARC, emit non-peepholed +1s within the full-expression insteadJohn McCall
of immediately afterwards. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174922 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11When generating IR for default copy-constructors, copy-assignment operators,Lang Hames
move-constructors and move-assignment operators, use memcpy to copy adjacent POD members. Previously, classes with one or more Non-POD members would fall back on element-wise copies for all members, including POD members. This often generated a lot of IR. Without padding metadata, it wasn't often possible for the LLVM optimizers to turn the element-wise copies into a memcpy. This code hasn't yet received any serious tuning. I didn't see any serious regressions on a self-hosted clang build, or any of the nightly tests, but I think it's important to get this out in the wild to get more testing. Insights, feedback and comments welcome. Many thanks to David Blaikie, Richard Smith, and especially John McCall for their help and feedback on this work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174919 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose
Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174768 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei
restrictions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174601 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Changed CGObjCMac.cpp to add the marker externally_initialized to ↵Michael Gottesman
SELECTOR_REFERENCES in both the fragile and non-fragile API. This is to ensure that GlobalOpt in LLVM does not attempt to look through a selector reference to a method var name at compile time. I also added a test/updated old tests that need to recognize the new keyword. rdar://12580965. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05Fix typo in commentArnaud A. de Grandmaison
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174359 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-03CodeGen: Implement hint values for dynamic_cast as described in the Itanium ↵Benjamin Kramer
C++ ABI. This can yield dramatic speedups of dynamic_cast for simple inheritance trees, at least with libsupc++. Neither libcxxabi nor libcxxrt make use of this hint currently, it was never implemented because clang didn't support it. There was some concern about the number of class hierarchy walks this change introduces. If it turns out to be an issue we can add caching either at the cast pair level or even deeper, but we also do a lot of walks in Sema so this codepath is probably fairly optimized already. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174293 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-03CodeGen: Mark the runtime function __dynamic_cast as readonly & nounwind.Benjamin Kramer
This allows the optimizer to CSE dynamic_casts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174289 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02Don't forget to run destructors when we create an array temporary of class type.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174257 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02Fixed another whitespace issue... *sigh*.Michael Gottesman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174255 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02Fixed whitespace.Michael Gottesman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02On platforms which do not support ARC natively, do not mark ↵Michael Gottesman
objc_retain/objc_release as "nonlazybind". rdar://13108298. rdar://13129783. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02Revert r174246, accidentally committed.David Blaikie
This reverts commit 1513eb9284c23acfd19cf742b95996fbb11ca741. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174249 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02Sentenc-ify comment added in r174206.David Blaikie
Based on post-commit review by Paul Robinson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174248 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-02BasicsDavid Blaikie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174246 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01Fix exception handling line table problems introduced by r173593David Blaikie
r173593 made us a little too eager to associate all code at the end of a function with the user-written 'return' line. This caused problems with breakpoints as they'd be set in exception handling code preceeding the actual non-exception return handling code, leading to the breakpoint never being hit in non-exceptional execution. This change restores the pre-r173593 exception handling line information where the cleanup code is associated with the '}' not the return line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174206 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-01Destroy arrays and ARC fields when throwing out of ctors.John McCall
Previously we were only handling non-array fields of class type. Testcases derived from a patch by WenHan Gu. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174146 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Add support for AArch64 target.Tim Northover
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174055 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31[msan] Run more optimizations after MemorySanitizer pass.Evgeniy Stepanov
MSan instrumentation is driven by the original code. We take every incoming instruction and emit another instruction (or ten) next to it, operating on the shadow values (but sometimes on the real values, too). Two programs in one, essentially. There can be any kinds of redundancies in the second one, so we just run whatever is normally run at -O2, and then exclude some passes that do not help much with benchmarks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174049 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31When we're emitting a constructor or destructor call from a delegatingDouglas Gregor
constructor, retrieve our VTT parameter directly. Fixes PR14588 / <rdar://problem/12867962>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174042 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-31Make sure that the Attribute object represents one attribute only.Bill Wendling
Several places were still treating the Attribute object as respresenting multiple attributes. Those places now use the AttributeSet to represent multiple attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174004 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Move UTF conversion routines from clang/lib/Basic to llvm/lib/SupportDmitri Gribenko
This is required to use them in TableGen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173924 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-30Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled asRichard Smith
an attribute for consistency with our other noreturn mechanisms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173898 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-29[ubsan] Implement the -fcatch-undefined-behavior flag using a trappingChad Rosier
implementation; this is much more inline with the original implementation (i.e., pre-ubsan) and does not require run-time library support. The trapping implementation can be invoked using either '-fcatch-undefined-behavior' or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter being preferred. Eventually, the -fcatch-undefined-behavior' flag will be removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173848 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-28Since ObjCARC has been refactored into its own library with its own ↵Michael Gottesman
declaration header, we need to include the declaration header alongside Scalar.h in BackendUtil. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-27Use the AttributeSet instead of AttributeWithIndex.Bill Wendling
In the future, AttributeWithIndex won't be used anymore. Besides, it exposes the internals of the AttributeSet to outside users, which isn't goodness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173605 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-26PR14566: Debug Info: avoid top level lexical blocks in functionsDavid Blaikie
One of the gotchas (see changes to CodeGenFunction) was due to the fix in r139416 (for PR10829). This only worked previously because the top level lexical block would set the location to the end of the function, the debug location would be updated (as per r139416), the location would be set to the end of the function again (but that would no-op, since it was the same as the previous location), then the return instruction would be emitted using the debug location. Once the top level lexical block was no longer emitted, the end-of-function location change was causing the debug loc to be updated, regressing that bug. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25patch for PR9027 and // rdar://11861085Fariborz Jahanian
Title: [PR9027] volatile struct bug: member is not loaded at -O; This is caused by last flag passed to @llvm.memcpy being false, not honoring that aggregate has at least one 'volatile' data member (even though aggregate itself has not been qualified as 'volatile'. As a result, optimization optimizes away the memcpy altogether. Patch review by John MaCall (I still need to fix up a test though). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173535 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25ARM says that the array cookie should always be eight bytes.John McCall
ARM is not thinking about over-aligned structures. Overrule ARM in both our generic-ARM and iOS ABI implementations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173531 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25Move the decision about the kind of CGCXXABI to make insideJohn McCall
the family-specific files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173530 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25The standard ARM C++ ABI dictates that inline functions areJohn McCall
never key functions. We did not implement that rule for the iOS ABI, which was driven by what was implemented in gcc-4.2. However, implement it now for other ARM-based platforms. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173515 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-25First pass at abstracting out a class for the target C++ ABI.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-24[mips] Do not emit i32 padding if target ABI is O32. This was causing backendAkira Hatanaka
to pass floating point arguments to be passed in integer registers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173375 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Add a new LangOpt NativeHalfType. This option allows for native half/fp16Joey Gouly
operations (as opposed to storage only half/fp16). Also add some semantic checks for OpenCL half types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Remove the last of uses that use the Attribute object as a collection of ↵Bill Wendling
attributes. Collections of attributes are handled via the AttributeSet class now. This finally frees us up to make significant changes to how attributes are structured. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173229 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-23Use the AttributeSet when adding multiple attributes and an Attribute::AttrKindBill Wendling
when adding a single attribute to the function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22Use the correct field to copy/dispose a __block variable.John McCall
We were previously hard-coding a particular field index. This was fine before (because we were obviously guaranteed the presence of a copy/dispose member) except for (1) alignment padding and (2) future extensions adding extra members to the header, such as the extended-layout pointer. Note that we only introduce the extended-layout pointer in the presence of structs. (We also seem to be introducing it even in the presence of an all-non-object layout, but that's a different potential issue.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21Have AttributeSet::getRetAttributes() return an AttributeSet instead of ↵Bill Wendling
Attribute. This further restricts the use of the Attribute class to the Attribute family of classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21Make AttributeSet::getFnAttributes() return an AttributeSet instead of an ↵Bill Wendling
Attribute. This is more code to isolate the use of the Attribute class to that of just holding one attribute instead of a collection of attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173095 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21First step towards vftable generation with -cxx-abi microsoft PR13231Timur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173035 91177308-0d34-0410-b5e6-96231b3b80d8