Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 9aafb85

Browse files
committedAug 3, 2017
Delete Default and JITDefault code models
IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309911 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 65d41d8 commit 9aafb85

File tree

64 files changed

+420
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+420
-468
lines changed
 

‎include/llvm/CodeGen/CommandFlags.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ TMModel("thread-model",
7777
clEnumValN(ThreadModel::Single, "single",
7878
"Single thread model")));
7979

80-
cl::opt<llvm::CodeModel::Model>
81-
CMModel("code-model",
82-
cl::desc("Choose code model"),
83-
cl::init(CodeModel::Default),
84-
cl::values(clEnumValN(CodeModel::Default, "default",
85-
"Target default code model"),
86-
clEnumValN(CodeModel::Small, "small",
87-
"Small code model"),
88-
clEnumValN(CodeModel::Kernel, "kernel",
89-
"Kernel code model"),
90-
clEnumValN(CodeModel::Medium, "medium",
91-
"Medium code model"),
92-
clEnumValN(CodeModel::Large, "large",
93-
"Large code model")));
80+
cl::opt<llvm::CodeModel::Model> CMModel(
81+
"code-model", cl::desc("Choose code model"),
82+
cl::values(clEnumValN(CodeModel::Small, "small", "Small code model"),
83+
clEnumValN(CodeModel::Kernel, "kernel", "Kernel code model"),
84+
clEnumValN(CodeModel::Medium, "medium", "Medium code model"),
85+
clEnumValN(CodeModel::Large, "large", "Large code model")));
86+
87+
static inline Optional<CodeModel::Model> getCodeModel() {
88+
if (CMModel.getNumOccurrences()) {
89+
CodeModel::Model M = CMModel;
90+
return M;
91+
}
92+
return None;
93+
}
9494

9595
cl::opt<llvm::ExceptionHandling>
9696
ExceptionModel("exception-model",

‎include/llvm/ExecutionEngine/ExecutionEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ class EngineBuilder {
535535
std::shared_ptr<JITSymbolResolver> Resolver;
536536
TargetOptions Options;
537537
Optional<Reloc::Model> RelocModel;
538-
CodeModel::Model CMModel;
538+
Optional<CodeModel::Model> CMModel;
539539
std::string MArch;
540540
std::string MCPU;
541541
SmallVector<std::string, 4> MAttrs;

0 commit comments

Comments
 (0)