1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Move isPositionIndependent up to AsmPrinter.

Use it in ppc too.

llvm-svn: 273877
This commit is contained in:
Rafael Espindola 2016-06-27 14:19:45 +00:00
parent eb692daa85
commit 7c51ed0351
5 changed files with 9 additions and 8 deletions

View File

@ -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; }

View File

@ -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 {

View File

@ -614,10 +614,6 @@ static ARMBuildAttrs::CPUArch getArchForCPU(StringRef CPU,
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);

View File

@ -95,7 +95,6 @@ public:
bool lowerOperand(const MachineOperand &MO, MCOperand &MCOp);
private:
bool isPositionIndependent() const;
// Helpers for EmitStartOfAsmFile() and EmitEndOfAsmFile()
void emitAttributes();

View File

@ -459,7 +459,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
"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::EmitStartOfAsmFile(Module &M) {
}
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::EmitStartOfAsmFile(Module &M) {
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();