summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/BackendUtil.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merging r232439:"Tom Stellard2015-05-041-1/+0
| | | | | | | | | This reverts commit r236305. This commit requires an ABI change to LLVM, which is not allowed for stable releases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@236437 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r232439:Tom Stellard2015-05-011-0/+1
| | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r232439 | mail | 2015-03-16 19:52:21 -0400 (Mon, 16 Mar 2015) | 7 lines GCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1 This exposes the optional exit block placement logic from r232438 as a clang -cc1 option. There is a test on the llvm side, but there isn't really a way to inspect the gcov options from clang to test it here as well. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@236305 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Insert random noops to increase security against ROP attacks (clang)"JF Bastien2015-01-141-1/+0
| | | | | | | This reverts commit: http://reviews.llvm.org/D3393 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225947 91177308-0d34-0410-b5e6-96231b3b80d8
* Insert random noops to increase security against ROP attacks (clang)JF Bastien2015-01-141-0/+1
| | | | | | | | | | | | | | | | | | | | A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks. Command line options: -noop-insertion // Enable noop insertion. -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion) -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions. In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future). -fdiversify This is the clang part of the patch. llvm part: D3392 http://reviews.llvm.org/D3393 Patch by Stephen Crane (@rinon) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225910 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for move in llvm.Eric Christopher2015-01-141-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225892 91177308-0d34-0410-b5e6-96231b3b80d8
* Driver: begin threading frontend support for SymbolRewriterSaleem Abdulrasool2015-01-091-0/+14
| | | | | | | | | | Allow blessed access to the symbol rewriter from the driver. Although the symbol rewriter could be invoked through tools like opt and llc, it would not accessible from the frontend. This allows us to read the rewrite map files in the frontend rather than the backend and enable symbol rewriting for actually performing the symbol interpositioning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225504 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm front end change and use the TargetOptions structEric Christopher2014-12-181-0/+1
| | | | | | for ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224493 91177308-0d34-0410-b5e6-96231b3b80d8
* InstrProf: Use LLVM's -instrprof pass for profilingJustin Bogner2014-12-081-0/+6
| | | | | | | | The logic for lowering profiling counters has been moved to an LLVM pass. Emit the intrinsics rather than duplicating the whole pass in clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223683 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce -fsanitize-coverage=N flagKostya Serebryany2014-11-111-0/+15
| | | | | | | | | | | | | | | | | | | Summary: This change makes the asan-coverge (formerly -mllvm -asan-coverge) accessible via a clang flag. Companion patch to LLVM is http://reviews.llvm.org/D6152 Test Plan: regression tests, chromium Reviewers: samsonov Reviewed By: samsonov Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6153 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221719 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Refactor sanitizer options in LangOptions.Alexey Samsonov2014-11-111-1/+1
| | | | | | | | | | | | | | | | | | | Get rid of ugly SanitizerOptions class thrust into LangOptions: * Make SanitizeAddressFieldPadding a regular language option, and rely on default behavior to initialize/reset it. * Make SanitizerBlacklistFile a regular member LangOptions. * Introduce the helper class "SanitizerSet" to represent the set of enabled sanitizers and make it a member of LangOptions. It is exactly the entity we want to cache and modify in CodeGenFunction, for instance. We'd also be able to reuse SanitizerSet in CodeGenOptions for storing the set of recoverable sanitizers, and in the Driver to represent the set of sanitizers turned on/off by the commandline flags. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221653 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a SanitizerKind enum to LangOptions.Alexey Samsonov2014-11-071-5/+5
| | | | | | | | | | | | | | Use the bitmask to store the set of enabled sanitizers instead of a bitfield. On the negative side, it makes syntax for querying the set of enabled sanitizers a bit more clunky. On the positive side, we will be able to use SanitizerKind to eventually implement the new semantics for -fsanitize-recover= flag, that would allow us to make some sanitizers recoverable, and some non-recoverable. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221558 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new -fmerge-functions -cc1 flag that enables function merging.Nick Lewycky2014-10-241-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220543 91177308-0d34-0410-b5e6-96231b3b80d8
* Move -fsanitize-blacklist to LangOpts from CodeGenOpts. NFC.Alexey Samsonov2014-10-151-2/+2
| | | | | | | | | After http://reviews.llvm.org/D5687 is submitted, we will need SanitizerBlacklist before the CodeGen phase, so make it a LangOpt (as it will actually affect ABI / class layout). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219842 91177308-0d34-0410-b5e6-96231b3b80d8
* CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & ↵Jonathan Roelofs2014-10-031-0/+5
| | | | | | | | | single threaded systems http://reviews.llvm.org/D4985 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219027 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-09-101-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217547 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide a BuryPointer for unique_ptrs.David Blaikie2014-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, it'd be nice if we could move to a case where all buried pointers were buried via unique_ptr to demonstrate that the program had finished with the value (that we could really have cleanly deallocated it) but instead chose to bury it. I think the main reason that's not possible right now is the various IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of compiler bits (see the various similar "CompilerInstance::releaseAndLeak*" functions). I have yet to figure out their correct ownership semantics - but perhaps, even if the intrusiveness can be removed, the shared ownership may yet remain and that would lead to a non-unique burying as is there today. (though we could model that a little better - by passing in a shared_ptr, etc - rather than needing the two step that's currently used in those other releaseAndLeak* functions) This might be a bit more robust if BuryPointer took the boolean: BuryPointer(bool, unique_ptr<T>) and the choice to bury was made internally - that way, even when DisableFree was not set, the unique_ptr would still be null in the caller and there'd be no chance of accidentally having a different codepath where the value is used after burial in !DisableFree, but it becomes null only in DisableFree, etc... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216742 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert MC command line flag for fatal assembler warnings into a properJoerg Sonnenberger2014-08-261-0/+1
| | | | | | | flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216472 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor TLI creation. NFC.Rafael Espindola2014-08-211-7/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216198 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for LLVM API change.Eric Christopher2014-08-041-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214786 91177308-0d34-0410-b5e6-96231b3b80d8
* Use -enable-global-merge option to match llvm r210639. <rdar://problem/17803206>Bob Wilson2014-07-261-1/+1
| | | | | | | | | llvm revision 210639 renamed the -global-merge backend option to -enable-global-merge. This change simply updates clang to match that. Patch by Steven Wu! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213993 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Completely remove sanitizer blacklist file from instrumentation pass.Alexey Samsonov2014-07-081-4/+1
| | | | | | | | | | | | | | | | | | | | | | All blacklisting logic is now moved to the frontend (Clang). If a function (or source file it is in) is blacklisted, it doesn't get sanitize_address attribute and is therefore not instrumented. If a global variable (or source file it is in) is blacklisted, it is reported to be blacklisted by the entry in llvm.asan.globals metadata, and is not modified by the instrumentation. The latter may lead to certain false positives - not all the globals created by Clang are described in llvm.asan.globals metadata (e.g, RTTI descriptors are not), so we may start reporting errors on them even if "module" they appear in is blacklisted. We assume it's fine to take such risk: 1) errors on these globals are rare and usually indicate wild memory access 2) we can lazily add descriptors for these globals into llvm.asan.globals lazily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212505 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove top-level Clang -fsanitize= flags for optional ASan features.Alexey Samsonov2014-06-131-7/+2
| | | | | | | | | | | | | | Init-order and use-after-return modes can currently be enabled by runtime flags. use-after-scope mode is not really working at the moment. The only problem I see is that users won't be able to disable extra instrumentation for init-order and use-after-scope by a top-level Clang flag. But this instrumentation was implicitly enabled for quite a while and we didn't hear from users hurt by it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210924 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variableAlexey Samsonov2014-06-021-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210041 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove sanitizer blacklist from ASan/TSan/MSan function passes.Alexey Samsonov2014-06-021-9/+5
| | | | | | | | | | | | | | | | | | | Instrumentation passes now use attributes address_safety/thread_safety/memory_safety which are added by Clang frontend. Clang parses the blacklist file and adds the attributes accordingly. Currently blacklist is still used in ASan module pass to disable instrumentation for certain global variables. We should fix this as well by collecting the set of globals we're going to instrument in Clang and passing it to ASan in metadata (as we already do for dynamically-initialized globals and init-order checking). This change also removes -tsan-blacklist and -msan-blacklist LLVM commandline flags in favor of -fsanitize-blacklist= Clang flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210037 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-4/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209272 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for paired llvm commit with AsmVerbose.Eric Christopher2014-05-211-6/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209261 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm change to avoid having global flag setting in TargetMachine.Eric Christopher2014-05-201-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209239 91177308-0d34-0410-b5e6-96231b3b80d8
* Missed a ! in the if statement when these were being set and the optionsEric Christopher2014-05-161-1/+1
| | | | | | | | | are inverted in clang and llvm. I'll attempt to get a testcase for this that doesn't involve compiling to .s, but it's unlikely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209017 91177308-0d34-0410-b5e6-96231b3b80d8
* Fill in the options in the MCOptions struct directly like the otherEric Christopher2014-05-151-9/+5
| | | | | | options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208834 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: fix code model mappingSaleem Abdulrasool2014-05-081-1/+1
| | | | | | | | Large is CodeModel::Model::Large, not CodeModel::Model::Medium. Thanks to majnemer for pointing out the typo! Its unclear how to test the mapped value in the compiler, the tests already cover the driver side. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208335 91177308-0d34-0410-b5e6-96231b3b80d8
* Driver: parse -mcmodel earlierSaleem Abdulrasool2014-05-081-14/+11
| | | | | | | | | | | This addresses an existing FIXME item in the driver. The code model flag was parsed in the actual tool rather than in the driver. This was problematic since the value may be invalid. In that case, we would silently treat it as a default value in non-assert builds, and abort in assert builds. Add a check in the driver to validate that the value being passed is valid, and if not provide a proper error message. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208275 91177308-0d34-0410-b5e6-96231b3b80d8
* 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207602 91177308-0d34-0410-b5e6-96231b3b80d8
* BackendUtil: Pass through -mdisable-tail-callsDuncan P. N. Exon Smith2014-04-181-0/+1
| | | | | | | | | | | | | | | The frontend option -fno-optimize-sibling-calls resolves to -cc1's -mdisable-tail-calls, which is passed to the TargetMachine in the backend. PassManagerBuilder was adding the -tailcallelim pass anyway. Use a new DisableTailCalls option in PassManagerBuilder to disable tail calls harder. Requires the matching commit in LLVM that adds DisableTailCalls. <rdar://problem/16050591> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206543 91177308-0d34-0410-b5e6-96231b3b80d8
* verify-di: Call debug info verifier from clangDuncan P. N. Exon Smith2014-04-151-0/+2
| | | | | | | | | This is paired with a patch to LLVM that creates a separate pass for verifying debug info. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206301 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang for LLVM split stack API changes in r205997Reid Kleckner2014-04-101-1/+0
| | | | | | Patch by Alex Crichton! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205998 91177308-0d34-0410-b5e6-96231b3b80d8
* Support for -Wa,-compress-debug-sections.David Blaikie2014-03-271-0/+3
| | | | | | Also, while I'm here, support -nocompress-debug-sections too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204959 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't recompute inlining threshold - use new overload provided by LLVMEli Bendersky2014-03-121-10/+3
| | | | | | | Follow-up on LLVM r203669 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203673 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203389 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-1/+1
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203279 91177308-0d34-0410-b5e6-96231b3b80d8
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-1/+1
| | | | | | This is a precursor to moving to std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203275 91177308-0d34-0410-b5e6-96231b3b80d8
* Schedule discriminator pass.Diego Novillo2014-03-031-0/+8
| | | | | | | This needs to modify a line table test to account for the new lexical block created to hold the new discriminator value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202754 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add #include's for OwningPtr.Ahmed Charles2014-03-031-0/+1
| | | | | | Allows removing #include's in LLVM while switching to std::unique_ptr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202677 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-02-251-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202170 91177308-0d34-0410-b5e6-96231b3b80d8
* Accept -no-integrated-as in -cc1 and forward it to llvm.Rafael Espindola2014-02-211-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201837 91177308-0d34-0410-b5e6-96231b3b80d8
* [asan] Remove -fsanitize-address-zero-base-shadow command lineEvgeniy Stepanov2014-01-161-4/+2
| | | | | | | | | | | | | | | | | | flag from clang, and disable zero-base shadow support on all platforms where it is not the default behavior. - It is completely unused, as far as we know. - It is ABI-incompatible with non-zero-base shadow, which means all objects in a process must be built with the same setting. Failing to do so results in a segmentation fault at runtime. - It introduces a backward dependency of compiler-rt on user code, which is uncommon and complicates testing. This is the Clang part of a larger change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199372 91177308-0d34-0410-b5e6-96231b3b80d8
* [cleanup] Update the include of Dominators.h to reflect its move to theChandler Carruth2014-01-131-1/+1
| | | | | | IR library in LLVM r199082. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199083 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Update Clang to reflect the new header for the bitcode writer passChandler Carruth2014-01-131-1/+1
| | | | | | added in LLVM r199078. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199079 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Update the creation of an IR printing pass to reflect the APIChandler Carruth2014-01-121-1/+1
| | | | | | update in LLVM r199044. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199045 91177308-0d34-0410-b5e6-96231b3b80d8
* [PM] Update Clang to follow the header rename in LLVM r199041.Chandler Carruth2014-01-121-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199042 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang for the move of headers in r198688.Chandler Carruth2014-01-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198689 91177308-0d34-0410-b5e6-96231b3b80d8