- 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
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
index 003d16c..154fe17 100644
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -396,7 +396,7 @@
     SDOperand CPI = DAG.getTargetConstantPool(C, MVT::i32, CP->getAlignment());
     SDOperand Zero = DAG.getConstant(0, MVT::i32);
     
-    if (PPCGenerateStaticCode) {
+    if (getTargetMachine().getRelocationModel() == Reloc::Static) {
       // Generate non-pic code that has direct accesses to the constant pool.
       // The address of the global is just (hi(&g)+lo(&g)).
       SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, CPI, Zero);
@@ -407,7 +407,7 @@
     // Only lower ConstantPool on Darwin.
     if (!getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) break;
     SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, CPI, Zero);
-    if (PICEnabled) {
+    if (getTargetMachine().getRelocationModel() == Reloc::PIC) {
       // With PIC, the first instruction is actually "GR+hi(&G)".
       Hi = DAG.getNode(ISD::ADD, MVT::i32,
                        DAG.getNode(PPCISD::GlobalBaseReg, MVT::i32), Hi);
@@ -423,7 +423,7 @@
     SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i32, GSDN->getOffset());
     SDOperand Zero = DAG.getConstant(0, MVT::i32);
 
-    if (PPCGenerateStaticCode) {
+    if (getTargetMachine().getRelocationModel() == Reloc::Static) {
       // Generate non-pic code that has direct accesses to globals.
       // The address of the global is just (hi(&g)+lo(&g)).
       SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, GA, Zero);
@@ -435,7 +435,7 @@
     if (!getTargetMachine().getSubtarget<PPCSubtarget>().isDarwin()) break;
     
     SDOperand Hi = DAG.getNode(PPCISD::Hi, MVT::i32, GA, Zero);
-    if (PICEnabled) {
+    if (getTargetMachine().getRelocationModel() == Reloc::PIC) {
       // With PIC, the first instruction is actually "GR+hi(&G)".
       Hi = DAG.getNode(ISD::ADD, MVT::i32,
                        DAG.getNode(PPCISD::GlobalBaseReg, MVT::i32), Hi);