aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Action.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-10-28Fix MSVC "not all control paths return a value" warningSimon Pilgrim1-0/+2
Add unreachable after enum switch statement llvm-svn: 285390
2016-10-27[Driver][OpenMP] Add support to create jobs for unbundling actions.Samuel Antao1-5/+8
Summary: This patch adds the support to create jobs for the `OffloadBundlingAction` which will invoke the `clang-offload-bundler` tool to unbundle input files. Unlike other actions, unbundling actions have multiple outputs. Therefore, this patch adds the required changes to have a variant of `Tool::ConstructJob` with multiple outputs. The way the naming of the results is implemented is also slightly modified so that the same action can use a different offloading prefix for each use by the different offloading actions. With this patch, it is possible to compile a functional OpenMP binary with offloading support, even with separate compilation. Reviewers: echristo, tra, jlebar, ABataev, hfinkel Subscribers: mkuron, whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21857 llvm-svn: 285326
2016-10-27[Driver][OpenMP] Add support to create jobs for bundling actions.Samuel Antao1-0/+17
Summary: This patch adds the support to create a job for the `OffloadBundlingAction` which will invoke the `clang-offload-bundler` tool. Reviewers: echristo, tra, jlebar, ABataev, hfinkel Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21856 llvm-svn: 285325
2016-10-27[Driver][OpenMP] Update actions builder to create unbundling action when ↵Samuel Antao1-0/+10
necessary. Summary: Each time that offloading support is requested by the user and the input file is not a source file, an action `OffloadUnbundlingAction` is created to signal that the input file may contain bundles, so that the proper tool is then invoked to attempt to extract the components of the bundle. This patch adds the logic to create that action in offload action builder. The job creation for the new action will be proposed in a separate patch. Reviewers: echristo, tra, jlebar, ABataev, hfinkel Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21853 llvm-svn: 285324
2016-10-27[Driver][OpenMP] Update actions builder to create bundling action when ↵Samuel Antao1-0/+7
necessary. Summary: In order to save the user from dealing with multiple output files (for host and device) while using separate compilation, a new action `OffloadBundlingAction` is used when the last phase is not linking. This action will then result in a job that uses the proposed bundling tool to create a single preprocessed/IR/ASM/Object file from multiple ones. The job creation for the new action will be proposed in a separate patch. Reviewers: echristo, tra, jlebar, ABataev, hfinkel Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21852 llvm-svn: 285323
2016-10-27[Driver][OpenMP] Create tool chains for OpenMP offloading kind.Samuel Antao1-0/+4
Summary: This patch adds new logic to create the necessary tool chains to support offloading for OpenMP. The OpenMP related options are checked and the tool chains created accordingly. Diagnostics are emitted in case the options are illegal or express unknown targets. Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel Subscribers: whchung, mkuron, mehdi_amini, cfe-commits, Hahnfeld, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21843 llvm-svn: 285311
2016-10-07Rename variable to not use C++ reserved name (leading underscore + capital) ↵Mehdi Amini1-2/+2
(NFC) llvm-svn: 283616
2016-10-07Fix MSVC build: requires namespace in front of StringRef (NFC)Mehdi Amini1-1/+1
llvm-svn: 283615
2016-10-07Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)Mehdi Amini1-1/+1
llvm-svn: 283605
2016-07-16Remove extra semi-colon. Fixes warning and Werror bots.Eric Christopher1-1/+1
llvm-svn: 275655
2016-07-15Attempt to fix breakage caused by r275645 for Windows bots.Samuel Antao1-1/+1
llvm-svn: 275650
2016-07-15[CUDA][OpenMP] Create generic offload actionSamuel Antao1-9/+208
Summary: This patch replaces the CUDA specific action by a generic offload action. The offload action may have multiple dependences classier in “host” and “device”. The way this generic offloading action is used is very similar to what is done today by the CUDA implementation: it is used to set a specific toolchain and architecture to its dependences during the generation of jobs. This patch also proposes propagating the offloading information through the action graph so that that information can be easily retrieved at any time during the generation of commands. This allows e.g. the "clang tool” to evaluate whether CUDA should be supported for the device or host and ptas to easily retrieve the target architecture. This is an example of how the action graphs would look like (compilation of a single CUDA file with two GPU architectures) ``` 0: input, "cudatests.cu", cuda, (host-cuda) 1: preprocessor, {0}, cuda-cpp-output, (host-cuda) 2: compiler, {1}, ir, (host-cuda) 3: input, "cudatests.cu", cuda, (device-cuda, sm_35) 4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_35) 5: compiler, {4}, ir, (device-cuda, sm_35) 6: backend, {5}, assembler, (device-cuda, sm_35) 7: assembler, {6}, object, (device-cuda, sm_35) 8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {7}, object 9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_35)" {6}, assembler 10: input, "cudatests.cu", cuda, (device-cuda, sm_37) 11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_37) 12: compiler, {11}, ir, (device-cuda, sm_37) 13: backend, {12}, assembler, (device-cuda, sm_37) 14: assembler, {13}, object, (device-cuda, sm_37) 15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {14}, object 16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_37)" {13}, assembler 17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda) 18: offload, "host-cuda (powerpc64le-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir 19: backend, {18}, assembler 20: assembler, {19}, object 21: input, "cuda", object 22: input, "cudart", object 23: linker, {20, 21, 22}, image ``` The changes in this patch pass the existent regression tests (keeps the existent functionality) and resulting binaries execute correctly in a Power8+K40 machine. Reviewers: echristo, hfinkel, jlebar, ABataev, tra Subscribers: guansong, andreybokhanko, tcramer, mkuron, cfe-commits, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D18171 llvm-svn: 275645
2016-07-06[CUDA] Add missing namespace qualification on CudaArch in Action.cpp.Justin Lebar1-1/+1
Fix build breakage with MSVC. llvm-svn: 274689
2016-07-06[CUDA] Add utility functions for dealing with CUDA versions / architectures.Justin Lebar1-34/+2
Summary: Currently our handling of CUDA architectures is scattered all around clang. This patch centralizes it. A key advantage of this centralization is that you can now write a C++ switch on e.g. CudaArch and get a compile error if you don't handle one of the enum values. Reviewers: tra Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21867 llvm-svn: 274681
2016-07-06[CUDA] Add support for CUDA 8 and sm_60-62.Justin Lebar1-0/+3
Summary: Also add sm_32, which was missing. Reviewers: tra Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D21778 llvm-svn: 274680
2016-01-14[CUDA] Invoke ptxas and fatbinary during compilation.Justin Lebar1-1/+1
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-12[CUDA] Add explicit mapping from sm_XX to compute_YY.Justin Lebar1-2/+24
Summary: This is used by D16082 when it invokes fatbinary. Reviewers: tra Subscribers: cfe-commits, jhen, echristo Differential Revision: http://reviews.llvm.org/D16097 llvm-svn: 257530
2016-01-11[CUDA] Reject values for --cuda-gpu-arch that are not of the form /sm_\d+/.Justin Lebar1-1/+9
Reviewers: tra Subscribers: cfe-commits, jhen, echristo Differential Revision: http://reviews.llvm.org/D16079 llvm-svn: 257413
2016-01-11Move ownership of Action objects into Compilation.Justin Lebar1-53/+32
Summary: This makes constructing Action graphs which are DAGs much simpler. It also just simplifies in general the ownership semantics of Actions. Depends on D15910. Reviewers: echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D15911 llvm-svn: 257407
2015-11-17[CUDA] use -aux-triple to pass target triple of opposite side of compilationArtem Belevich1-7/+4
Clang needs to know target triple for both sides of compilation so that preprocessor macros and target builtins from both sides are available. This change augments Compilation class to carry information about toolchains used during different CUDA compilation passes and refactors BuildActions to use it when it constructs CUDA jobs. Removed DeviceTriple from CudaHostAction/CudaDeviceAction as it's no longer needed. Differential Revision: http://reviews.llvm.org/D13144 llvm-svn: 253385
2015-09-22Augmented CudaHostAction to carry device-side triple.Artem Belevich1-2/+4
Differential Revision: http://reviews.llvm.org/D12893 llvm-svn: 248298
2015-07-20[CUDA] Moved device-side triple calculation to buildCudaActions().Artem Belevich1-2/+3
Differential Revision: http://reviews.llvm.org/D11310 llvm-svn: 242718
2015-07-20Fixed style issues pointed out by Justin Bogner.Artem Belevich1-5/+4
Differential Revision: http://reviews.llvm.org/D11273 llvm-svn: 242698
2015-07-14Driver: Delete dead codeJustin Bogner1-7/+0
VerifyJobActions never have multiple inputs. llvm-svn: 242223
2015-07-13[cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich1-0/+21
CUDA code. NOTE: reverts r242077 to reinstate r242058, r242065, 242067 and includes fix for OS X test failures. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242085
2015-07-13This reverts commit r242058, r242065, r242067.Rafael Espindola1-21/+0
The tests were failing on OS X. Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code." Revert "Fixed regex to properly match '64' in the test case." Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least." llvm-svn: 242077
2015-07-13[cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich1-0/+21
CUDA code. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242058
2014-12-21Reapply "Change -save-temps to emit unoptimized bitcode files."Bob Wilson1-0/+7
This reapplies r224503 along with a fix for compiling Fortran by having the clang driver invoke gcc (see r224546, where it was reverted). I have added a testcase for that as well. Original commit message: It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224688
2014-12-18Revert "Change -save-temps to emit unoptimized bitcode files."Reid Kleckner1-7/+0
This reverts commit r224503. It broke compilation of fortran through the Clang driver. Previously `clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it tries to call `clang -cc1 t.f` which fails for obvious reasons. llvm-svn: 224546
2014-12-18Change -save-temps to emit unoptimized bitcode files.Bob Wilson1-0/+7
It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224503
2014-08-29unique_ptrify Driver Action handlingDavid Blaikie1-34/+33
It hits a limit when we reach ActionList, which is used for dynamic conditional ownership, so we lose type safety there. This did expose at least one caller "lying" about ownership (passing ownership to an Action, then updating the Action to specify that it doesn't actually own the thing that was passed) - changing this to unique_ptr just makes that oddity more obvious. llvm-svn: 216713
2014-02-06Move -verify-pch to use VerifyJobActionBen Langmuir1-3/+27
Use the verify hook rather than the compile hook to represent the -verify-pch action, and move the exising --verify-debug-info action into its own subclass of VerifyJobAction. Incidentally change the name printed by -ccc-print-phases for --verify-debug-info. llvm-svn: 200938
2013-06-14[Driver] Refactor clang driver to use LLVM's Option libraryReid Kleckner1-0/+1
The big changes are: - Deleting Driver/(Arg|Opt)* - Rewriting includes to llvm/Option/ and re-sorting - 'using namespace llvm::opt' in clang::driver - Fixing the autoconf build by adding option everywhere As discussed in the review, this change includes using directives in header files. I'll make follow up changes to remove those in favor of name specifiers. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D975 llvm-svn: 183989
2013-02-21Remove the SplitDebug action and replace with a set of commandsEric Christopher1-7/+0
in the compilation setup. Note that this doesn't currently work for -no-integrated-as. llvm-svn: 175813
2013-02-05Driver and option support for -gsplit-dwarf. This is a part ofEric Christopher1-0/+7
the DWARF5 split dwarf proposal. llvm-svn: 174349
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth1-1/+0
uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
2012-03-06Add new code migrator support for migrating existing Objective-C code to useTed Kremenek1-0/+7
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax. This introduces a new library, libEdit, which provides a new way to support migration of code that improves on the original ARC migrator. We now believe that most of its functionality can be refactored into the existing libraries, and thus this new library may shortly disappear. llvm-svn: 152141
2011-12-20Unweaken vtables as per ↵David Blaikie1-0/+24
http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
2011-09-23Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie1-1/+0
llvm-svn: 140407
2011-09-23More missing header inclusions from llvm_unreachable migration.David Blaikie1-0/+1
llvm-svn: 140369
2011-09-23Switch assert(0/false) llvm_unreachable.David Blaikie1-1/+1
llvm-svn: 140367
2011-08-23Add support for a verifier to the driver. Currently only verifies debugEric Christopher1-0/+5
output on darwin so is hard coded there. As a note this will need a little bit of refactoring in the class hierarchy to separate it out for different verifiers based on input type. Fixes rdar://8256258. llvm-svn: 138343
2010-12-31Remove stray emacs mode markers in all these files that was causing emacs toNick Lewycky1-1/+1
open them in fundamental-mode instead of c++-mode. Also twiddle whitespace for consistency in ToolChains.cpp. llvm-svn: 122646
2010-06-04Driver: Add an explicit dsymutil action.Daniel Dunbar1-0/+5
llvm-svn: 105474
2010-03-11Driver: Free Action objects.Daniel Dunbar1-2/+4
llvm-svn: 98263
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump1-6/+6
llvm-svn: 81346
2009-03-18Driver: I was too hasty in free'ing Actions, we sometimes shareDaniel Dunbar1-3/+2
Actions so a simple tree traversal isn't quite good enough. Leaving a FIXME for now. llvm-svn: 67161
2009-03-18Driver: Move actions into Compilation, and construct the compilationDaniel Dunbar1-1/+5
earlier. - This gives us a simple ownership model, and allows clients access to more information should they ever want it. - We now free Actions correctly. llvm-svn: 67158
2009-03-13Driver: Action vtables were still hungry.Daniel Dunbar1-1/+1
llvm-svn: 66980
2009-03-13Driver: Provide food and shelter for Action vtables.Daniel Dunbar1-0/+44
llvm-svn: 66978