aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-11-11[ASan] Allow -fsanitize-recover=address.Yury Gribov1-4/+10
Differential Revision: http://reviews.llvm.org/D14243 llvm-svn: 252721
2015-11-09[EABI] Add Clang support for -meabi flagRenato Golin1-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
2015-10-18CodeGen: simplify TargetOptions setupSaleem Abdulrasool1-17/+12
Do direct assignment of boolean values and regroup. Use StringSwitch instead of custom cases. NFC. llvm-svn: 250665
2015-10-15Recommit "Clang support for -flto=thin."Teresa Johnson1-2/+2
This recommits r250398 with fixes to the tests for bot failures. Add "-target x86_64-unknown-linux" to the clang invocations that check for the gold plugin. llvm-svn: 250455
2015-10-15Revert "Clang support for -flto=thin." (bot failures)Teresa Johnson1-2/+2
Rolling this back for now since there are a couple of bot failures on the new tests I added, and I won't have a chance to look at them in detail until later this afternoon. I think the new tests need some restrictions on having the gold plugin available. This reverts commit r250398. llvm-svn: 250402
2015-10-15Clang support for -flto=thin.Teresa Johnson1-2/+2
Summary: Add clang support for -flto=thin option, which is used to set the EmitFunctionSummary code gen option on compiles. Add -flto=full as an alias to the existing -flto. Add tests to check for proper overriding of -flto variants on the command line, and convert grep tests to FileCheck. Reviewers: dexonsmith, joker.eph Subscribers: davidxl, cfe-commits Differential Revision: http://reviews.llvm.org/D11908 llvm-svn: 250398
2015-09-26Replace a loop and temporary string copying with llvm::join.Eric Christopher1-7/+3
llvm-svn: 248645
2015-09-18Pass the relocation model to LLVM for assembler files.Joerg Sonnenberger1-0/+1
llvm-svn: 247981
2015-08-25Convert SampleProfile pass into a Module pass.Diego Novillo1-12/+3
Eventually, we will need sample profiles to be incorporated into the inliner's cost models. To do this, we need the sample profile pass to be a module pass. This patch makes no functional changes beyond the mechanical adjustments needed to run SampleProfile as a module pass. llvm-svn: 245941
2015-08-01Rangify for loops, NFC.Yaron Keren1-2/+2
llvm-svn: 243841
2015-07-28Add -femulated-tls flag to select the emulated TLS model.Chih-Hung Hsieh1-0/+1
This will be used for old targets like Android that do not support ELF TLS models. Differential Revision: http://reviews.llvm.org/D10524 llvm-svn: 243441
2015-07-24LLVM API Change: the Module always owns the DataLayoutMehdi Amini1-3/+2
From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 243115
2015-07-17Fix -save-temp when using objc-arc, sanitizer and profilingSteven Wu1-0/+3
Currently, -save-temp will cause ObjCARC optimization to be dropped, sanitizer pass to run early in the pipeline, and profiling instrumentation to run twice. Fix the issue by properly disable all passes in the optimization pipeline when generating bitcode output and parse some of the Language Options even when the input is bitcode so the passes can be setup correctly. llvm-svn: 242565
2015-07-14Remove a completely redundant initialization of llvm::TimePassesIsEnabled,Adrian Prantl1-2/+0
which is actually the variable backing up the llvm -time-passes command line argument. llvm::TimePassesIsEnabled is actually being initialized in CodeGenAction. llvm-svn: 242099
2015-07-06Resubmit "Pass down the -flto option to the -cc1 job" (r239481)Teresa Johnson1-0/+1
The patch is the same except for the addition of a new test for the issue that required reverting the dependent llvm commit. --Original Commit Message-- Pass down the -flto option to the -cc1 job, and from there into the CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 241467
2015-07-02Attach attribute "trap-func-name" to call sites of llvm.trap and llvm.debugtrap.Akira Hatanaka1-1/+0
This is needed to use clang's command line option "-ftrap-function" for LTO and enable changing the trap function name on a per-call-site basis. rdar://problem/21225723 Differential Revision: http://reviews.llvm.org/D10831 llvm-svn: 241306
2015-06-23Update for LLVM api change.Rafael Espindola1-1/+4
llvm-svn: 240406
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-1/+1
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-1/+1
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-19[ASan] Initial support for Kernel AddressSanitizerAlexander Potapenko1-2/+15
This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. llvm-svn: 240131
2015-06-12Revert commit r239481 as it is dependent on reverted llvm commit r239480.Teresa Johnson1-1/+0
llvm-svn: 239588
2015-06-11add the -mrecip driver flag and process its options (3rd try)Sanjay Patel1-0/+3
The 1st and 2nd tries to land this (r238055, r238851) were reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed after r239001. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 239536
2015-06-10Pass down the -flto option to the -cc1 job, and from there into theTeresa Johnson1-0/+1
CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 239481
2015-06-09Attach attribute "disable-tail-calls" to the functions in the IR.Akira Hatanaka1-2/+0
This commit adds back the code that seems to have been dropped unintentionally in r176985. rdar://problem/13752163 Differential Revision: http://reviews.llvm.org/D10100 llvm-svn: 239426
2015-06-05C++ 11 rangify for loop.Yaron Keren1-4/+3
llvm-svn: 239140
2015-06-04C++11 rangify for loop.Yaron Keren1-4/+2
llvm-svn: 239064
2015-06-03Revert "add the -mrecip driver flag and process its options (2nd try)"Rafael Espindola1-4/+0
This reverts commit r238851. It depends on a llvm commit that was reverted. llvm-svn: 238904
2015-06-02add the -mrecip driver flag and process its options (2nd try)Sanjay Patel1-0/+4
The first try to land this (r238055) was reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed by r238788, and the LLVM patch was resubmitted at r238842. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 238851
2015-05-26Remove the code in clang that is using TargetOptions::NoFramePointerElim.Akira Hatanaka1-9/+0
This is the clang side change following r238244. llvm-svn: 238245
2015-05-23This reverts commit r238064 and r238055.Rafael Espindola1-4/+0
They depend on a reverted llvm commit. llvm-svn: 238076
2015-05-22add missing include for TargetRecipSanjay Patel1-0/+1
llvm-svn: 238064
2015-05-22add the -mrecip driver flag and process its optionsSanjay Patel1-0/+3
This is the front-end counterpart to D8982 (LLVM r238051). The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 238055
2015-05-12Remove the code that pulled soft float attributes out of the featureEric Christopher1-1/+0
strings and remove the setting of TargetOptions::UseSoftFloat to match the code change in llvm r237079. llvm-svn: 237080
2015-05-07[SanitizerCoverage] Implement user-friendly -fsanitize-coverage= flags.Alexey Samsonov1-1/+3
Summary: Possible coverage levels are: * -fsanitize-coverage=func - function-level coverage * -fsanitize-coverage=bb - basic-block-level coverage * -fsanitize-coverage=edge - edge-level coverage Extra features are: * -fsanitize-coverage=indirect-calls - coverage for indirect calls * -fsanitize-coverage=trace-bb - tracing for basic blocks * -fsanitize-coverage=trace-cmp - tracing for cmp instructions * -fsanitize-coverage=8bit-counters - frequency counters Levels and features can be combined in comma-separated list, and can be disabled by subsequent -fno-sanitize-coverage= flags, e.g.: -fsanitize-coverage=bb,trace-bb,8bit-counters -fno-sanitize-coverage=trace-bb is equivalient to: -fsanitize-coverage=bb,8bit-counters Original semantics of -fsanitize-coverage flag is preserved: * -fsanitize-coverage=0 disables the coverage * -fsanitize-coverage=1 is a synonym for -fsanitize-coverage=func * -fsanitize-coverage=2 is a synonym for -fsanitize-coverage=bb * -fsanitize-coverage=3 is a synonym for -fsanitize-coverage=edge * -fsanitize-coverage=4 is a synonym for -fsanitize-coverage=edge,indirect-calls Driver tries to diagnose invalid flag usage, in particular: * At most one level (func,bb,edge) must be specified. * "trace-bb" and "8bit-counters" features require some level to be specified. See test case for more examples. Test Plan: regression test suite Reviewers: kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9577 llvm-svn: 236790
2015-05-07[SanitizerCoverage] Give clang-cc1 the power to precisly specify needed ↵Alexey Samsonov1-2/+9
sanitizier coverage mode. Summary: The next step is to add user-friendly control over these options to driver via -fsanitize-coverage= option. Test Plan: regression test suite Reviewers: kcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9545 llvm-svn: 236756
2015-05-02Fix -fobjc-arc doesn't work with -save-tempsSteven Wu1-2/+1
The underlying problem is that there is currently no way to run ObjCARCContract from llvm bitcode which is required by ObjC ARC. This fix the problem by always enable ObjCARCContract pass if optimization is enabled. The ObjCARC Contract pass has almost no overhead on code that is not using ARC. llvm-svn: 236372
2015-04-30InstrProf: Support for setting profile output from command lineJustin Bogner1-0/+1
This change is the third of 3 patches to add support for specifying the profile output from the command line via -fprofile-instr-generate=<path>, where the specified output path/file will be overridden by the LLVM_PROFILE_FILE environment variable. This patch adds the necessary support to the clang frontend, and adds a new test. The compiler-rt and llvm parts are r236055 and r236288, respectively. Patch by Teresa Johnson. Thanks! llvm-svn: 236289
2015-04-15uselistorder: Remove dead includeDuncan P. N. Exon Smith1-1/+0
Forgot to remove the include in r234970 llvm-svn: 234972
2015-04-15uselistorder: -mllvm -preserve-ll-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith1-1/+2
Follow up to r234962, start respecting `-emit-llvm-uselists even for LLVM assembly. Note that the driver never passes this flag; this is just a interface convenience/consistency for those using `-cc1` directly. This required LLVM r234969 (and predecessors). llvm-svn: 234970
2015-04-15uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith1-1/+1
Stop relying on `cl::opt` to pass along the driver's decision to preserve use-lists. Create a new `-cc1` option called `-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc). Note that despite its generic name, it *doesn't* do the right thing when -emit-llvm (LLVM assembly) yet. I'll hook that up soon. This doesn't really change the behaviour of the driver. The default is still to preserve use-lists for `clang -emit-llvm` and `clang -save-temps`, and nothing else. But it stops relying on global state (and also is a nicer interface for hackers using `clang -cc1`). llvm-svn: 234962
2015-04-15uselistorder: Update for LLVM API change in r234959Duncan P. N. Exon Smith1-1/+3
Now that `addBitcodeWriterPass()` requires an explicit bit to preserve use-list order, send it in from `clang`. It looks like I'll be able to push this up to the `-cc1` options. llvm-svn: 234960
2015-04-14Use raw_pwrite_stream in clang.Rafael Espindola1-7/+9
This is a small improvement to -emit-pth and allows llvm to start requiring it. llvm-svn: 234897
2015-04-11[Driver] Properly support -mglobal-merge using explicit options.Ahmed Bougacha1-2/+0
Follow-up to r234666. With this, the -m[no-]global-merge options have the expected behavior. Previously, -mglobal-merge was ignored, and there was no way of enabling the optimization. llvm-svn: 234668
2015-04-09Update for LLVM api changes.Rafael Espindola1-9/+4
llvm-svn: 234536
2015-03-19Clang follow-up to LLVM r232772Duncan P. N. Exon Smith1-2/+0
-verify-di is dead! Long live -verify! llvm-svn: 232779
2015-03-17Add fveclib option.Michael Zolotukhin1-0/+8
Review: http://reviews.llvm.org/D8097 llvm-svn: 232533
2015-03-16GCOV: Expose the -coverage-exit-block-before-body flag in clang -cc1Justin Bogner1-0/+1
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. llvm-svn: 232439
2015-03-04Try to fix the build after removing DataLayoutPassReid Kleckner1-3/+0
llvm-svn: 231278
2015-02-20Add -funique-section-names and -fno-unique-section-names options.Rafael Espindola1-0/+1
For now -funique-section-names is the default, so no change in default behavior. The total .o size in a build of llvm and clang goes from 241687775 to 230649031 bytes if -fno-unique-section-names is used. llvm-svn: 230031
2015-02-13[PM] Fix #include order here that I forgot to update before changing it.Chandler Carruth1-1/+1
llvm-svn: 229092