[llvm] r273261 - Define a isPositionIndependent helper for ARMAsmPrinter. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 07:21:55 PDT 2016
Author: rafael
Date: Tue Jun 21 09:21:53 2016
New Revision: 273261
URL: http://llvm.org/viewvc/llvm-project?rev=273261&view=rev
Log:
Define a isPositionIndependent helper for ARMAsmPrinter. NFC.
Modified:
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=273261&r1=273260&r2=273261&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Tue Jun 21 09:21:53 2016
@@ -613,6 +613,10 @@ static ARMBuildAttrs::CPUArch getArchFor
return ARMBuildAttrs::v4;
}
+bool ARMAsmPrinter::isPositionIndependent() const {
+ return TM.getRelocationModel() == Reloc::PIC_;
+}
+
void ARMAsmPrinter::emitAttributes() {
MCTargetStreamer &TS = *OutStreamer->getTargetStreamer();
ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
@@ -724,7 +728,7 @@ void ARMAsmPrinter::emitAttributes() {
ATS.emitFPU(ARM::FK_VFPV2);
}
- if (TM.getRelocationModel() == Reloc::PIC_) {
+ if (isPositionIndependent()) {
// PIC specific attributes.
ATS.emitAttribute(ARMBuildAttrs::ABI_PCS_RW_data,
ARMBuildAttrs::AddressRWPCRel);
@@ -1036,7 +1040,7 @@ void ARMAsmPrinter::EmitJumpTableAddrs(c
// .word (LBB1 - LJTI_0_0)
const MCExpr *Expr = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext);
- if (TM.getRelocationModel() == Reloc::PIC_)
+ if (isPositionIndependent())
Expr = MCBinaryExpr::createSub(Expr, MCSymbolRefExpr::create(JTISymbol,
OutContext),
OutContext);
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h?rev=273261&r1=273260&r2=273261&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h Tue Jun 21 09:21:53 2016
@@ -95,6 +95,8 @@ public:
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
private:
+ bool isPositionIndependent() const;
+
// Helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
void emitAttributes();
More information about the llvm-commits
mailing list