diff options
author | David Woodhouse <dwmw2@infradead.org> | 2014-01-28 23:13:18 +0000 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2014-01-28 23:13:18 +0000 |
commit | 4faa861f19b73cfd8e537e2af5379d6ba53c82d0 (patch) | |
tree | 0bceae88800b9ef55b06d0d0acc9bc866ba52318 /lib/Target/Sparc/MCTargetDesc | |
parent | 2ddea4b44d7d0f8b016d49bd8a16146f84a2a27e (diff) | |
download | llvm-4faa861f19b73cfd8e537e2af5379d6ba53c82d0.tar.gz llvm-4faa861f19b73cfd8e537e2af5379d6ba53c82d0.tar.bz2 llvm-4faa861f19b73cfd8e537e2af5379d6ba53c82d0.tar.xz |
Propagate MCSubtargetInfo through TableGen's getBinaryCodeForInstr()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc/MCTargetDesc')
-rw-r--r-- | lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp b/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp index 22417e4121..8c318274a4 100644 --- a/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp +++ b/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp @@ -45,17 +45,21 @@ public: // getBinaryCodeForInstr - TableGen'erated function for getting the // binary encoding for an instruction. uint64_t getBinaryCodeForInstr(const MCInst &MI, - SmallVectorImpl<MCFixup> &Fixups) const; + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const; /// getMachineOpValue - Return binary encoding of operand. If the machine /// operand requires relocation, record the relocation and return zero. unsigned getMachineOpValue(const MCInst &MI, const MCOperand &MO, - SmallVectorImpl<MCFixup> &Fixups) const; + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const; unsigned getCallTargetOpValue(const MCInst &MI, unsigned OpNo, - SmallVectorImpl<MCFixup> &Fixups) const; + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const; unsigned getBranchTargetOpValue(const MCInst &MI, unsigned OpNo, - SmallVectorImpl<MCFixup> &Fixups) const; + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const; }; } // end anonymous namespace @@ -71,7 +75,7 @@ void SparcMCCodeEmitter:: EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl<MCFixup> &Fixups, const MCSubtargetInfo &STI) const { - unsigned Bits = getBinaryCodeForInstr(MI, Fixups); + unsigned Bits = getBinaryCodeForInstr(MI, Fixups, STI); // Output the constant in big endian byte order. for (unsigned i = 0; i != 4; ++i) { @@ -85,7 +89,8 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, unsigned SparcMCCodeEmitter:: getMachineOpValue(const MCInst &MI, const MCOperand &MO, - SmallVectorImpl<MCFixup> &Fixups) const { + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const { if (MO.isReg()) return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg()); @@ -140,10 +145,11 @@ getMachineOpValue(const MCInst &MI, const MCOperand &MO, unsigned SparcMCCodeEmitter:: getCallTargetOpValue(const MCInst &MI, unsigned OpNo, - SmallVectorImpl<MCFixup> &Fixups) const { + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const { const MCOperand &MO = MI.getOperand(OpNo); if (MO.isReg() || MO.isImm()) - return getMachineOpValue(MI, MO, Fixups); + return getMachineOpValue(MI, MO, Fixups, STI); Fixups.push_back(MCFixup::Create(0, MO.getExpr(), (MCFixupKind)Sparc::fixup_sparc_call30)); @@ -152,10 +158,11 @@ getCallTargetOpValue(const MCInst &MI, unsigned OpNo, unsigned SparcMCCodeEmitter:: getBranchTargetOpValue(const MCInst &MI, unsigned OpNo, - SmallVectorImpl<MCFixup> &Fixups) const { + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const { const MCOperand &MO = MI.getOperand(OpNo); if (MO.isReg() || MO.isImm()) - return getMachineOpValue(MI, MO, Fixups); + return getMachineOpValue(MI, MO, Fixups, STI); Sparc::Fixups fixup = Sparc::fixup_sparc_br22; if (MI.getOpcode() == SP::BPXCC) |