diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-05-26 18:15:06 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-26 18:15:06 +0000 |
| commit | 7c8bd0fc986002d2dec65d7efbfdea2d506e8806 (patch) | |
| tree | 823e8d98d01c8eb48fbf0c6bd363a37b6619358c /llvm | |
| parent | 341d78348844018a27e1f61ae095a20e7a847205 (diff) | |
| download | bcm5719-llvm-7c8bd0fc986002d2dec65d7efbfdea2d506e8806.tar.gz bcm5719-llvm-7c8bd0fc986002d2dec65d7efbfdea2d506e8806.zip | |
MC: Change RelaxInstruction to only take the input and output instructions.
llvm-svn: 104713
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Target/TargetAsmBackend.h | 10 | ||||
| -rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86AsmBackend.cpp | 13 |
3 files changed, 13 insertions, 12 deletions
diff --git a/llvm/include/llvm/Target/TargetAsmBackend.h b/llvm/include/llvm/Target/TargetAsmBackend.h index 7a1689d0873..979595ad4f4 100644 --- a/llvm/include/llvm/Target/TargetAsmBackend.h +++ b/llvm/include/llvm/Target/TargetAsmBackend.h @@ -16,7 +16,6 @@ namespace llvm { class MCDataFragment; class MCFixup; class MCInst; -class MCInstFragment; class MCObjectWriter; class MCSection; template<typename T> @@ -111,13 +110,16 @@ public: /// MayNeedRelaxation - Check whether the given instruction may need /// relaxation. /// - /// \arg Inst - The instruction to test. + /// \param Inst - The instruction to test. virtual bool MayNeedRelaxation(const MCInst &Inst) const = 0; /// RelaxInstruction - Relax the instruction in the given fragment to the next /// wider instruction. - virtual void RelaxInstruction(const MCInstFragment *IF, - MCInst &Res) const = 0; + /// + /// \param Inst - The instruction to relax, which may be the same as the + /// output. + /// \parm Res [output] - On return, the relaxed instruction. + virtual void RelaxInstruction(const MCInst &Inst, MCInst &Res) const = 0; /// WriteNopData - Write an (optimal) nop sequence of Count bytes to the given /// output. If the target cannot generate such a sequence, it should return an diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 703f727d9d7..9c8268df2cb 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -824,7 +824,7 @@ bool MCAssembler::LayoutOnce(MCAsmLayout &Layout) { // Relax the fragment. MCInst Relaxed; - getBackend().RelaxInstruction(IF, Relaxed); + getBackend().RelaxInstruction(IF->getInst(), Relaxed); // Encode the new instruction. // diff --git a/llvm/lib/Target/X86/X86AsmBackend.cpp b/llvm/lib/Target/X86/X86AsmBackend.cpp index c647713428a..151087f58ed 100644 --- a/llvm/lib/Target/X86/X86AsmBackend.cpp +++ b/llvm/lib/Target/X86/X86AsmBackend.cpp @@ -56,7 +56,7 @@ public: bool MayNeedRelaxation(const MCInst &Inst) const; - void RelaxInstruction(const MCInstFragment *IF, MCInst &Res) const; + void RelaxInstruction(const MCInst &Inst, MCInst &Res) const; bool WriteNopData(uint64_t Count, MCObjectWriter *OW) const; }; @@ -101,20 +101,19 @@ bool X86AsmBackend::MayNeedRelaxation(const MCInst &Inst) const { // FIXME: Can tblgen help at all here to verify there aren't other instructions // we can relax? -void X86AsmBackend::RelaxInstruction(const MCInstFragment *IF, - MCInst &Res) const { +void X86AsmBackend::RelaxInstruction(const MCInst &Inst, MCInst &Res) const { // The only relaxations X86 does is from a 1byte pcrel to a 4byte pcrel. - unsigned RelaxedOp = getRelaxedOpcode(IF->getInst().getOpcode()); + unsigned RelaxedOp = getRelaxedOpcode(Inst.getOpcode()); - if (RelaxedOp == IF->getInst().getOpcode()) { + if (RelaxedOp == Inst.getOpcode()) { SmallString<256> Tmp; raw_svector_ostream OS(Tmp); - IF->getInst().dump_pretty(OS); + Inst.dump_pretty(OS); OS << "\n"; report_fatal_error("unexpected instruction to relax: " + OS.str()); } - Res = IF->getInst(); + Res = Inst; Res.setOpcode(RelaxedOp); } |

