diff options
author | Samuel Antao <sfantao@us.ibm.com> | 2016-10-27 18:14:55 +0000 |
---|---|---|
committer | Samuel Antao <sfantao@us.ibm.com> | 2016-10-27 18:14:55 +0000 |
commit | af2b45315740537d34d6ad9ed1fc56afa2a9df33 (patch) | |
tree | 582f8abfd65cba5e589b2ec6109cad43ba9d6319 /lib/Driver/Action.cpp | |
parent | e9c115b33b48afa24a5e3700cdf27460d1c77262 (diff) |
[Driver][OpenMP] Add support to create jobs for unbundling actions.
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285326 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Action.cpp')
-rw-r--r-- | lib/Driver/Action.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Driver/Action.cpp b/lib/Driver/Action.cpp index ad6fb71810..4e0c224c3b 100644 --- a/lib/Driver/Action.cpp +++ b/lib/Driver/Action.cpp @@ -115,15 +115,18 @@ std::string Action::getOffloadingKindPrefix() const { return Res; } +/// Return a string that can be used as prefix in order to generate unique files +/// for each offloading kind. std::string -Action::getOffloadingFileNamePrefix(llvm::StringRef NormalizedTriple) const { - // A file prefix is only generated for device actions and consists of the - // offload kind and triple. - if (!OffloadingDeviceKind) +Action::GetOffloadingFileNamePrefix(OffloadKind Kind, + llvm::StringRef NormalizedTriple, + bool CreatePrefixForHost) { + // Don't generate prefix for host actions unless required. + if (!CreatePrefixForHost && (Kind == OFK_None || Kind == OFK_Host)) return ""; std::string Res("-"); - Res += getOffloadingKindPrefix(); + Res += GetOffloadKindName(Kind); Res += "-"; Res += NormalizedTriple; return Res; |