@@ -805,16 +805,17 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
805
805
SDOperand CPI = DAG.getTargetConstantPool (C, MVT::i32 , CP->getAlignment ());
806
806
SDOperand Zero = DAG.getConstant (0 , MVT::i32 );
807
807
808
- if (getTargetMachine ().getRelocationModel () == Reloc::Static) {
808
+ // If this is a non-darwin platform, we don't support non-static relo models
809
+ // yet.
810
+ if (getTargetMachine ().getRelocationModel () == Reloc::Static ||
811
+ !getTargetMachine ().getSubtarget <PPCSubtarget>().isDarwin ()) {
809
812
// Generate non-pic code that has direct accesses to the constant pool.
810
813
// The address of the global is just (hi(&g)+lo(&g)).
811
814
SDOperand Hi = DAG.getNode (PPCISD::Hi, MVT::i32 , CPI, Zero);
812
815
SDOperand Lo = DAG.getNode (PPCISD::Lo, MVT::i32 , CPI, Zero);
813
816
return DAG.getNode (ISD::ADD, MVT::i32 , Hi, Lo);
814
817
}
815
818
816
- // Only lower ConstantPool on Darwin.
817
- if (!getTargetMachine ().getSubtarget <PPCSubtarget>().isDarwin ()) break ;
818
819
SDOperand Hi = DAG.getNode (PPCISD::Hi, MVT::i32 , CPI, Zero);
819
820
if (getTargetMachine ().getRelocationModel () == Reloc::PIC) {
820
821
// With PIC, the first instruction is actually "GR+hi(&G)".
@@ -832,17 +833,17 @@ SDOperand PPCTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
832
833
SDOperand GA = DAG.getTargetGlobalAddress (GV, MVT::i32 , GSDN->getOffset ());
833
834
SDOperand Zero = DAG.getConstant (0 , MVT::i32 );
834
835
835
- if (getTargetMachine ().getRelocationModel () == Reloc::Static) {
836
+ // If this is a non-darwin platform, we don't support non-static relo models
837
+ // yet.
838
+ if (getTargetMachine ().getRelocationModel () == Reloc::Static ||
839
+ !getTargetMachine ().getSubtarget <PPCSubtarget>().isDarwin ()) {
836
840
// Generate non-pic code that has direct accesses to globals.
837
841
// The address of the global is just (hi(&g)+lo(&g)).
838
842
SDOperand Hi = DAG.getNode (PPCISD::Hi, MVT::i32 , GA, Zero);
839
843
SDOperand Lo = DAG.getNode (PPCISD::Lo, MVT::i32 , GA, Zero);
840
844
return DAG.getNode (ISD::ADD, MVT::i32 , Hi, Lo);
841
845
}
842
846
843
- // Only lower GlobalAddress on Darwin.
844
- if (!getTargetMachine ().getSubtarget <PPCSubtarget>().isDarwin ()) break ;
845
-
846
847
SDOperand Hi = DAG.getNode (PPCISD::Hi, MVT::i32 , GA, Zero);
847
848
if (getTargetMachine ().getRelocationModel () == Reloc::PIC) {
848
849
// With PIC, the first instruction is actually "GR+hi(&G)".
0 commit comments