[llvm] r273877 - Move isPositionIndependent up to AsmPrinter.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 07:19:46 PDT 2016
Author: rafael
Date: Mon Jun 27 09:19:45 2016
New Revision: 273877
URL: http://llvm.org/viewvc/llvm-project?rev=273877&view=rev
Log:
Move isPositionIndependent up to AsmPrinter.
Use it in ppc too.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=273877&r1=273876&r2=273877&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Jun 27 09:19:45 2016
@@ -148,6 +148,8 @@ public:
DwarfDebug *getDwarfDebug() { return DD; }
DwarfDebug *getDwarfDebug() const { return DD; }
+ bool isPositionIndependent() const;
+
/// Return true if assembly output should contain comments.
///
bool isVerbose() const { return VerboseAsm; }
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=273877&r1=273876&r2=273877&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jun 27 09:19:45 2016
@@ -124,6 +124,10 @@ AsmPrinter::~AsmPrinter() {
}
}
+bool AsmPrinter::isPositionIndependent() const {
+ return TM.getRelocationModel() == Reloc::PIC_;
+}
+
/// getFunctionNumber - Return a unique ID for the current function.
///
unsigned AsmPrinter::getFunctionNumber() const {
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=273877&r1=273876&r2=273877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jun 27 09:19:45 2016
@@ -614,10 +614,6 @@ 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);
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h?rev=273877&r1=273876&r2=273877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.h Mon Jun 27 09:19:45 2016
@@ -95,7 +95,6 @@ public:
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
private:
- bool isPositionIndependent() const;
// Helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
void emitAttributes();
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=273877&r1=273876&r2=273877&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Mon Jun 27 09:19:45 2016
@@ -459,7 +459,7 @@ void PPCAsmPrinter::EmitTlsCall(const Ma
"GETtls[ld]ADDR[32] must read GPR3");
if (!Subtarget->isPPC64() && !Subtarget->isDarwin() &&
- TM.getRelocationModel() == Reloc::PIC_)
+ isPositionIndependent())
Kind = MCSymbolRefExpr::VK_PLT;
const MCSymbolRefExpr *TlsRef =
MCSymbolRefExpr::create(TlsGetAddr, Kind, OutContext);
@@ -1027,7 +1027,7 @@ void PPCLinuxAsmPrinter::EmitStartOfAsmF
}
if (static_cast<const PPCTargetMachine &>(TM).isPPC64() ||
- TM.getRelocationModel() != Reloc::PIC_)
+ !isPositionIndependent())
return AsmPrinter::EmitStartOfAsmFile(M);
if (M.getPICLevel() == PICLevel::SmallPIC)
@@ -1056,7 +1056,7 @@ void PPCLinuxAsmPrinter::EmitStartOfAsmF
void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
// linux/ppc32 - Normal entry label.
if (!Subtarget->isPPC64() &&
- (TM.getRelocationModel() != Reloc::PIC_ ||
+ (!isPositionIndependent() ||
MF->getFunction()->getParent()->getPICLevel() == PICLevel::SmallPIC))
return AsmPrinter::EmitFunctionEntryLabel();
More information about the llvm-commits
mailing list