aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-03-15Myriad: Pass -mcpu to movi{Compile,Asm}Douglas Katzman1-3/+6
Differential Revision: http://reviews.llvm.org/D18186 llvm-svn: 263556
2016-03-14[Driver] Enable --rtlib option for MSVC targetAndrey Turetskiy1-1/+16
This enables "--rtlib compiler-rt" option under MSVC environment. Patch by Roman Shirokiy. Differential Revision: http://reviews.llvm.org/D17453 llvm-svn: 263422
2016-03-13Remove compile time PreserveName in favor of a runtime cc1 ↵Mehdi Amini1-0/+2
-discard-value-names option Summary: This flag is enabled by default in the driver when NDEBUG is set. It is forwarded on the LLVMContext to discard all value names (but GlobalValue) for performance purpose. This an improved version of D18024 Reviewers: echristo, chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18127 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263394
2016-03-04Switch krait to use -mcpu=cortex-a15 for assembler tool invocations.Stephen Hines1-2/+2
Summary: Using -no-integrated-as causes -mcpu=krait to be transformed into -march=armv7-a today. This precludes the assembler from using instructions like sdiv, which are present for krait. Cortex-a15 is the closest subset of functionality for krait, so we should switch the assembler to use that instead. Reviewers: cfe-commits, apazos, weimingz Subscribers: aemerson Differential Revision: http://reviews.llvm.org/D17874 llvm-svn: 262742
2016-03-03[ARM] Add Clang targeting for ARMv8-M Baseline/MainlineBradley Smith1-0/+4
llvm-svn: 262619
2016-03-02[PGO] Change profile use cc1 option to handle IR level profilesRong Xu1-2/+3
This patch changes cc1 option for PGO profile use from -fprofile-instr-use=<path> to -fprofile-instrument-use-path=<path>. -fprofile-instr-use=<path> is now a driver only option. In addition to decouple the cc1 option from the driver level option, this patch also enables IR level profile use. cc1 option handling now reads the profile header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM} -- this is a common enum for -fprofile-instrument={}, for the profile instrumentation), and invoke the pipeline to enable the respective PGO use pass. Reviewers: silvas, davidxl Differential Revision: http://reviews.llvm.org/D17737 llvm-svn: 262515
2016-03-01clang-cl: Implement initial limited support for precompiled headers.Nico Weber1-1/+69
In the gcc precompiled header model, one explicitly runs clang with `-x c++-header` on a .h file to produce a gch file, and then includes the header with `-include foo.h` and if a .gch file exists for that header it gets used. This is documented at http://clang.llvm.org/docs/UsersManual.html#precompiled-headers cl.exe's model is fairly different, and controlled by the two flags /Yc and /Yu. A pch file is generated as a side effect of a regular compilation when /Ycheader.h is passed. While the compilation is running, the compiler keeps track of #include lines in the main translation unit and writes everything up to an `#include "header.h"` line into a pch file. Conversely, /Yuheader.h tells the compiler to skip all code in the main TU up to and including `#include "header.h"` and instead load header.pch. (It's also possible to use /Yc and /Yu without an argument, in that case a `#pragma hrdstop` takes the role of controlling the point where pch ends and real code begins.) This patch implements limited support for this in that it requires the pch header to be passed as a /FI force include flag – with this restriction, it can be implemented almost completely in the driver with fairly small amounts of code. For /Yu, this is trivial, and for /Yc a separate pch action is added that runs before the actual compilation. After r261774, the first failing command makes a compilation stop – this means if the pch fails to build the main compilation won't run, which is what we want. However, in /fallback builds we need to run the main compilation even if the pch build fails so that the main compilation's fallback can run. To achieve this, add a ForceSuccessCommand that pretends that the pch build always succeeded in /fallback builds (the main compilation will then fail to open the pch and run the fallback cl.exe invocation). If /Yc /Yu are used in a setup that clang-cl doesn't implement yet, clang-cl will now emit a "not implemented yet; flag ignored" warning that can be disabled using -Wno-clang-cl-pch. Since clang-cl doesn't yet serialize some important things (most notably `pragma comment(lib, ...)`, this feature is disabled by default and only enabled by an internal driver flag. Once it's more stable, this internal flag will disappear. (The default stdafx.h setup passes stdafx.h as explicit argument to /Yc but not as /FI – instead every single TU has to `#include <stdafx.h>` as first thing it does. Implementing support for this should be possible with the approach in this patch with minimal frontend changes by passing a --stop-at / --start-at flag from the driver to the frontend. This is left for a follow-up. I don't think we ever want to support `#pragma hdrstop`, and supporting it with this approach isn't easy: This approach relies on the driver knowing the pch filename in advance, and `#pragma hdrstop(out.pch)` can set the output filename, so the driver can't know about it in advance.) clang-cl now also honors /Fp and puts pch files in the same spot that cl.exe would put them, but the pch file format is of course incompatible. This has ramifications on /fallback, so /Yc /Yu aren't passed through to cl.exe in /fallback builds. http://reviews.llvm.org/D17695 llvm-svn: 262420
2016-03-01Introduce -fembed-bitcode driver optionSteven Wu1-0/+20
Summary: This is the clang driver part of the change to embedded bitcode. This includes: 1. -fembed-bitcode option which breaks down the compilation into two stages. The first stage emits optimized bitcode and the second stage compiles bitcode into object file. 2. -fembed-bitcode-marker option which doesn't really break down to two stages to speedup the compilation flow. 3. pass the correct linker flag to darwin linker if tool chains supports embedded bitcode. Reviewers: rsmith, thakis Subscribers: thakis, cfe-commits Differential Revision: http://reviews.llvm.org/D17390 llvm-svn: 262282
2016-02-29[clang-cl] /EHc should not effect functions with explicit exception ↵David Majnemer1-6/+8
specifications Functions with an explicit exception specification have their behavior dictated by the specification. The additional /EHc behavior only comes into play if no exception specification is given. llvm-svn: 262198
2016-02-29[clang-cl] /EHc should not have an effect on /EHaDavid Majnemer1-1/+5
This matches behavior with MSVC. llvm-svn: 262197
2016-02-26[Driver] Disable frame pointer elimination by default if target isAkira Hatanaka1-0/+2
x86_64-pc-win32-macho. rdar://problem/24470634 llvm-svn: 261976
2016-02-24Fix build by using hasFlag instead of hasArg.Peter Collingbourne1-2/+2
llvm-svn: 261782
2016-02-24Add whole-program vtable optimization feature to Clang.Peter Collingbourne1-0/+26
This patch introduces the -fwhole-program-vtables flag, which enables the whole-program vtable optimization feature (D16795) in Clang. Differential Revision: http://reviews.llvm.org/D16821 llvm-svn: 261767
2016-02-24AArch64: fix Cyclone CPU features list.Tim Northover1-1/+4
It turns out we don't have CRC after all. Who knew? llvm-svn: 261758
2016-02-23Rename Action::begin() to Action::input_begin().Nico Weber1-2/+2
Also introduce inputs() that reutnrs an llvm::iterator_range. Iterating over A->inputs() is much less mysterious than iterating over *A. No intended behavior change. llvm-svn: 261674
2016-02-22[WebAssembly] Initial driver support for standard library paths.Dan Gohman1-2/+44
llvm-svn: 261560
2016-02-22Don't enable /GX by defaultDavid Majnemer1-1/+3
The /GX flag is disabled unless explicitly specified on the command line. This partially addresses PR26698. llvm-svn: 261537
2016-02-20[MSVC Compat] Implement -EHc semanticsDavid Majnemer1-3/+3
The -EHc flag implicitly adds a nothrow attribute to any extern "C" function when exceptions are enabled. llvm-svn: 261425
2016-02-20[MSVC Compat] Add support for /GX, /GX-David Majnemer1-5/+12
These are legacy flags which map to /EHsc and /EHs-c- respectively. llvm-svn: 261424
2016-02-19[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a singleRichard Smith1-1/+1
option. Previously these options could both be used to specify that you were compiling the implementation file of a module, with a different set of minor bugs in each case. This change removes -fmodule-implementation-of, and instead tracks a flag to determine whether we're currently building a module. -fmodule-name now behaves the same way that -fmodule-implementation-of previously did. llvm-svn: 261372
2016-02-18[MSVC] Turn C++ EH on my defaultDavid Majnemer1-5/+3
Our support for C++ EH is sufficiently good that it makes sense to enable support for it out of the box. While we are here, update the MSVCCompatibility doc. llvm-svn: 261195
2016-02-16[CUDA] pass debug options to ptxas.Artem Belevich1-9/+11
ptxas optimizations are disabled if we need to generate debug info as ptxas does not accept '-g' otherwise. Differential Revision: http://reviews.llvm.org/D17111 llvm-svn: 261018
2016-02-11Remove decision logic for old NetBSD development versions, the 7.0Joerg Sonnenberger1-1/+1
release made this obsolete. llvm-svn: 260617
2016-02-11Now that Sparc/Sparc64 backend is mostly usable, provide the sameJoerg Sonnenberger1-0/+2
linking defaults as other NetBSD targets, i.e. compiler_rt-in-libc and libc++ as STL. llvm-svn: 260616
2016-02-11[Driver] Add support for Qualcomm's Kryo CPU.Chad Rosier1-1/+2
http://reviews.llvm.org/D17124 llvm-svn: 260555
2016-02-11[ARM] Add command-line options for ARMv8.2-AOliver Stannard1-4/+0
This allows ARMv8.2-A to be targeted either by using "armv8.2a" in the triple, or by using -march=armv8.2-a (or the alias -march=armv8.2a). The FP16 extension can be enabled with the "+fp16" suffix to the -march or -mcpu option. This is consistent with the AArch64 option, rather than the usual ARM option of -mfpu. We have agreed with the team which will be upstreaming this to GCC that we want to use this new option format for new architecture extensions for both ARM and AArch64. Most of the work for this was done by the TargetParser patch in llvm. Differential Revision: http://reviews.llvm.org/D15040 llvm-svn: 260533
2016-02-10[clang-cl] /Z7 now generates normal debug info, not just line infoReid Kleckner1-5/+2
Previously LLVM could not process any debug info we produced, so it didn't make sense to spend time generating it. Now that it has primitive support for local variable info, it does make sense to generate normal debug info. llvm-svn: 260435
2016-02-07Driver: adjust linker invocation for GNUToolsSaleem Abdulrasool1-7/+10
Adjust the driver to invoke the linker more similar to gcc. -dynamic-linker is only passed if -static and -shared are not part of the compiler (driver) invocation. Replicate the passing of -export-rdynamic as per the GCC link spec: %{!static: %{rdynamic:-export-dynamic} %{!shared:-dynamic-linker ...}} This behaviour is consistent across all the targets that are supported, so no need to conditionalise it on the target. Resolves PR24245. llvm-svn: 260019
2016-02-04[PGO] cc1 option name change for profile instrumentationRong Xu1-4/+6
This patch changes cc1 option -fprofile-instr-generate to an enum option -fprofile-instrument={clang|none}. It also changes cc1 options -fprofile-instr-generate= to -fprofile-instrument-path=. The driver level option -fprofile-instr-generate and -fprofile-instr-generate= remain intact. This change will pave the way to integrate new PGO instrumentation in IR level. Review: http://reviews.llvm.org/D16730 llvm-svn: 259811
2016-02-02Move DebugInfoKind into its own header to cut the cyclic dependency edge ↵Benjamin Kramer1-24/+23
from Driver to Frontend. llvm-svn: 259489
2016-01-27ARMv7k: select ABI based on v7k Arch rather than watchos OS.Tim Northover1-1/+2
Various bits we'd like to use the new ABI actually compile with "-arch armv7k -miphoneos-version-min=9.0". Not ideal, but also not ridiculous given how slices work. llvm-svn: 258976
2016-01-26Revert "[Driver] Make sure -fno-math-builtin option is being passed by the ↵Chad Rosier1-3/+2
driver." This reverts commit r258814. llvm-svn: 258815
2016-01-26[Driver] Make sure -fno-math-builtin option is being passed by the driver.Chad Rosier1-2/+3
Support for the -fno-math-builtin option was added in r186899. The codegen side is being tested in test/CodeGen/nomathbuiltin.c. The missing part was just passing the option through the driver. PR26317 llvm-svn: 258814
2016-01-26[Driver] Update FIXME comment now that PR4941 has been addressed.Chad Rosier1-1/+1
The actual fix should be addressed by someone who can test on Darwin. llvm-svn: 258813
2016-01-25[cfi] Cross-DSO CFI diagnostic mode (clang part)Evgeniy Stepanov1-1/+4
* Runtime diagnostic data for cfi-icall changed to match the rest of cfi checks * Layout of all CFI diagnostic data changed to put Kind at the beginning. There is no ABI stability promise yet. * Call cfi_slowpath_diag instead of cfi_slowpath when needed. * Emit __cfi_check_fail function, which dispatches a CFI check faliure according to trap/recover settings of the current module. * A tiny driver change to match the way the new handlers are done in compiler-rt. llvm-svn: 258745
2016-01-25[CUDA] Disable ctor/dtor aliases in device code.Justin Lebar1-3/+5
Summary: NVPTX doesn't support aliases, so don't generate them. Reviewers: tra Subscribers: cfe-commits, jhen, echristo Differential Revision: http://reviews.llvm.org/D16499 llvm-svn: 258733
2016-01-25[MSVC Compat] Only warn for unknown clang-cl argumentsEhsan Akhgari1-0/+4
Summary: MSVC's driver accepts all unknown arguments but warns about them. clang by default rejects all unknown arguments. This causes issues specifically with build systems such as autoconf which liberally pass things such as $LDFLAGS to the compiler and expect everything to work. This patch teaches clang-cl to ignore unknown driver arguments. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D16511 llvm-svn: 258720
2016-01-25LTO via the gold plugin needs to be told about debugger tuning.Paul Robinson1-0/+11
Differential Revision: http://reviews.llvm.org/D16094 llvm-svn: 258712
2016-01-25Pass --wrap=pthread_create to linker for -fsplit-stack.Rafael Espindola1-0/+3
From https://gcc.gnu.org/ml/gcc-patches/2010-09/msg01807.html -fsplit-stack should pass --wrap=pthread_create to linker for -fsplit-stack It is needed to initialize the stack guard. This fixes PR 20148. Patch by H.J Lu! llvm-svn: 258698
2016-01-23[CUDA] Use Triple::isNVPTX() instead of enumerating nvptx && nvptx64.Justin Lebar1-4/+2
Summary: No functional changes. Subscribers: tra, echristo, jhen, cfe-commits Differential Revision: http://reviews.llvm.org/D16495 llvm-svn: 258640
2016-01-21[driver] Enable some static analyzer "unix" checkers on Windows.Devin Coughlin1-2/+11
Many of the "unix" checkers are not actually unix-specific and would be valuable to run on Windows. This commit explicitly enables those checkers on Windows. A patch by Alexander Riccio! Differential Revision: http://reviews.llvm.org/D16245 llvm-svn: 258426
2016-01-19[CUDA] Handle -O options (more) correctly.Justin Lebar1-4/+29
Summary: Previously we'd crash the driver if you passed -O0. Now we try to handle all of clang's various optimization flags in a sane way. Reviewers: tra Subscribers: cfe-commits, echristo, jhen Differential Revision: http://reviews.llvm.org/D16307 llvm-svn: 258174
2016-01-16[Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.NAKAMURA Takumi1-1/+1
FIXME: Add more targets to use emutls into clang/test/Driver/emulated-tls.cpp. FIXME: Add cygwin tests into llvm/test/CodeGen/X86. Working in progress. llvm-svn: 257984
2016-01-16Introduce -fsanitize-stats flag.Peter Collingbourne1-10/+28
This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
2016-01-14[CUDA] Invoke ptxas and fatbinary during compilation.Justin Lebar1-0/+78
Summary: Previously we compiled CUDA device code to PTX assembly and embedded that asm as text in our host binary. Now we compile to PTX assembly and then invoke ptxas to assemble the PTX into a cubin file. We gather the ptx and cubin files for each of our --cuda-gpu-archs and combine them using fatbinary, and then embed that into the host binary. Adds two new command-line flags, -Xcuda_ptxas and -Xcuda_fatbinary, which pass args down to the external tools. Reviewers: tra, echristo Subscribers: cfe-commits, jhen Differential Revision: http://reviews.llvm.org/D16082 llvm-svn: 257809
2016-01-14[mips] Added support for -Wa,-mips32 and similar.Scott Egerton1-1/+25
Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15070 llvm-svn: 257762
2016-01-13Revert r257602 because it breaks integrated-as.s on mips hosts.Scott Egerton1-24/+1
llvm-svn: 257610
2016-01-13[mips] Added support for -Wa,-mips32 and similar.Scott Egerton1-1/+24
Reviewers: vkalintiris, dsanders Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D15070 llvm-svn: 257602
2016-01-13Generalize r256026 to apply to all MachO targets, not just Darwin targets.Bob Wilson1-2/+3
The PIC default is set for the MachO toolchain, not just the Darwin toolchain, so this treats those the same. The behavior with -static should be the same for all MachO targets. rdar://24152327 llvm-svn: 257556
2016-01-11Add an Action* member to InputInfo.Justin Lebar1-2/+2
Summary: The CUDA toolchain needs to know which Actions created which InputInfos, because it needs to attach GPU archs to the various InputInfos. Reviewers: echristo Subscribers: jfb, dschuff, jhen, tra, cfe-commits Differential Revision: http://reviews.llvm.org/D16078 llvm-svn: 257411