diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-18 11:58:50 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-18 11:58:50 +0000 |
| commit | 699281cce7adec546a52d986928513f91272e723 (patch) | |
| tree | 73a400a4fc089490aa3a8febf0f43a51ee77f81c /llvm/lib/Target | |
| parent | a854c0a0c3b0c295f7dcf3439e9655ad6f363f5a (diff) | |
| download | bcm5719-llvm-699281cce7adec546a52d986928513f91272e723.tar.gz bcm5719-llvm-699281cce7adec546a52d986928513f91272e723.zip | |
Don't pass a Reloc::Model to MC.
MC only needs to know if the output is PIC or not. It never has to
decide about creating GOTs and PLTs for example. The only thing that
MC itself uses this information for is expanding "macros" in sparc and
mips. The rest I am pretty sure could be moved to CodeGen.
This is a cleanup and isolates the code from future changes to
Reloc::Model.
llvm-svn: 269909
Diffstat (limited to 'llvm/lib/Target')
5 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 2c51a592eee..00e0b3b7e00 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -433,8 +433,7 @@ public: CurrentFn = nullptr; - IsPicEnabled = - (getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_); + IsPicEnabled = getContext().getObjectFileInfo()->isPositionIndependent(); IsCpRestoreSet = false; CpRestoreOffset = -1; diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index b24d7ae596f..bd614c1f737 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -668,7 +668,7 @@ MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S, // covers all cases so this statement covers most cases and direct object // emission must call setPic() once MCObjectFileInfo has been initialized. The // cases we don't handle here are covered by MipsAsmPrinter. - Pic = MCA.getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_; + Pic = MCA.getContext().getObjectFileInfo()->isPositionIndependent(); const FeatureBitset &Features = STI.getFeatureBits(); diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp index 24afb8863a6..2809f47e9fb 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -674,7 +674,7 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) { // MipsTargetStreamer has an initialization order problem when emitting an // object file directly (see MipsTargetELFStreamer for full details). Work // around it by re-initializing the PIC state here. - TS.setPic(OutContext.getObjectFileInfo()->getRelocM()); + TS.setPic(OutContext.getObjectFileInfo()->isPositionIndependent()); // Compute MIPS architecture attributes based on the default subtarget // that we'd have constructed. Module level directives aren't LTO diff --git a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp index 16638544335..b2003b8f101 100644 --- a/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp +++ b/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp @@ -899,8 +899,7 @@ SparcAsmParser::parseSparcAsmOperand(std::unique_ptr<SparcOperand> &Op, const MCExpr *Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext()); - if (isCall && - getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_) + if (isCall && getContext().getObjectFileInfo()->isPositionIndependent()) Res = SparcMCExpr::create(SparcMCExpr::VK_Sparc_WPLT30, Res, getContext()); Op = SparcOperand::CreateImm(Res, S, E); @@ -1221,7 +1220,7 @@ SparcAsmParser::adjustPICRelocation(SparcMCExpr::VariantKind VK, // actually a %pc10 or %pc22 relocation. Otherwise, they are interpreted // as %got10 or %got22 relocation. - if (getContext().getObjectFileInfo()->getRelocM() == Reloc::PIC_) { + if (getContext().getObjectFileInfo()->isPositionIndependent()) { switch(VK) { default: break; case SparcMCExpr::VK_Sparc_LO: diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index 4169237aa30..b2b69025851 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -43,7 +43,8 @@ using namespace llvm; void TargetLoweringObjectFile::Initialize(MCContext &ctx, const TargetMachine &TM) { Ctx = &ctx; - InitMCObjectFileInfo(TM.getTargetTriple(), TM.getRelocationModel(), + InitMCObjectFileInfo(TM.getTargetTriple(), + TM.getRelocationModel() == Reloc::PIC_, TM.getCodeModel(), *Ctx); } |

