EngineBuilder: support for custom TargetOptions. Fixes the

ExceptionDemo example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Collingbourne
2011-12-07 23:58:57 +00:00
parent 0c89f7fda2
commit d40e103ea5
4 changed files with 19 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
namespace llvm {
@ -462,6 +463,7 @@ private:
CodeGenOpt::Level OptLevel;
JITMemoryManager *JMM;
bool AllocateGVsWithCode;
TargetOptions Options;
Reloc::Model RelocModel;
CodeModel::Model CMModel;
std::string MArch;
@ -475,6 +477,7 @@ private:
ErrorStr = NULL;
OptLevel = CodeGenOpt::Default;
JMM = NULL;
Options = TargetOptions();
AllocateGVsWithCode = false;
RelocModel = Reloc::Default;
CMModel = CodeModel::JITDefault;
@ -518,6 +521,13 @@ public:
return *this;
}
/// setTargetOptions - Set the target options that the ExecutionEngine
/// target is using. Defaults to TargetOptions().
EngineBuilder &setTargetOptions(const TargetOptions &Opts) {
Options = Opts;
return *this;
}
/// setRelocationModel - Set the relocation model that the ExecutionEngine
/// target is using. Defaults to target specific default "Reloc::Default".
EngineBuilder &setRelocationModel(Reloc::Model RM) {
@ -578,6 +588,7 @@ public:
StringRef MArch,
StringRef MCPU,
const SmallVectorImpl<std::string>& MAttrs,
const TargetOptions &Options,
Reloc::Model RM,
CodeModel::Model CM,
CodeGenOpt::Level OL,