llvm.org GIT mirror llvm / 88b5aca
Add ability to set code model within the execution engine builders and creation interfaces. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89151 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 10 years ago
4 changed file(s) with 29 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
112112 std::string *ErrorStr,
113113 JITMemoryManager *JMM,
114114 CodeGenOpt::Level OptLevel,
115 bool GVsWithCode);
115 bool GVsWithCode,
116 CodeModel::Model CMM);
116117 static ExecutionEngine *(*InterpCtor)(ModuleProvider *MP,
117118 std::string *ErrorStr);
118119
172173 JITMemoryManager *JMM = 0,
173174 CodeGenOpt::Level OptLevel =
174175 CodeGenOpt::Default,
175 bool GVsWithCode = true);
176 bool GVsWithCode = true,
177 CodeModel::Model CMM =
178 CodeModel::Default);
176179
177180 /// addModuleProvider - Add a ModuleProvider to the list of modules that we
178181 /// can JIT from. Note that this takes ownership of the ModuleProvider: when
424427 CodeGenOpt::Level OptLevel;
425428 JITMemoryManager *JMM;
426429 bool AllocateGVsWithCode;
430 CodeModel::Model CMModel;
427431
428432 /// InitEngine - Does the common initialization of default options.
429433 ///
433437 OptLevel = CodeGenOpt::Default;
434438 JMM = NULL;
435439 AllocateGVsWithCode = false;
440 CMModel = CodeModel::Default;
436441 }
437442
438443 public:
474479 /// defaults to CodeGenOpt::Default.
475480 EngineBuilder &setOptLevel(CodeGenOpt::Level l) {
476481 OptLevel = l;
482 return *this;
483 }
484
485 /// setCodeModel - Set the CodeModel that the ExecutionEngine target
486 /// data is using. Defaults to target specific default "CodeModel::Default".
487 EngineBuilder &setCodeModel(CodeModel::Model M) {
488 CMModel = M;
477489 return *this;
478490 }
479491
3939 std::string *ErrorStr,
4040 JITMemoryManager *JMM,
4141 CodeGenOpt::Level OptLevel,
42 bool GVsWithCode) = 0;
42 bool GVsWithCode,
43 CodeModel::Model CMM) = 0;
4344 ExecutionEngine *(*ExecutionEngine::InterpCtor)(ModuleProvider *MP,
4445 std::string *ErrorStr) = 0;
4546 ExecutionEngine::EERegisterFn ExecutionEngine::ExceptionTableRegister = 0;
443444 if (ExecutionEngine::JITCtor) {
444445 ExecutionEngine *EE =
445446 ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
446 AllocateGVsWithCode);
447 AllocateGVsWithCode, CMModel);
447448 if (EE) return EE;
448449 }
449450 }
197197 std::string *ErrorStr,
198198 JITMemoryManager *JMM,
199199 CodeGenOpt::Level OptLevel,
200 bool GVsWithCode) {
201 return JIT::createJIT(MP, ErrorStr, JMM, OptLevel, GVsWithCode);
200 bool GVsWithCode,
201 CodeModel::Model CMM) {
202 return JIT::createJIT(MP, ErrorStr, JMM, OptLevel, GVsWithCode, CMM);
202203 }
203204
204205 ExecutionEngine *JIT::createJIT(ModuleProvider *MP,
205206 std::string *ErrorStr,
206207 JITMemoryManager *JMM,
207208 CodeGenOpt::Level OptLevel,
208 bool GVsWithCode) {
209 bool GVsWithCode,
210 CodeModel::Model CMM) {
209211 // Make sure we can resolve symbols in the program as well. The zero arg
210212 // to the function tells DynamicLibrary to load the program, not a library.
211213 if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
214216 // Pick a target either via -march or by guessing the native arch.
215217 TargetMachine *TM = JIT::selectTarget(MP, ErrorStr);
216218 if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0;
219 TM->setCodeModel(CMM);
217220
218221 // If the target supports JIT code generation, create a the JIT.
219222 if (TargetJITInfo *TJ = TM->getJITInfo()) {
8484 JITMemoryManager *JMM,
8585 CodeGenOpt::Level OptLevel =
8686 CodeGenOpt::Default,
87 bool GVsWithCode = true) {
88 return ExecutionEngine::createJIT(MP, Err, JMM, OptLevel, GVsWithCode);
87 bool GVsWithCode = true,
88 CodeModel::Model CMM = CodeModel::Default) {
89 return ExecutionEngine::createJIT(MP, Err, JMM, OptLevel, GVsWithCode,
90 CMM);
8991 }
9092
9193 virtual void addModuleProvider(ModuleProvider *MP);
174176 std::string *ErrorStr,
175177 JITMemoryManager *JMM,
176178 CodeGenOpt::Level OptLevel,
177 bool GVsWithCode);
179 bool GVsWithCode,
180 CodeModel::Model CMM);
178181
179182 // Run the JIT on F and return information about the generated code
180183 void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);