[PATCH] D52920: Introduce code_model macros
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 5 10:42:21 PDT 2018
MaskRay added inline comments.
================
Comment at: include/clang/Basic/TargetOptions.h:72
+ // The code model to be used as specified by the user. Corresponds to
+ // Model enum defined in include/llvm/Support/CodeGen.h, plus "default" for
+ // the case when the user has not explicitly specified a code model.
----------------
`Model` -> `CodeModel::Model` because there are `Model` in other namespaces
```
namespace Reloc {
enum Model { Static, PIC_, DynamicNoPIC, ROPI, RWPI, ROPI_RWPI };
}
// Code model types.
namespace CodeModel {
// Sync changes with CodeGenCWrappers.h.
enum Model { Tiny, Small, Kernel, Medium, Large };
}
```
================
Comment at: lib/Basic/Targets/X86.cpp:866
+ // For compatibility with gcc.
+ CodeModel = "small";
+ Builder.defineMacro("__code_model_" + CodeModel + "_");
----------------
The comment `// For compatibility with gcc.` needs changing.
Small code model is the fastest and expected to be suitable for vast majority of programs.
It is chosen here:
https://github.com/llvm-mirror/llvm/tree/master/lib/Target/X86/X86TargetMachine.cpp#L208
static CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM,
bool JIT, bool Is64Bit) {
if (CM)
return *CM;
if (JIT)
return Is64Bit ? CodeModel::Large : CodeModel::Small;
return CodeModel::Small;
}
Repository:
rC Clang
https://reviews.llvm.org/D52920
More information about the cfe-commits
mailing list