diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-07-19 06:37:41 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-07-19 06:37:41 +0000 |
commit | 2860e30d837ac361c126d4350b5d74f956160eba (patch) | |
tree | 855f56a13c9164c14ef79fd14d72d1a01fd5c105 /lib/CodeGen/BackendUtil.cpp | |
parent | cb2a07e33789df99d28c3b9cd0770b4e3a8f31b5 (diff) |
Match createTargetMachine API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135469 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | lib/CodeGen/BackendUtil.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 85f42db81f..d7326cdc7e 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -237,16 +237,6 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action, TargetMachine::setDataSections (CodeGenOpts.DataSections); // FIXME: Parse this earlier. - if (CodeGenOpts.RelocationModel == "static") { - TargetMachine::setRelocationModel(llvm::Reloc::Static); - } else if (CodeGenOpts.RelocationModel == "pic") { - TargetMachine::setRelocationModel(llvm::Reloc::PIC_); - } else { - assert(CodeGenOpts.RelocationModel == "dynamic-no-pic" && - "Invalid PIC model!"); - TargetMachine::setRelocationModel(llvm::Reloc::DynamicNoPIC); - } - // FIXME: Parse this earlier. if (CodeGenOpts.CodeModel == "small") { TargetMachine::setCodeModel(llvm::CodeModel::Small); } else if (CodeGenOpts.CodeModel == "kernel") { @@ -287,8 +277,20 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action, Features.AddFeature(*it); FeaturesStr = Features.getString(); } + + llvm::Reloc::Model RM = llvm::Reloc::Default; + if (CodeGenOpts.RelocationModel == "static") { + RM = llvm::Reloc::Static; + } else if (CodeGenOpts.RelocationModel == "pic") { + RM = llvm::Reloc::PIC_; + } else { + assert(CodeGenOpts.RelocationModel == "dynamic-no-pic" && + "Invalid PIC model!"); + RM = llvm::Reloc::DynamicNoPIC; + } + TargetMachine *TM = TheTarget->createTargetMachine(Triple, TargetOpts.CPU, - FeaturesStr); + FeaturesStr, RM); if (CodeGenOpts.RelaxAll) TM->setMCRelaxAll(true); |