]> granicus.if.org Git - llvm/commitdiff
Don't pass a Reloc::Model to GVIsIndirectSymbol.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 Jun 2016 15:38:13 +0000 (15:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 28 Jun 2016 15:38:13 +0000 (15:38 +0000)
It already has access to it.

While at it, rename it to isGVIndirectSymbol.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274023 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMFastISel.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMInstrInfo.cpp
lib/Target/ARM/ARMSubtarget.cpp
lib/Target/ARM/ARMSubtarget.h

index 3cf405eedb0453505b82eaae34555e0794641ebf..8efd937b7ee310ad7a5e0602d61831ca9539d6fc 100644 (file)
@@ -910,8 +910,8 @@ getModifierVariantKind(ARMCP::ARMCPModifier Modifier) {
 MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV,
                                         unsigned char TargetFlags) {
   if (Subtarget->isTargetMachO()) {
-    bool IsIndirect = (TargetFlags & ARMII::MO_NONLAZY) &&
-      Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
+    bool IsIndirect =
+        (TargetFlags & ARMII::MO_NONLAZY) && Subtarget->isGVIndirectSymbol(GV);
 
     if (!IsIndirect)
       return getSymbol(GV);
index 07582a3aa0871af881a174c572cf991f1770de07..3fc9030c764bf6787a8fa14dd2035f2f605bfad4 100644 (file)
@@ -4109,8 +4109,6 @@ void ARMBaseInstrInfo::expandLoadStackGuardBase(MachineBasicBlock::iterator MI,
                                                 unsigned LoadImmOpc,
                                                 unsigned LoadOpc) const {
   MachineBasicBlock &MBB = *MI->getParent();
-  const TargetMachine &TM = MBB.getParent()->getTarget();
-  Reloc::Model RM = TM.getRelocationModel();
   DebugLoc DL = MI->getDebugLoc();
   unsigned Reg = MI->getOperand(0).getReg();
   const GlobalValue *GV =
@@ -4120,7 +4118,7 @@ void ARMBaseInstrInfo::expandLoadStackGuardBase(MachineBasicBlock::iterator MI,
   BuildMI(MBB, MI, DL, get(LoadImmOpc), Reg)
       .addGlobalAddress(GV, 0, ARMII::MO_NONLAZY);
 
-  if (Subtarget.GVIsIndirectSymbol(GV, RM)) {
+  if (Subtarget.isGVIndirectSymbol(GV)) {
     MIB = BuildMI(MBB, MI, DL, get(LoadOpc), Reg);
     MIB.addReg(Reg, RegState::Kill).addImm(0);
     unsigned Flag = MachineMemOperand::MOLoad | MachineMemOperand::MOInvariant;
index dc6782f9a3a8d9106dfacaa1c5326ee3b42306c2..b62f272ded84bc3592608b803ae7b5f0c08736a7 100644 (file)
@@ -547,8 +547,7 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, MVT VT) {
   // For now 32-bit only.
   if (VT != MVT::i32 || GV->isThreadLocal()) return 0;
 
-  Reloc::Model RelocM = TM.getRelocationModel();
-  bool IsIndirect = Subtarget->GVIsIndirectSymbol(GV, RelocM);
+  bool IsIndirect = Subtarget->isGVIndirectSymbol(GV);
   const TargetRegisterClass *RC = isThumb2 ? &ARM::rGPRRegClass
                                            : &ARM::GPRRegClass;
   unsigned DestReg = createResultReg(RC);
index 2641d106803335eef62cf16d68d802124279a91b..f5416a42bfee1ede6c7d7a9402db34d700772ade 100644 (file)
@@ -2860,8 +2860,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
   SDValue G = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0, ARMII::MO_NONLAZY);
   SDValue Result = DAG.getNode(Wrapper, dl, PtrVT, G);
 
-  Reloc::Model RelocM = getTargetMachine().getRelocationModel();
-  if (Subtarget->GVIsIndirectSymbol(GV, RelocM))
+  if (Subtarget->isGVIndirectSymbol(GV))
     Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Result,
                          MachinePointerInfo::getGOT(DAG.getMachineFunction()),
                          false, false, false, 0);
index e5796b0968fee653b8f11c6f4802490ab92672d0..7bb015c62b306feb126f441f01b5b345ae8e3191 100644 (file)
@@ -94,7 +94,6 @@ void ARMInstrInfo::expandLoadStackGuard(MachineBasicBlock::iterator MI) const {
   MachineFunction &MF = *MI->getParent()->getParent();
   const ARMSubtarget &Subtarget = MF.getSubtarget<ARMSubtarget>();
   const TargetMachine &TM = MF.getTarget();
-  Reloc::Model RM = TM.getRelocationModel();
 
   if (!Subtarget.useMovt(MF)) {
     if (TM.isPositionIndependent())
@@ -112,7 +111,7 @@ void ARMInstrInfo::expandLoadStackGuard(MachineBasicBlock::iterator MI) const {
   const GlobalValue *GV =
       cast<GlobalValue>((*MI->memoperands_begin())->getValue());
 
-  if (!Subtarget.GVIsIndirectSymbol(GV, RM)) {
+  if (!Subtarget.isGVIndirectSymbol(GV)) {
     expandLoadStackGuardBase(MI, ARM::MOV_ga_pcrel, ARM::LDRi12);
     return;
   }
index 719ac77e8dc236daaf5d59745ed338b2739ddf0b..503df694fcddbcbf8380b7573b4827a57de7b1e2 100644 (file)
@@ -260,17 +260,14 @@ bool ARMSubtarget::isAAPCS16_ABI() const {
   return TM.TargetABI == ARMBaseTargetMachine::ARM_ABI_AAPCS16;
 }
 
-/// true if the GV will be accessed via an indirect symbol.
-bool
-ARMSubtarget::GVIsIndirectSymbol(const GlobalValue *GV,
-                                 Reloc::Model RelocM) const {
+bool ARMSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
   if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
     return true;
 
   // 32 bit macho has no relocation for a-b if a is undefined, even if b is in
   // the section that is being relocated. This means we have to use o load even
   // for GVs that are known to be local to the dso.
-  if (isTargetDarwin() && RelocM == Reloc::PIC_ &&
+  if (isTargetDarwin() && TM.isPositionIndependent() &&
       (GV->isDeclarationForLinker() || GV->hasCommonLinkage()))
     return true;
 
index 56d07201a009cab54634193e5f7cdf3ccc2424f7..30b11f4486f2a16556cea4253348a20d8d8584f2 100644 (file)
@@ -582,9 +582,8 @@ public:
     return PreISelOperandLatencyAdjustment;
   }
 
-  /// GVIsIndirectSymbol - true if the GV will be accessed via an indirect
-  /// symbol.
-  bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const;
+  /// True if the GV will be accessed via an indirect symbol.
+  bool isGVIndirectSymbol(const GlobalValue *GV) const;
 
   /// True if fast-isel is used.
   bool useFastISel() const;