diff options
author | Ali Tamur <tamur@google.com> | 2018-10-08 22:25:20 +0000 |
---|---|---|
committer | Ali Tamur <tamur@google.com> | 2018-10-08 22:25:20 +0000 |
commit | cb44f60cfc0a401ca2c2da40dac0a19391f232a6 (patch) | |
tree | c2838fc9b83de607eace091a48eb8ee3c8182a0a /include/clang/Basic/TargetOptions.h | |
parent | 2bce94da8a363b4ffbd7ba2d6a1941942f9bac04 (diff) |
Introduce code_model macros
Summary:
gcc defines macros such as __code_model_small_ based on the user passed command line flag -mcmodel. clang accepts a flag with the same name and similar effects, but does not generate any macro that the user can use. This cl narrows the gap between gcc and clang behaviour.
However, achieving full compatibility with gcc is not trivial: The set of valid values for mcmodel in gcc and clang are not equal. Also, gcc defines different macros for different architectures. In this cl, we only tackle an easy part of the problem and define the macro only for x64 architecture. When the user does not specify a mcmodel, the macro for small code model is produced, as is the case with gcc.
Reviewers: compnerd, MaskRay
Reviewed By: MaskRay
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D52920
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetOptions.h')
-rw-r--r-- | include/clang/Basic/TargetOptions.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetOptions.h b/include/clang/Basic/TargetOptions.h index 31a6742879..7559e3169e 100644 --- a/include/clang/Basic/TargetOptions.h +++ b/include/clang/Basic/TargetOptions.h @@ -67,6 +67,12 @@ public: /// \brief If enabled, use 32-bit pointers for accessing const/local/shared /// address space. bool NVPTXUseShortPointers = false; + + // The code model to be used as specified by the user. Corresponds to + // CodeModel::Model enum defined in include/llvm/Support/CodeGen.h, plus + // "default" for the case when the user has not explicitly specified a + // code model. + std::string CodeModel; }; } // end namespace clang |