aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-10-04[XRay] Check in Clang whether XRay supports the target when ↵Dean Michael Berris1-1/+14
-fxray-instrument is passed Added the code which explicitly emits an error in Clang in case `-fxray-instrument` is passed, but XRay is not supported for the selected target. Author: rSerge Reviewers: dberris, rsmith, aaron.ballman, rnk Subscribers: cfe-commits, iid_iunknown Differential Revision: https://reviews.llvm.org/D24799 llvm-svn: 283193
2016-10-02[coroutines] Rename driver flag -fcoroutines to -fcoroutines-tsGor Nishanov1-0/+6
Summary: Also makes -fcoroutines_ts to be both a Driver and CC1 flag. Patch mostly by EricWF. Reviewers: rnk, cfe-commits, rsmith, EricWF Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D25130 llvm-svn: 283064
2016-10-02[PowerPC] Enable soft-float for PPC64, and +soft-float -> -hard-floatHal Finkel1-9/+2
Enable soft-float support on PPC64, as the backend now supports it. Also, the backend now uses -hard-float instead of +soft-float, so set the target features accordingly. Fixes PR26970. llvm-svn: 283061
2016-09-30P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, weRichard Smith1-0/+18
assume that ::operator new provides no more alignment than is necessary for any primitive type, except when we're on a GNU OS, where glibc's malloc guarantees to provide 64-bit alignment on 32-bit systems and 128-bit alignment on 64-bit systems. This can be controlled by the command-line -fnew-alignment flag. llvm-svn: 282974
2016-09-29[Myriad] Silently ignore -fno-split-dwarf-inliningDouglas Katzman1-6/+8
llvm-svn: 282757
2016-09-26CC1: Add -save-stats optionMatthias Braun1-0/+27
This option behaves in a similar spirit as -save-temps and writes internal llvm statistics in json format to a file. Differential Revision: https://reviews.llvm.org/D24820 llvm-svn: 282426
2016-09-26Driver: avoid failing in the backendSaleem Abdulrasool1-3/+8
Avoid failing in the backend when the rewrite map does not exist. Rather check that the map exists in the frontend before handing it off to the backend. Add the missing rewrite maps that the tests were referencing. llvm-svn: 282379
2016-09-23Use llvm::to_string instead of std::to_string to fix botTeresa Johnson1-2/+3
This should fix the android build in this bot: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/11143 llvm-svn: 282308
2016-09-23[LTO] Add -flto-jobs=N to control backend parallelismTeresa Johnson1-4/+26
Summary: Currently, a linker option must be used to control the backend parallelism of ThinLTO. The linker option varies depending on the linker (e.g. gold vs ld64). Add a new clang option -flto-jobs=N to control this. I've added in the wiring to pass this to the gold plugin. I also added in the logic to pass this down in the form I understand that ld64 uses on MacOS, for the darwin target. Reviewers: mehdi_amini, dexonsmith Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D24826 llvm-svn: 282291
2016-09-23[asan] Fix incorrect SEH symbol mangling on win64.Etienne Bergeron1-1/+4
Summary: The ASAN unittests are failing (check-asan-dynamic) due to an incorrect symbol name: ``` LINK : error LNK2001: unresolved external symbol ___asan_seh_interceptor ``` On win64, the linker is not adding an extra underscore. This was correctly fixed in the same file for other uses. After that patch, most of the unittests are passing, but some related to SEH needs to be fixed. ``` Failing Tests (4): AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memchr.cc AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_seh.cc AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/seh.cc Expected Passes : 339 Passes With Retry : 3 Expected Failures : 16 Unsupported Tests : 152 Unexpected Failures: 4 ``` Reviewers: rnk, kcc, majnemer Subscribers: majnemer, chrisha, cfe-commits Differential Revision: https://reviews.llvm.org/D24841 llvm-svn: 282251
2016-09-20Remove some boilerplate comments that don't explain anything.Eric Christopher1-4/+0
llvm-svn: 282007
2016-09-13Reapply r281276 with passing -emit-llvm in one of the testsAdam Nemet1-0/+5
Original commit message: Add -fdiagnostics-show-hotness Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281293
2016-09-13Revert "Add -fdiagnostics-show-hotness"Adam Nemet1-5/+0
This reverts commit r281276. Many bots are failing. llvm-svn: 281279
2016-09-12Add -fdiagnostics-show-hotnessAdam Nemet1-0/+5
Summary: I've recently added the ability for optimization remarks to include the hotness of the corresponding code region. This uses PGO and allows filtering of the optimization remarks by relevance. The idea was first discussed here: http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 The general goal is to produce a YAML file with the remarks. Then, an external tool could dynamically filter these by hotness and perhaps by other things. That said it makes sense to also expose this at the more basic level where we just include the hotness info with each optimization remark. For example, in D22694, the clang flag was pretty useful to measure the overhead of the additional analyses required to include hotness. (Without the flag we don't even run the analyses.) For the record, Hal has already expressed support for the idea of this patch on IRC. Differential Revision: https://reviews.llvm.org/D23284 llvm-svn: 281276
2016-09-09Myriad: nominally "support" ASAN.Douglas Katzman1-4/+11
Doesn't work, but needs to be enabled in order to get there. llvm-svn: 281071
2016-09-08[Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64Vedant Kumar1-9/+11
Differential Revision: https://reviews.llvm.org/D23643 llvm-svn: 280998
2016-08-31Add -fprofile-dir= to clang.Nick Lewycky1-7/+23
-fprofile-dir=path allows the user to specify where .gcda files should be emitted when the program is run. In particular, this is the first flag that causes the .gcno and .o files to have different paths, LLVM is extended to support this. -fprofile-dir= does not change the file name in the .gcno (and thus where lcov looks for the source) but it does change the name in the .gcda (and thus where the runtime library writes the .gcda file). It's different from a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX. To implement this we split -coverage-file into -coverage-data-file and -coverage-notes-file to specify the two different names. The !llvm.gcov metadata node grows from a 2-element form {string coverage-file, node dbg.cu} to 3-elements, {string coverage-notes-file, string coverage-data-file, node dbg.cu}. In the 3-element form, the file name is already "mangled" with .gcno/.gcda suffixes, while the 2-element form left that to the middle end pass. llvm-svn: 280306
2016-08-31DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inliningDavid Blaikie1-8/+12
I tested the cases involving split-dwarf + gmlt + no-split-dwarf-inlining, but didn't verify the simpler case without gmlt. The logic is, admittedly, a little hairy, but seems about as simple as I could wrangle it. llvm-svn: 280290
2016-08-30Unrevert r280035 now that the clang-cl bug it exposed has been fixed byRichard Smith1-12/+21
r280133. Original commit message: C++ Modules TS: driver support for building modules. This works as follows: we add --precompile to the existing gamut of options for specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag specifies that an input is taken to the precompilation step and no further, and this can be specified when building a .pcm from a module interface or when building a .pch from a header file. The .cppm extension (and some related extensions) are implicitly recognized as C++ module interface files. If --precompile is /not/ specified, the file is compiled (via a .pcm) to a .o file containing the code for the module (and then potentially also assembled and linked, if -S, -c, etc. are not specified). We do not yet suppress the emission of object code for other users of the module interface, so for now this will only work if everything in the .cppm file has vague linkage. As with the existing support for module-map modules, prebuilt modules can be provided as compiler inputs either via the -fmodule-file= command-line argument or via files named ModuleName.pcm in one of the directories specified via -fprebuilt-module-path=. This also exposes the -fmodules-ts cc1 flag in the driver. This is still experimental, and in particular, the concrete syntax is subject to change as the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does not enable support for implicitly loading module maps nor building modules via the module cache, but those features can be turned on separately and used in conjunction with the Modules TS support. llvm-svn: 280134
2016-08-30[Hexagon] Use handleTargetFeaturesGroup to process target-specific featuresKrzysztof Parzyszek1-23/+7
llvm-svn: 280093
2016-08-30Revert r280035 (and followups r280057, r280085), it caused PR30195Nico Weber1-21/+12
llvm-svn: 280091
2016-08-30Handle -mlong-calls on HexagonKrzysztof Parzyszek1-1/+6
Differential Revision:://reviews.llvm.org/D22766 llvm-svn: 280089
2016-08-30This adds new options -fdenormal-fp-math and passes through option -ffast-mathSjoerd Meijer1-0/+6
to CC1, which are translated to function attributes and can e.g. be mapped on build attributes FP_exceptions and FP_denormal. Setting these build attributes allows better selection of floating point libraries. Differential Revision: https://reviews.llvm.org/D23840 llvm-svn: 280064
2016-08-30C++ Modules TS: driver support for building modules.Richard Smith1-12/+21
This works as follows: we add --precompile to the existing gamut of options for specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag specifies that an input is taken to the precompilation step and no further, and this can be specified when building a .pcm from a module interface or when building a .pch from a header file. The .cppm extension (and some related extensions) are implicitly recognized as C++ module interface files. If --precompile is /not/ specified, the file is compiled (via a .pcm) to a .o file containing the code for the module (and then potentially also assembled and linked, if -S, -c, etc. are not specified). We do not yet suppress the emission of object code for other users of the module interface, so for now this will only work if everything in the .cppm file has vague linkage. As with the existing support for module-map modules, prebuilt modules can be provided as compiler inputs either via the -fmodule-file= command-line argument or via files named ModuleName.pcm in one of the directories specified via -fprebuilt-module-path=. This also exposes the -fmodules-ts cc1 flag in the driver. This is still experimental, and in particular, the concrete syntax is subject to change as the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does not enable support for implicitly loading module maps nor building modules via the module cache, but those features can be turned on separately and used in conjunction with the Modules TS support. llvm-svn: 280035
2016-08-29[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.Evgeniy Stepanov1-0/+5
Multi-DSO CFI model requires every DSO to export a __cfi_check function. llvm-svn: 280031
2016-08-26clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.Nico Weber1-3/+3
Also makes -fexec-charset accept utf-8 case-insensitively. Like https://reviews.llvm.org/D23807, but for execution-charset. Also replace a few .lower() comparisons with equals_lower(). https://reviews.llvm.org/D23938 llvm-svn: 279866
2016-08-26Add support for -fdiagnostics-absolute-paths: printing absolute paths in ↵Hans Wennborg1-0/+3
diagnostics Differential Revision: https://reviews.llvm.org/D23816 llvm-svn: 279827
2016-08-25Omit column info for CodeView by defaultAdrian McCarthy1-4/+8
Clang tracks only start columns, not start-end ranges. CodeView allows for that, but the VS debugger doesn't handle anything less than a complete range well--it either highlights the wrong part of a statement or truncates source lines in the assembly view. It's better to have no column information at all. So by default, we'll omit the column information for CodeView targeting Windows. Since the column info is still useful for sanitizers, I've promoted -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests to make sure that works for clang-cl. Differential Revision: https://reviews.llvm.org/D23720 llvm-svn: 279765
2016-08-24DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining ↵David Blaikie1-7/+17
is used If the inline info is not duplicated into the skeleton CU, then there's value in using -gsplit-dwarf and -gmlt together (to keep all those extra subprograms out of the skeleton CU, while also producing smaller .dwo files) llvm-svn: 279687
2016-08-24DebugInfo: Add flag to CU to disable emission of inline debug info into the ↵David Blaikie1-0/+4
skeleton CU In cases where .dwo/.dwp files are guaranteed to be available, skipping the extra online (in the .o file) inline info can save a substantial amount of space - see the original r221306 for more details there. llvm-svn: 279651
2016-08-23ARM-Darwin: ignore and diagnose attempts to omit frame pointer.Tim Northover1-6/+22
iOS (and other 32-bit ARM variants) always require a valid frame pointer to improve backtraces. Previously the -fomit-frame-pointer and -momit-leaf-frame-pointer options were being silently discarded via hacks in the backend. It's better if Clang configures itself to emit the correct IR and warns about (ignored) attempts to override this. llvm-svn: 279546
2016-08-23clang-cl: Accept MSVC 2015's `/source-charset:utf-8` flag.Nico Weber1-1/+1
clang already treats all inputs as utf-8. Warn if anything but utf-8 is passed. Do this by mapping source-charset to finput-charset, which already behaves like this. Slightly tweak finput-charset to accept "utf-8" case-insensitively. This matches gcc's and cl.exe's behavior, and IANA says that character set names are case-insensitive. https://reviews.llvm.org/D23807 llvm-svn: 279531
2016-08-18Module: add -fprebuilt-module-path to support loading prebuilt modules.Manman Ren1-0/+7
In this mode, there is no need to load any module map and the programmer can simply use "@import" syntax to load the module directly from a prebuilt module path. When loading from prebuilt module path, we don't support rebuilding of the module files and we ignore compatible configuration mismatches. rdar://27290316 Differential Revision: http://reviews.llvm.org/D23125 llvm-svn: 279096
2016-08-17Some missing usage of TargetParser. NFC.Zijiao Ma1-1/+4
llvm-svn: 278890
2016-08-15[CUDA] Include CUDA headers before anything else.Justin Lebar1-4/+7
Summary: There's no point to --cuda-path if we then go and include /usr/include first. And if you install the right packages, Ubuntu will install (very old) CUDA headers there. Reviewers: tra Subscribers: cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D23341 llvm-svn: 278734
2016-08-11Don't enable PIE on i686-unknown-cloudabi.Ed Schouten1-4/+6
We're only going to provide support for using PIE on architectures that provide PC-relative addressing. i686 is not one of those, so add the necessary bits for only passing in -pie -zrelro conditionally. llvm-svn: 278395
2016-08-11Pass in frame pointer omitting compiler flags for CloudABI as well.Ed Schouten1-1/+1
On Linux we pass in -fomit-frame-pointer flags (and similar) automatically if optimization is enabled. Let's do the same thing on CloudABI. Without this, Clang seems to run out of registers quite quickly while trying to build code with inline assembly. llvm-svn: 278393
2016-08-09[OpenCL] Handle -cl-fp32-correctly-rounded-divide-sqrtYaxun Liu1-0/+3
Let the driver pass the option to frontend. Do not set precision metadata for division instructions when this option is set. Set function attribute "correctly-rounded-divide-sqrt-fp-math" based on this option. Differential Revision: https://reviews.llvm.org/D22940 llvm-svn: 278155
2016-08-09[clang-cl] Make -gline-tables-only imply -gcodeviewReid Kleckner1-4/+5
It's surprising that you have to pass /Z7 in addition to -gcodeview to get debug info. The sanitizer runtime, for example, expects that if the compiler supports the -gline-tables-only flag, then it will emit debug info. llvm-svn: 278139
2016-08-08[ARM] Command-line options for embedded position-independent codeOliver Stannard1-1/+56
This patch (with the corresponding ARM backend patch) adds support for some new relocation models: * Read-only position independence (ROPI): Code and read-only data is accessed PC-relative. The offsets between all code and RO data sections are known at static link time. * Read-write position independence (RWPI): Read-write data is accessed relative to a static base register. The offsets between all writeable data sections are known at static link time. These two modes are independent (they specify how different objects should be addressed), so they can be used individually or together. These modes are intended for bare-metal systems or systems with small real-time operating systems. They are designed to avoid the need for a dynamic linker, the only initialisation required is setting the static base register to an appropriate value for RWPI code. There is one C construct not currently supported by these modes: global variables initialised to the address of another global variable or function, where that address is not known at static-link time. There are a few possible ways to solve this: * Disallow this, and require the user to write their own initialisation function if they need variables like this. * Emit dynamic initialisers for these variables in the compiler, called from the .init_array section (as is currently done for C++ dynamic initialisers). We have a patch to do this, described in my original RFC email (http://lists.llvm.org/pipermail/llvm-dev/2015-December/093022.html), but the feedback from that RFC thread was that this is not something that belongs in clang. * Use a small dynamic loader to fix up these variables, by adding the difference between the load and execution address of the relevant section. This would require linker co-operation to generate a table of addresses that need fixing up. Differential Revision: https://reviews.llvm.org/D23196 llvm-svn: 278016
2016-07-28[CUDA] Unswitch enumerators in the selection of the offloading tool chain.Samuel Antao1-2/+2
llvm-svn: 277064
2016-07-28[OpenMP][CUDA] Do not forward OpenMP flags for CUDA device actions.Samuel Antao1-2/+6
Summary: This patch prevents OpenMP flags from being forwarded to CUDA device commands. That was causing the CUDA frontend to attempt to emit OpenMP code which is not supported. This fixes the bug reported in https://llvm.org/bugs/show_bug.cgi?id=28723. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, tra, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22895 llvm-svn: 276979
2016-07-28[AArch64] Using AArch64TargetParser in Clang.Zijiao Ma1-41/+14
This resubmit r270688 which broke some specific buildbots.That's because there is incorrect indexing problem in the targetparser,and the problem is fixed in r276957. Differential Revision: https://reviews.llvm.org/D21277 llvm-svn: 276958
2016-07-27Retry: [Driver] Compute effective target triples once per job (NFCI)Vedant Kumar1-15/+9
Compute an effective triple once per job. Cache the triple in the prevailing ToolChain for the duration of the job. Clients which need effective triples now look them up in the ToolChain. This eliminates wasteful re-computation of effective triples (e.g in getARMFloatABI()). While we're at it, delete MachO::ComputeEffectiveClangTriple. It was a no-op override. Differential Revision: https://reviews.llvm.org/D22596 llvm-svn: 276937
2016-07-27Revert "[Driver] Compute effective target triples once per job (NFCI)"Vedant Kumar1-187/+126
This reverts commit r275895 in order to address some post-commit review feedback from Eric Christopher (see: the list thread for r275895). llvm-svn: 276936
2016-07-27Refactor how include paths are appended to the command arguments.Samuel Antao1-57/+30
Summary: This patch aims at removing redundancy in the way include paths for the regular and offloading toolchains are appended to the arguments list in the clang tool. This was suggested by @rsmith in response to r275931. Reviewers: rsmith, tra Subscribers: rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D22518 llvm-svn: 276929
2016-07-27Add flags to toggle preservation of assembly commentsNirav Dave1-0/+4
Summary: Add -fpreserve-as-comments and -fno-preserve-as-comments. Reviewers: echristo, rnk Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22883 llvm-svn: 276907
2016-07-27[ARM] Pass -mimplcit-it= to integrated assemblerOliver Stannard1-0/+21
Differential Revision: https://reviews.llvm.org/D22761 llvm-svn: 276851
2016-07-27Fix for compiling with clang <= 3.7 and g++6 headersVedant Kumar1-3/+3
Make integers explicitly unsigned, so the tuple constructor will resolve properly when but with clang 3.6, 3.7 and gcc 6.1.1 libstdc++ headers. Patch by Frederich Munch! Differential Revision: https://reviews.llvm.org/D22798 llvm-svn: 276831
2016-07-26Modules: follow up to r276769.Manman Ren1-0/+1
In r276769, I forgot to forward the driver option, add that here. rdar://26675801 llvm-svn: 276797