diff options
author | David Woodhouse <dwmw2@infradead.org> | 2014-01-28 23:12:42 +0000 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2014-01-28 23:12:42 +0000 |
commit | 4396f5d9d2c215988f9368e94bfd5e1eb1cced58 (patch) | |
tree | 69cefbbe6b6011c4b0d2e19b6130854038ba24e3 /lib/Target/Sparc/SparcAsmPrinter.cpp | |
parent | ece65e3bf9c318c53b6ac0052e1b3762bd69524c (diff) |
Change MCStreamer EmitInstruction interface to take subtarget info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/SparcAsmPrinter.cpp')
-rw-r--r-- | lib/Target/Sparc/SparcAsmPrinter.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index a6f4dc2b0da..50c4fb7f031 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -107,48 +107,54 @@ static MCOperand createPCXRelExprOp(SparcMCExpr::VariantKind Kind, } static void EmitCall(MCStreamer &OutStreamer, - MCOperand &Callee) + MCOperand &Callee, + const MCSubtargetInfo &STI) { MCInst CallInst; CallInst.setOpcode(SP::CALL); CallInst.addOperand(Callee); - OutStreamer.EmitInstruction(CallInst); + OutStreamer.EmitInstruction(CallInst, STI); } static void EmitSETHI(MCStreamer &OutStreamer, - MCOperand &Imm, MCOperand &RD) + MCOperand &Imm, MCOperand &RD, + const MCSubtargetInfo &STI) { MCInst SETHIInst; SETHIInst.setOpcode(SP::SETHIi); SETHIInst.addOperand(RD); SETHIInst.addOperand(Imm); - OutStreamer.EmitInstruction(SETHIInst); + OutStreamer.EmitInstruction(SETHIInst, STI); } static void EmitBinary(MCStreamer &OutStreamer, unsigned Opcode, - MCOperand &RS1, MCOperand &Src2, MCOperand &RD) + MCOperand &RS1, MCOperand &Src2, MCOperand &RD, + const MCSubtargetInfo &STI) { MCInst Inst; Inst.setOpcode(Opcode); Inst.addOperand(RD); Inst.addOperand(RS1); Inst.addOperand(Src2); - OutStreamer.EmitInstruction(Inst); + OutStreamer.EmitInstruction(Inst, STI); } static void EmitOR(MCStreamer &OutStreamer, - MCOperand &RS1, MCOperand &Imm, MCOperand &RD) { - EmitBinary(OutStreamer, SP::ORri, RS1, Imm, RD); + MCOperand &RS1, MCOperand &Imm, MCOperand &RD, + const MCSubtargetInfo &STI) { + EmitBinary(OutStreamer, SP::ORri, RS1, Imm, RD, STI); } static void EmitADD(MCStreamer &OutStreamer, - MCOperand &RS1, MCOperand &RS2, MCOperand &RD) { - EmitBinary(OutStreamer, SP::ADDrr, RS1, RS2, RD); + MCOperand &RS1, MCOperand &RS2, MCOperand &RD, + const MCSubtargetInfo &STI) { + EmitBinary(OutStreamer, SP::ADDrr, RS1, RS2, RD, STI); } static void EmitSHL(MCStreamer &OutStreamer, - MCOperand &RS1, MCOperand &Imm, MCOperand &RD) { - EmitBinary(OutStreamer, SP::SLLri, RS1, Imm, RD); + MCOperand &RS1, MCOperand &Imm, MCOperand &RD, + const MCSubtargetInfo &STI) { + EmitBinary(OutStreamer, SP::SLLri, RS1, Imm, RD, STI); } @@ -156,15 +162,17 @@ static void EmitHiLo(MCStreamer &OutStreamer, MCSymbol *GOTSym, SparcMCExpr::VariantKind HiKind, SparcMCExpr::VariantKind LoKind, MCOperand &RD, - MCContext &OutContext) { + MCContext &OutContext, + const MCSubtargetInfo &STI) { MCOperand hi = createSparcMCOperand(HiKind, GOTSym, OutContext); MCOperand lo = createSparcMCOperand(LoKind, GOTSym, OutContext); - EmitSETHI(OutStreamer, hi, RD); - EmitOR(OutStreamer, RD, lo, RD); + EmitSETHI(OutStreamer, hi, RD, STI); + EmitOR(OutStreamer, RD, lo, RD, STI); } -void SparcAsmPrinter::LowerGETPCXAndEmitMCInsts(const MachineInstr *MI) +void SparcAsmPrinter::LowerGETPCXAndEmitMCInsts(const MachineInstr *MI, + const MCSubtargetInfo &STI) { MCSymbol *GOTLabel = OutContext.GetOrCreateSymbol(Twine("_GLOBAL_OFFSET_TABLE_")); @@ -232,18 +240,18 @@ void SparcAsmPrinter::LowerGETPCXAndEmitMCInsts(const MachineInstr *MI) OutStreamer.EmitLabel(StartLabel); MCOperand Callee = createPCXCallOP(EndLabel, OutContext); - EmitCall(OutStreamer, Callee); + EmitCall(OutStreamer, Callee, STI); OutStreamer.EmitLabel(SethiLabel); MCOperand hiImm = createPCXRelExprOp(SparcMCExpr::VK_Sparc_HI, GOTLabel, StartLabel, SethiLabel, OutContext); - EmitSETHI(OutStreamer, hiImm, MCRegOP); + EmitSETHI(OutStreamer, hiImm, MCRegOP, STI); OutStreamer.EmitLabel(EndLabel); MCOperand loImm = createPCXRelExprOp(SparcMCExpr::VK_Sparc_LO, GOTLabel, StartLabel, EndLabel, OutContext); - EmitOR(OutStreamer, MCRegOP, loImm, MCRegOP); - EmitADD(OutStreamer, MCRegOP, RegO7, MCRegOP); + EmitOR(OutStreamer, MCRegOP, loImm, MCRegOP, STI); + EmitADD(OutStreamer, MCRegOP, RegO7, MCRegOP, STI); } void SparcAsmPrinter::EmitInstruction(const MachineInstr *MI) @@ -255,7 +263,7 @@ void SparcAsmPrinter::EmitInstruction(const MachineInstr *MI) // FIXME: Debug Value. return; case SP::GETPCX: - LowerGETPCXAndEmitMCInsts(MI); + LowerGETPCXAndEmitMCInsts(MI, getSubtargetInfo()); return; } MachineBasicBlock::const_instr_iterator I = MI; @@ -263,7 +271,7 @@ void SparcAsmPrinter::EmitInstruction(const MachineInstr *MI) do { MCInst TmpInst; LowerSparcMachineInstrToMCInst(I, TmpInst, *this); - OutStreamer.EmitInstruction(TmpInst); + EmitToStreamer(OutStreamer, TmpInst); } while ((++I != E) && I->isInsideBundle()); // Delay slot check. } |