Instead of passing in an unsigned value for the optimization level, use an enum,

which better identifies what the optimization is doing. And is more flexible for
future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2009-04-29 23:29:43 +00:00
parent b587f9662a
commit 98a366d547
81 changed files with 377 additions and 251 deletions
+1 -1
View File
@@ -383,7 +383,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
bool ForceInterpreter,
std::string *ErrorStr,
unsigned OptLevel) {
CodeGenOpt::Level OptLevel) {
ExecutionEngine *EE = 0;
// Make sure we can resolve symbols in the program as well. The zero arg
@@ -114,7 +114,7 @@ int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
int LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
LLVMModuleProviderRef MP,
unsigned OptLevel,
CodeGenOpt::Level OptLevel,
char **OutError) {
std::string Error;
if (ExecutionEngine *JIT = ExecutionEngine::createJIT(unwrap(MP), &Error, 0,
@@ -37,7 +37,7 @@ namespace llvm {
/// create - Create a new interpreter object. This can never fail.
///
ExecutionEngine *Interpreter::create(ModuleProvider *MP, std::string* ErrStr,
unsigned OptLevel /*unused*/) {
CodeGenOpt::Level OptLevel /*unused*/) {
// Tell this ModuleProvide to materialize and release the module
if (!MP->materializeModule(ErrStr))
// We got an error, just return 0
@@ -108,7 +108,7 @@ public:
/// create - Create an interpreter ExecutionEngine. This can never fail.
///
static ExecutionEngine *create(ModuleProvider *M, std::string *ErrorStr = 0,
unsigned OptLevel /*unused*/ = 3);
CodeGenOpt::Level = CodeGenOpt::Default);
/// run - Start execution with the specified function and arguments.
///
+5 -5
View File
@@ -196,7 +196,7 @@ void DarwinRegisterFrame(void* FrameBegin) {
ExecutionEngine *ExecutionEngine::createJIT(ModuleProvider *MP,
std::string *ErrorStr,
JITMemoryManager *JMM,
unsigned OptLevel) {
CodeGenOpt::Level OptLevel) {
ExecutionEngine *EE = JIT::createJIT(MP, ErrorStr, JMM, OptLevel);
if (!EE) return 0;
@@ -207,7 +207,7 @@ ExecutionEngine *ExecutionEngine::createJIT(ModuleProvider *MP,
}
JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji,
JITMemoryManager *JMM, unsigned OptLevel)
JITMemoryManager *JMM, CodeGenOpt::Level OptLevel)
: ExecutionEngine(MP), TM(tm), TJI(tji) {
setTargetData(TM.getTargetData());
@@ -272,7 +272,7 @@ void JIT::addModuleProvider(ModuleProvider *MP) {
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
if (TM.addPassesToEmitMachineCode(PM, *MCE, 3 /* OptLevel */)) {
if (TM.addPassesToEmitMachineCode(PM, *MCE, CodeGenOpt::Default)) {
cerr << "Target does not support machine code emission!\n";
abort();
}
@@ -305,7 +305,7 @@ Module *JIT::removeModuleProvider(ModuleProvider *MP, std::string *E) {
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
if (TM.addPassesToEmitMachineCode(PM, *MCE, 3 /* OptLevel */)) {
if (TM.addPassesToEmitMachineCode(PM, *MCE, CodeGenOpt::Default)) {
cerr << "Target does not support machine code emission!\n";
abort();
}
@@ -337,7 +337,7 @@ void JIT::deleteModuleProvider(ModuleProvider *MP, std::string *E) {
// Turn the machine code intermediate representation into bytes in memory
// that may be executed.
if (TM.addPassesToEmitMachineCode(PM, *MCE, 3 /* OptLevel */)) {
if (TM.addPassesToEmitMachineCode(PM, *MCE, CodeGenOpt::Default)) {
cerr << "Target does not support machine code emission!\n";
abort();
}
+5 -3
View File
@@ -55,7 +55,7 @@ class JIT : public ExecutionEngine {
JITState *jitstate;
JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji,
JITMemoryManager *JMM, unsigned OptLevel);
JITMemoryManager *JMM, CodeGenOpt::Level OptLevel);
public:
~JIT();
@@ -71,7 +71,8 @@ public:
/// for the current target. Otherwise, return null.
///
static ExecutionEngine *create(ModuleProvider *MP, std::string *Err,
unsigned OptLevel = 3) {
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default) {
return createJIT(MP, Err, 0, OptLevel);
}
@@ -148,7 +149,8 @@ public:
MachineCodeEmitter *getCodeEmitter() const { return MCE; }
static ExecutionEngine *createJIT(ModuleProvider *MP, std::string *Err,
JITMemoryManager *JMM, unsigned OptLevel);
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel);
private:
static MachineCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM);
+2 -1
View File
@@ -42,7 +42,8 @@ MAttrs("mattr",
/// available for the current target. Otherwise, return null.
///
ExecutionEngine *JIT::createJIT(ModuleProvider *MP, std::string *ErrorStr,
JITMemoryManager *JMM, unsigned OptLevel) {
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel) {
const TargetMachineRegistry::entry *TheArch = MArch;
if (TheArch == 0) {
std::string Error;