summaryrefslogtreecommitdiffstats
path: root/include/clang/Driver/Compilation.h
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2016-10-27 17:39:44 +0000
committerSamuel Antao <sfantao@us.ibm.com>2016-10-27 17:39:44 +0000
commit1e029acdeb176aa3255c362f9f9ebe98ddb05134 (patch)
tree677164ddde6f99704ce41617ee548b54a5ce0bf5 /include/clang/Driver/Compilation.h
parent8b914baa74fb96372de859f90d108bb8535d121c (diff)
[Driver][OpenMP] Add logic for offloading-specific argument translation.
Summary: This patch includes support for argument translation that is specific of a given offloading kind. Additionally, it implements the translation for OpenMP device kinds in the gcc tool chain. With this patch, it is possible to compile a functional OpenMP application with offloading capabilities with no separate compilation. Reviewers: echristo, tra, jlebar, rsmith, ABataev, hfinkel Subscribers: whchung, mehdi_amini, cfe-commits, Hahnfeld, andreybokhanko, arpith-jacob, carlo.bertolli, caomhin Differential Revision: https://reviews.llvm.org/D21848 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Driver/Compilation.h')
-rw-r--r--include/clang/Driver/Compilation.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h
index fbc43089fc..114e0b33c7 100644
--- a/include/clang/Driver/Compilation.h
+++ b/include/clang/Driver/Compilation.h
@@ -67,11 +67,27 @@ class Compilation {
/// The root list of jobs.
JobList Jobs;
- /// Cache of translated arguments for a particular tool chain and bound
- /// architecture.
- llvm::DenseMap<std::pair<const ToolChain *, StringRef>,
- llvm::opt::DerivedArgList *>
- TCArgs;
+ /// Cache of translated arguments for a particular tool chain, bound
+ /// architecture, and device offload kind.
+ struct TCArgsKey final {
+ const ToolChain *TC = nullptr;
+ StringRef BoundArch;
+ Action::OffloadKind DeviceOffloadKind = Action::OFK_None;
+ bool operator<(const TCArgsKey &K) const {
+ if (TC < K.TC)
+ return true;
+ else if (TC == K.TC && BoundArch < K.BoundArch)
+ return true;
+ else if (TC == K.TC && BoundArch == K.BoundArch &&
+ DeviceOffloadKind < K.DeviceOffloadKind)
+ return true;
+ return false;
+ }
+ TCArgsKey(const ToolChain *TC, StringRef BoundArch,
+ Action::OffloadKind DeviceOffloadKind)
+ : TC(TC), BoundArch(BoundArch), DeviceOffloadKind(DeviceOffloadKind) {}
+ };
+ std::map<TCArgsKey, llvm::opt::DerivedArgList *> TCArgs;
/// Temporary files which should be removed on exit.
llvm::opt::ArgStringList TempFiles;
@@ -182,10 +198,15 @@ public:
/// getArgsForToolChain - Return the derived argument list for the
/// tool chain \p TC (or the default tool chain, if TC is not specified).
+ /// If a device offloading kind is specified, a translation specific for that
+ /// kind is performed, if any.
///
/// \param BoundArch - The bound architecture name, or 0.
- const llvm::opt::DerivedArgList &getArgsForToolChain(const ToolChain *TC,
- StringRef BoundArch);
+ /// \param DeviceOffloadKind - The offload device kind that should be used in
+ /// the translation, if any.
+ const llvm::opt::DerivedArgList &
+ getArgsForToolChain(const ToolChain *TC, StringRef BoundArch,
+ Action::OffloadKind DeviceOffloadKind);
/// addTempFile - Add a file to remove on exit, and returns its
/// argument.