aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-02-22 20:19:42 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-02-22 20:19:42 +0000
commit4c1aa866578f7a358407a22fe55b454f52a24325 (patch)
treef5c6f24b1fedfb42a7024b7ba4c0aa5f21280c8b /lib/Target/TargetMachine.cpp
parent0420f2aaf9551a10e2060d076de2fcdd7b316370 (diff)
downloadexternal_llvm-4c1aa866578f7a358407a22fe55b454f52a24325.zip
external_llvm-4c1aa866578f7a358407a22fe55b454f52a24325.tar.gz
external_llvm-4c1aa866578f7a358407a22fe55b454f52a24325.tar.bz2
- Added option -relocation-model to set relocation model. Valid values include static, pic,
dynamic-no-pic, and default. PPC and x86 default is dynamic-no-pic for Darwin, pic for others. - Removed options -enable-pic and -ppc-static. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26315 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetMachine.cpp')
-rw-r--r--lib/Target/TargetMachine.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index 82759e8..a2a4200 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/Support/CommandLine.h"
@@ -26,7 +27,7 @@ namespace llvm {
bool NoFramePointerElim;
bool NoExcessFPPrecision;
bool UnsafeFPMath;
- bool PICEnabled;
+ Reloc::Model RelocationModel;
};
namespace {
cl::opt<bool, true> PrintCode("print-machineinstrs",
@@ -48,11 +49,22 @@ namespace {
cl::desc("Enable optimizations that may decrease FP precision"),
cl::location(UnsafeFPMath),
cl::init(false));
- cl::opt<bool, true>
- EnablePIC("enable-pic",
- cl::desc("Enable generation of position independant code"),
- cl::location(PICEnabled),
- cl::init(false));
+ cl::opt<llvm::Reloc::Model, true>
+ DefRelocationModel(
+ "relocation-model",
+ cl::desc("Choose relocation model"),
+ cl::location(RelocationModel),
+ cl::init(Reloc::Default),
+ cl::values(
+ clEnumValN(Reloc::Default, "default",
+ "Target default relocation model"),
+ clEnumValN(Reloc::Static, "static",
+ "Non-relocatable code"),
+ clEnumValN(Reloc::PIC, "pic",
+ "Fully relocatable, position independent code"),
+ clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
+ "Relocatable external references, non-relocatable code"),
+ clEnumValEnd));
};
//---------------------------------------------------------------------------
@@ -87,3 +99,13 @@ TargetMachine::~TargetMachine() {
delete IL;
}
+/// getRelocationModel - Returns the code generation relocation model. The
+/// choices are static, PIC, and dynamic-no-pic, and target default.
+Reloc::Model TargetMachine::getRelocationModel() {
+ return RelocationModel;
+}
+
+/// setRelocationModel - Sets the code generation relocation model.
+void TargetMachine::setRelocationModel(Reloc::Model Model) {
+ RelocationModel = Model;
+}