From cb44f60cfc0a401ca2c2da40dac0a19391f232a6 Mon Sep 17 00:00:00 2001 From: Ali Tamur Date: Mon, 8 Oct 2018 22:25:20 +0000 Subject: 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 --- include/clang/Basic/TargetOptions.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/clang/Basic/TargetOptions.h') 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 -- cgit v1.2.3