mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
Give MCInstPrinter a MCAsmInfo member, make X86ATTInstPrinter
be a MCInstPrinter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81746 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65b0b297db
commit
c493fb2f4d
@ -13,13 +13,17 @@
|
||||
namespace llvm {
|
||||
class MCInst;
|
||||
class raw_ostream;
|
||||
class MCAsmInfo;
|
||||
|
||||
|
||||
/// MCInstPrinter - This is an instance of a target assembly language printer
|
||||
/// that converts an MCInst to valid target assembly syntax.
|
||||
class MCInstPrinter {
|
||||
protected:
|
||||
raw_ostream &O;
|
||||
const MCAsmInfo &MAI;
|
||||
public:
|
||||
MCInstPrinter(raw_ostream &o) : O(o) {}
|
||||
MCInstPrinter(raw_ostream &o, const MCAsmInfo &mai) : O(o), MAI(mai) {}
|
||||
|
||||
virtual ~MCInstPrinter();
|
||||
|
||||
|
@ -48,7 +48,7 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void X86ATTAsmPrinter::printMCInst(const MCInst *MI) {
|
||||
X86ATTInstPrinter(O, MAI).printInstruction(MI);
|
||||
X86ATTInstPrinter(O, *MAI).printInstruction(MI);
|
||||
}
|
||||
|
||||
void X86ATTAsmPrinter::PrintPICBaseSymbol() const {
|
||||
|
@ -27,6 +27,8 @@ using namespace llvm;
|
||||
#include "X86GenAsmWriter.inc"
|
||||
#undef MachineInstr
|
||||
|
||||
void X86ATTInstPrinter::printInst(const MCInst *MI) { printInstruction(MI); }
|
||||
|
||||
void X86ATTInstPrinter::printSSECC(const MCInst *MI, unsigned Op) {
|
||||
switch (MI->getOperand(Op).getImm()) {
|
||||
default: llvm_unreachable("Invalid ssecc argument!");
|
||||
@ -55,7 +57,7 @@ void X86ATTInstPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) {
|
||||
O << Op.getImm();
|
||||
else {
|
||||
assert(Op.isExpr() && "unknown pcrel immediate operand");
|
||||
Op.getExpr()->print(O, MAI);
|
||||
Op.getExpr()->print(O, &MAI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +73,7 @@ void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
} else {
|
||||
assert(Op.isExpr() && "unknown operand kind in printOperand");
|
||||
O << '$';
|
||||
Op.getExpr()->print(O, MAI);
|
||||
Op.getExpr()->print(O, &MAI);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +88,7 @@ void X86ATTInstPrinter::printLeaMemReference(const MCInst *MI, unsigned Op) {
|
||||
O << DispVal;
|
||||
} else {
|
||||
assert(DispSpec.isExpr() && "non-immediate displacement for LEA?");
|
||||
DispSpec.getExpr()->print(O, MAI);
|
||||
DispSpec.getExpr()->print(O, &MAI);
|
||||
}
|
||||
|
||||
if (IndexReg.getReg() || BaseReg.getReg()) {
|
||||
|
@ -14,18 +14,19 @@
|
||||
#ifndef X86_ATT_INST_PRINTER_H
|
||||
#define X86_ATT_INST_PRINTER_H
|
||||
|
||||
namespace llvm {
|
||||
class MCAsmInfo;
|
||||
class MCInst;
|
||||
class MCOperand;
|
||||
class raw_ostream;
|
||||
|
||||
class X86ATTInstPrinter {
|
||||
raw_ostream &O;
|
||||
const MCAsmInfo *MAI;
|
||||
public:
|
||||
X86ATTInstPrinter(raw_ostream &o, const MCAsmInfo *mai) : O(o), MAI(mai) {}
|
||||
#include "llvm/MC/MCInstPrinter.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCOperand;
|
||||
|
||||
class X86ATTInstPrinter : public MCInstPrinter {
|
||||
public:
|
||||
X86ATTInstPrinter(raw_ostream &O, const MCAsmInfo &MAI)
|
||||
: MCInstPrinter(O, MAI) {}
|
||||
|
||||
|
||||
virtual void printInst(const MCInst *MI);
|
||||
|
||||
// Autogenerated by tblgen.
|
||||
void printInstruction(const MCInst *MI);
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
Loading…
Reference in New Issue
Block a user