Skip to content

Commit 5b4bdbf

Browse files
committed
Move isROPI and isRWPI back to Subtarget and add a FIXME about them being function attributes
1 parent 8bdb32e commit 5b4bdbf

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

llvm/lib/Target/ARM/ARMAsmPrinter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,14 +679,14 @@ void ARMAsmPrinter::emitAttributes() {
679679
if (isPositionIndependent()) {
680680
ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_RW_data,
681681
ARMBuildAttrs::AddressRWPCRel);
682-
} else if (getTM().isRWPI()) {
682+
} else if (STI.isRWPI()) {
683683
// RWPI specific attributes.
684684
ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_RW_data,
685685
ARMBuildAttrs::AddressRWSBRel);
686686
}
687687

688688
// RO data addressing.
689-
if (isPositionIndependent() || getTM().isROPI()) {
689+
if (isPositionIndependent() || STI.isROPI()) {
690690
ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_RO_data,
691691
ARMBuildAttrs::AddressROPCRel);
692692
}
@@ -832,7 +832,7 @@ void ARMAsmPrinter::emitAttributes() {
832832
}
833833

834834
// We currently do not support using R9 as the TLS pointer.
835-
if (getTM().isRWPI())
835+
if (STI.isRWPI())
836836
ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_R9_use,
837837
ARMBuildAttrs::R9IsSB);
838838
else if (STI.isR9Reserved())
@@ -1047,7 +1047,8 @@ void ARMAsmPrinter::emitJumpTableAddrs(const MachineInstr *MI) {
10471047
// .word (LBB1 - LJTI_0_0)
10481048
const MCExpr *Expr = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
10491049

1050-
if (isPositionIndependent() || getTM().isROPI())
1050+
const ARMSubtarget &STI = MF->getSubtarget<ARMSubtarget>();
1051+
if (isPositionIndependent() || STI.isROPI())
10511052
Expr = MCBinaryExpr::createSub(Expr, MCSymbolRefExpr::create(JTISymbol,
10521053
OutContext),
10531054
OutContext);

llvm/lib/Target/ARM/ARMSubtarget.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,19 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
308308
}
309309
}
310310

311-
bool ARMSubtarget::isROPI() const { return TM.isROPI(); }
312-
bool ARMSubtarget::isRWPI() const { return TM.isRWPI(); }
311+
bool ARMSubtarget::isROPI() const {
312+
// FIXME: This should ideally come from a function attribute, to work
313+
// correctly with LTO.
314+
return TM.getRelocationModel() == Reloc::ROPI ||
315+
TM.getRelocationModel() == Reloc::ROPI_RWPI;
316+
}
317+
318+
bool ARMSubtarget::isRWPI() const {
319+
// FIXME: This should ideally come from a function attribute, to work
320+
// correctly with LTO.
321+
return TM.getRelocationModel() == Reloc::RWPI ||
322+
TM.getRelocationModel() == Reloc::ROPI_RWPI;
323+
}
313324

314325
bool ARMSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
315326
return TM.isGVIndirectSymbol(GV);

llvm/lib/Target/ARM/ARMTargetMachine.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,6 @@ class ARMBaseTargetMachine : public CodeGenTargetMachineImpl {
8686
TargetTriple.isOSWindows() || TargetABI == ARM::ARM_ABI_AAPCS16;
8787
}
8888

89-
bool isROPI() const {
90-
return getRelocationModel() == Reloc::ROPI ||
91-
getRelocationModel() == Reloc::ROPI_RWPI;
92-
}
93-
bool isRWPI() const {
94-
return getRelocationModel() == Reloc::RWPI ||
95-
getRelocationModel() == Reloc::ROPI_RWPI;
96-
}
97-
9889
bool targetSchedulesPostRAScheduling() const override { return true; };
9990

10091
MachineFunctionInfo *

0 commit comments

Comments
 (0)