summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/Builtins.h
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2015-09-22 17:23:22 +0000
committerArtem Belevich <tra@google.com>2015-09-22 17:23:22 +0000
commit675c6b4346cdde41712c89a9c80cb4d1ffb7267e (patch)
treecb09d08fdedf679b21887b3ec10d8a3e931aa0d2 /include/clang/Basic/Builtins.h
parent20db8d08e59176291d746d4f65cedf639d308594 (diff)
[CUDA] Allow parsing of host and device code simultaneously.
* adds -aux-triple option to specify target triple * propagates aux target info to AST context and Preprocessor * pulls in target specific preprocessor macros. * pulls in target-specific builtins from aux target. * sets appropriate host or device attribute on builtins. Differential Revision: http://reviews.llvm.org/D12917 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Builtins.h')
-rw-r--r--include/clang/Basic/Builtins.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h
index 87e2ac7079..27dc615400 100644
--- a/include/clang/Basic/Builtins.h
+++ b/include/clang/Basic/Builtins.h
@@ -56,15 +56,23 @@ struct Info {
/// \brief Holds information about both target-independent and
/// target-specific builtins, allowing easy queries by clients.
+///
+/// Builtins from an optional auxiliary target are stored in
+/// AuxTSRecords. Their IDs are shifted up by NumTSRecords and need to
+/// be translated back with getAuxBuiltinID() before use.
class Context {
const Info *TSRecords;
+ const Info *AuxTSRecords;
unsigned NumTSRecords;
+ unsigned NumAuxTSRecords;
+
public:
Context();
/// \brief Perform target-specific initialization
- void initializeTarget(const TargetInfo &Target);
-
+ /// \param AuxTarget Target info to incorporate builtins from. May be nullptr.
+ void InitializeTarget(const TargetInfo &Target, const TargetInfo *AuxTarget);
+
/// \brief Mark the identifiers for all the builtins with their
/// appropriate builtin ID # and mark any non-portable builtin identifiers as
/// such.
@@ -176,6 +184,15 @@ public:
return getRecord(ID).Features;
}
+ /// \brief Return true if builtin ID belongs to AuxTarget.
+ bool isAuxBuiltinID(unsigned ID) const {
+ return ID >= (Builtin::FirstTSBuiltin + NumTSRecords);
+ }
+
+ /// Return real buitin ID (i.e. ID it would have furing compilation
+ /// for AuxTarget).
+ unsigned getAuxBuiltinID(unsigned ID) const { return ID - NumTSRecords; }
+
private:
const Info &getRecord(unsigned ID) const;