mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
[MCInstPrinter] Enable MCInstPrinter to change its behavior based on the
per-function subtarget. Currently, code-gen passes the default or generic subtarget to the constructors of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which enables some targets (AArch64, ARM, and X86) to change their instprinter's behavior based on the subtarget feature bits. Since the backend can now use different subtargets for each function, instprinter has to be changed to use the per-function subtarget rather than the default subtarget. This patch takes the first step towards enabling instprinter to change its behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the various print methods table-gen auto-generates. I will follow up with changes to instprinters of AArch64, ARM, and X86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233411 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
19e2fce680
commit
f09378397e
@ -19,6 +19,7 @@ class raw_ostream;
|
|||||||
class MCAsmInfo;
|
class MCAsmInfo;
|
||||||
class MCInstrInfo;
|
class MCInstrInfo;
|
||||||
class MCRegisterInfo;
|
class MCRegisterInfo;
|
||||||
|
class MCSubtargetInfo;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
|
|
||||||
namespace HexStyle {
|
namespace HexStyle {
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
/// printInst - Print the specified MCInst to the specified raw_ostream.
|
/// printInst - Print the specified MCInst to the specified raw_ostream.
|
||||||
///
|
///
|
||||||
virtual void printInst(const MCInst *MI, raw_ostream &OS,
|
virtual void printInst(const MCInst *MI, raw_ostream &OS,
|
||||||
StringRef Annot) = 0;
|
StringRef Annot, const MCSubtargetInfo &STI) = 0;
|
||||||
|
|
||||||
/// getOpcodeName - Return the name of the specified opcode enum (e.g.
|
/// getOpcodeName - Return the name of the specified opcode enum (e.g.
|
||||||
/// "MOV32ri") or empty if we can't resolve it.
|
/// "MOV32ri") or empty if we can't resolve it.
|
||||||
|
@ -1015,6 +1015,11 @@ class AsmWriter {
|
|||||||
// name.
|
// name.
|
||||||
string AsmWriterClassName = "InstPrinter";
|
string AsmWriterClassName = "InstPrinter";
|
||||||
|
|
||||||
|
// PassSubtarget - Determines whether MCSubtargetInfo should be passed to
|
||||||
|
// the various print methods.
|
||||||
|
// FIXME: Remove after all ports are updated.
|
||||||
|
int PassSubtarget = 0;
|
||||||
|
|
||||||
// Variant - AsmWriters can be of multiple different variants. Variants are
|
// Variant - AsmWriters can be of multiple different variants. Variants are
|
||||||
// used to support targets that need to emit assembly code in ways that are
|
// used to support targets that need to emit assembly code in ways that are
|
||||||
// mostly the same for different targets, but have minor differences in
|
// mostly the same for different targets, but have minor differences in
|
||||||
|
@ -1262,7 +1262,7 @@ void MCAsmStreamer::EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &S
|
|||||||
|
|
||||||
// If we have an AsmPrinter, use that to print, otherwise print the MCInst.
|
// If we have an AsmPrinter, use that to print, otherwise print the MCInst.
|
||||||
if (InstPrinter)
|
if (InstPrinter)
|
||||||
InstPrinter->printInst(&Inst, OS, "");
|
InstPrinter->printInst(&Inst, OS, "", STI);
|
||||||
else
|
else
|
||||||
Inst.print(OS);
|
Inst.print(OS);
|
||||||
EmitEOL();
|
EmitEOL();
|
||||||
|
@ -268,7 +268,7 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
|
|||||||
SmallVector<char, 64> InsnStr;
|
SmallVector<char, 64> InsnStr;
|
||||||
raw_svector_ostream OS(InsnStr);
|
raw_svector_ostream OS(InsnStr);
|
||||||
formatted_raw_ostream FormattedOS(OS);
|
formatted_raw_ostream FormattedOS(OS);
|
||||||
IP->printInst(&Inst, FormattedOS, AnnotationsStr);
|
IP->printInst(&Inst, FormattedOS, AnnotationsStr, *DC->getSubtargetInfo());
|
||||||
|
|
||||||
if (DC->getOptions() & LLVMDisassembler_Option_PrintLatency)
|
if (DC->getOptions() & LLVMDisassembler_Option_PrintLatency)
|
||||||
emitLatency(DC, Inst);
|
emitLatency(DC, Inst);
|
||||||
|
@ -123,12 +123,14 @@ def AppleAsmParserVariant : AsmParserVariant {
|
|||||||
// AsmWriter bits get associated with the correct class.
|
// AsmWriter bits get associated with the correct class.
|
||||||
def GenericAsmWriter : AsmWriter {
|
def GenericAsmWriter : AsmWriter {
|
||||||
string AsmWriterClassName = "InstPrinter";
|
string AsmWriterClassName = "InstPrinter";
|
||||||
|
int PassSubtarget = 1;
|
||||||
int Variant = 0;
|
int Variant = 0;
|
||||||
bit isMCAsmWriter = 1;
|
bit isMCAsmWriter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
def AppleAsmWriter : AsmWriter {
|
def AppleAsmWriter : AsmWriter {
|
||||||
let AsmWriterClassName = "AppleInstPrinter";
|
let AsmWriterClassName = "AppleInstPrinter";
|
||||||
|
int PassSubtarget = 1;
|
||||||
int Variant = 1;
|
int Variant = 1;
|
||||||
int isMCAsmWriter = 1;
|
int isMCAsmWriter = 1;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,8 @@ void AArch64InstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void AArch64InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
// Check for special encodings and print the canonical alias instead.
|
// Check for special encodings and print the canonical alias instead.
|
||||||
|
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
@ -210,8 +211,8 @@ void AArch64InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!printAliasInstr(MI, O))
|
if (!printAliasInstr(MI, STI, O))
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, STI, O);
|
||||||
|
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
}
|
}
|
||||||
@ -614,7 +615,8 @@ static LdStNInstrDesc *getLdStNInstrDesc(unsigned Opcode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void AArch64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
StringRef Layout, Mnemonic;
|
StringRef Layout, Mnemonic;
|
||||||
|
|
||||||
@ -624,7 +626,7 @@ void AArch64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
|||||||
<< getRegisterName(MI->getOperand(0).getReg(), AArch64::vreg) << ", ";
|
<< getRegisterName(MI->getOperand(0).getReg(), AArch64::vreg) << ", ";
|
||||||
|
|
||||||
unsigned ListOpNum = IsTbx ? 2 : 1;
|
unsigned ListOpNum = IsTbx ? 2 : 1;
|
||||||
printVectorList(MI, ListOpNum, O, "");
|
printVectorList(MI, ListOpNum, STI, O, "");
|
||||||
|
|
||||||
O << ", "
|
O << ", "
|
||||||
<< getRegisterName(MI->getOperand(ListOpNum + 1).getReg(), AArch64::vreg);
|
<< getRegisterName(MI->getOperand(ListOpNum + 1).getReg(), AArch64::vreg);
|
||||||
@ -638,7 +640,7 @@ void AArch64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
|||||||
// Now onto the operands: first a vector list with possible lane
|
// Now onto the operands: first a vector list with possible lane
|
||||||
// specifier. E.g. { v0 }[2]
|
// specifier. E.g. { v0 }[2]
|
||||||
int OpNum = LdStDesc->ListOperand;
|
int OpNum = LdStDesc->ListOperand;
|
||||||
printVectorList(MI, OpNum++, O, "");
|
printVectorList(MI, OpNum++, STI, O, "");
|
||||||
|
|
||||||
if (LdStDesc->HasLane)
|
if (LdStDesc->HasLane)
|
||||||
O << '[' << MI->getOperand(OpNum++).getImm() << ']';
|
O << '[' << MI->getOperand(OpNum++).getImm() << ']';
|
||||||
@ -662,7 +664,7 @@ void AArch64AppleInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AArch64InstPrinter::printInst(MI, O, Annot);
|
AArch64InstPrinter::printInst(MI, O, Annot, STI);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AArch64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) {
|
bool AArch64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) {
|
||||||
@ -889,6 +891,7 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI, raw_ostream &O) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNo);
|
const MCOperand &Op = MI->getOperand(OpNo);
|
||||||
if (Op.isReg()) {
|
if (Op.isReg()) {
|
||||||
@ -903,6 +906,7 @@ void AArch64InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printHexImm(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printHexImm(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNo);
|
const MCOperand &Op = MI->getOperand(OpNo);
|
||||||
O << format("#%#llx", Op.getImm());
|
O << format("#%#llx", Op.getImm());
|
||||||
@ -922,6 +926,7 @@ void AArch64InstPrinter::printPostIncOperand(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printVRegOperand(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printVRegOperand(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNo);
|
const MCOperand &Op = MI->getOperand(OpNo);
|
||||||
assert(Op.isReg() && "Non-register vreg operand!");
|
assert(Op.isReg() && "Non-register vreg operand!");
|
||||||
@ -930,6 +935,7 @@ void AArch64InstPrinter::printVRegOperand(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printSysCROperand(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printSysCROperand(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNo);
|
const MCOperand &Op = MI->getOperand(OpNo);
|
||||||
assert(Op.isImm() && "System instruction C[nm] operands must be immediates!");
|
assert(Op.isImm() && "System instruction C[nm] operands must be immediates!");
|
||||||
@ -937,6 +943,7 @@ void AArch64InstPrinter::printSysCROperand(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printAddSubImm(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printAddSubImm(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &MO = MI->getOperand(OpNum);
|
const MCOperand &MO = MI->getOperand(OpNum);
|
||||||
if (MO.isImm()) {
|
if (MO.isImm()) {
|
||||||
@ -946,18 +953,19 @@ void AArch64InstPrinter::printAddSubImm(const MCInst *MI, unsigned OpNum,
|
|||||||
AArch64_AM::getShiftValue(MI->getOperand(OpNum + 1).getImm());
|
AArch64_AM::getShiftValue(MI->getOperand(OpNum + 1).getImm());
|
||||||
O << '#' << Val;
|
O << '#' << Val;
|
||||||
if (Shift != 0)
|
if (Shift != 0)
|
||||||
printShifter(MI, OpNum + 1, O);
|
printShifter(MI, OpNum + 1, STI, O);
|
||||||
|
|
||||||
if (CommentStream)
|
if (CommentStream)
|
||||||
*CommentStream << '=' << (Val << Shift) << '\n';
|
*CommentStream << '=' << (Val << Shift) << '\n';
|
||||||
} else {
|
} else {
|
||||||
assert(MO.isExpr() && "Unexpected operand type!");
|
assert(MO.isExpr() && "Unexpected operand type!");
|
||||||
O << *MO.getExpr();
|
O << *MO.getExpr();
|
||||||
printShifter(MI, OpNum + 1, O);
|
printShifter(MI, OpNum + 1, STI, O);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printLogicalImm32(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printLogicalImm32(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
uint64_t Val = MI->getOperand(OpNum).getImm();
|
uint64_t Val = MI->getOperand(OpNum).getImm();
|
||||||
O << "#0x";
|
O << "#0x";
|
||||||
@ -965,6 +973,7 @@ void AArch64InstPrinter::printLogicalImm32(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printLogicalImm64(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printLogicalImm64(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
uint64_t Val = MI->getOperand(OpNum).getImm();
|
uint64_t Val = MI->getOperand(OpNum).getImm();
|
||||||
O << "#0x";
|
O << "#0x";
|
||||||
@ -972,6 +981,7 @@ void AArch64InstPrinter::printLogicalImm64(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printShifter(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printShifter(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNum).getImm();
|
unsigned Val = MI->getOperand(OpNum).getImm();
|
||||||
// LSL #0 should not be printed.
|
// LSL #0 should not be printed.
|
||||||
@ -983,18 +993,21 @@ void AArch64InstPrinter::printShifter(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printShiftedRegister(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printShiftedRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
O << getRegisterName(MI->getOperand(OpNum).getReg());
|
O << getRegisterName(MI->getOperand(OpNum).getReg());
|
||||||
printShifter(MI, OpNum + 1, O);
|
printShifter(MI, OpNum + 1, STI, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printExtendedRegister(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printExtendedRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
O << getRegisterName(MI->getOperand(OpNum).getReg());
|
O << getRegisterName(MI->getOperand(OpNum).getReg());
|
||||||
printArithExtend(MI, OpNum + 1, O);
|
printArithExtend(MI, OpNum + 1, STI, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printArithExtend(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printArithExtend(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNum).getImm();
|
unsigned Val = MI->getOperand(OpNum).getImm();
|
||||||
AArch64_AM::ShiftExtendType ExtType = AArch64_AM::getArithExtendType(Val);
|
AArch64_AM::ShiftExtendType ExtType = AArch64_AM::getArithExtendType(Val);
|
||||||
@ -1038,24 +1051,28 @@ void AArch64InstPrinter::printMemExtend(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printCondCode(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printCondCode(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(OpNum).getImm();
|
AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(OpNum).getImm();
|
||||||
O << AArch64CC::getCondCodeName(CC);
|
O << AArch64CC::getCondCodeName(CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printInverseCondCode(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printInverseCondCode(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(OpNum).getImm();
|
AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(OpNum).getImm();
|
||||||
O << AArch64CC::getCondCodeName(AArch64CC::getInvertedCondCode(CC));
|
O << AArch64CC::getCondCodeName(AArch64CC::getInvertedCondCode(CC));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printAMNoIndex(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printAMNoIndex(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
O << '[' << getRegisterName(MI->getOperand(OpNum).getReg()) << ']';
|
O << '[' << getRegisterName(MI->getOperand(OpNum).getReg()) << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int Scale>
|
template<int Scale>
|
||||||
void AArch64InstPrinter::printImmScale(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printImmScale(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
O << '#' << Scale * MI->getOperand(OpNum).getImm();
|
O << '#' << Scale * MI->getOperand(OpNum).getImm();
|
||||||
}
|
}
|
||||||
@ -1085,6 +1102,7 @@ void AArch64InstPrinter::printAMIndexedWB(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned prfop = MI->getOperand(OpNum).getImm();
|
unsigned prfop = MI->getOperand(OpNum).getImm();
|
||||||
bool Valid;
|
bool Valid;
|
||||||
@ -1096,6 +1114,7 @@ void AArch64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printFPImmOperand(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printFPImmOperand(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &MO = MI->getOperand(OpNum);
|
const MCOperand &MO = MI->getOperand(OpNum);
|
||||||
float FPImm =
|
float FPImm =
|
||||||
@ -1151,6 +1170,7 @@ static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride = 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printVectorList(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printVectorList(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O,
|
raw_ostream &O,
|
||||||
StringRef LayoutSuffix) {
|
StringRef LayoutSuffix) {
|
||||||
unsigned Reg = MI->getOperand(OpNum).getReg();
|
unsigned Reg = MI->getOperand(OpNum).getReg();
|
||||||
@ -1193,14 +1213,17 @@ void AArch64InstPrinter::printVectorList(const MCInst *MI, unsigned OpNum,
|
|||||||
O << " }";
|
O << " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printImplicitlyTypedVectorList(const MCInst *MI,
|
void
|
||||||
unsigned OpNum,
|
AArch64InstPrinter::printImplicitlyTypedVectorList(const MCInst *MI,
|
||||||
raw_ostream &O) {
|
unsigned OpNum,
|
||||||
printVectorList(MI, OpNum, O, "");
|
const MCSubtargetInfo &STI,
|
||||||
|
raw_ostream &O) {
|
||||||
|
printVectorList(MI, OpNum, STI, O, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <unsigned NumLanes, char LaneKind>
|
template <unsigned NumLanes, char LaneKind>
|
||||||
void AArch64InstPrinter::printTypedVectorList(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printTypedVectorList(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
std::string Suffix(".");
|
std::string Suffix(".");
|
||||||
if (NumLanes)
|
if (NumLanes)
|
||||||
@ -1208,15 +1231,17 @@ void AArch64InstPrinter::printTypedVectorList(const MCInst *MI, unsigned OpNum,
|
|||||||
else
|
else
|
||||||
Suffix += LaneKind;
|
Suffix += LaneKind;
|
||||||
|
|
||||||
printVectorList(MI, OpNum, O, Suffix);
|
printVectorList(MI, OpNum, STI, O, Suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printVectorIndex(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printVectorIndex(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
O << "[" << MI->getOperand(OpNum).getImm() << "]";
|
O << "[" << MI->getOperand(OpNum).getImm() << "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNum);
|
const MCOperand &Op = MI->getOperand(OpNum);
|
||||||
|
|
||||||
@ -1241,6 +1266,7 @@ void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, unsigned OpNum,
|
void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
const MCOperand &Op = MI->getOperand(OpNum);
|
const MCOperand &Op = MI->getOperand(OpNum);
|
||||||
|
|
||||||
@ -1256,6 +1282,7 @@ void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, unsigned OpNum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printBarrierOption(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printBarrierOption(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
@ -1273,6 +1300,7 @@ void AArch64InstPrinter::printBarrierOption(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||||
|
|
||||||
@ -1283,6 +1311,7 @@ void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||||
|
|
||||||
@ -1293,6 +1322,7 @@ void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printSystemPStateField(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printSystemPStateField(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned Val = MI->getOperand(OpNo).getImm();
|
unsigned Val = MI->getOperand(OpNo).getImm();
|
||||||
|
|
||||||
@ -1305,6 +1335,7 @@ void AArch64InstPrinter::printSystemPStateField(const MCInst *MI, unsigned OpNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AArch64InstPrinter::printSIMDType10Operand(const MCInst *MI, unsigned OpNo,
|
void AArch64InstPrinter::printSIMDType10Operand(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) {
|
raw_ostream &O) {
|
||||||
unsigned RawVal = MI->getOperand(OpNo).getImm();
|
unsigned RawVal = MI->getOperand(OpNo).getImm();
|
||||||
uint64_t Val = AArch64_AM::decodeAdvSIMDModImmType10(RawVal);
|
uint64_t Val = AArch64_AM::decodeAdvSIMDModImmType10(RawVal);
|
||||||
|
@ -28,14 +28,19 @@ public:
|
|||||||
AArch64InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
AArch64InstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
||||||
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
virtual void printInstruction(const MCInst *MI, raw_ostream &O);
|
virtual void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
|
||||||
virtual bool printAliasInstr(const MCInst *MI, raw_ostream &O);
|
raw_ostream &O);
|
||||||
|
virtual bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
|
||||||
|
raw_ostream &O);
|
||||||
virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||||
unsigned PrintMethodIdx, raw_ostream &O);
|
unsigned PrintMethodIdx,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
|
raw_ostream &O);
|
||||||
virtual StringRef getRegName(unsigned RegNo) const {
|
virtual StringRef getRegName(unsigned RegNo) const {
|
||||||
return getRegisterName(RegNo);
|
return getRegisterName(RegNo);
|
||||||
}
|
}
|
||||||
@ -45,90 +50,127 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool printSysAlias(const MCInst *MI, raw_ostream &O);
|
bool printSysAlias(const MCInst *MI, raw_ostream &O);
|
||||||
// Operand printers
|
// Operand printers
|
||||||
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
||||||
void printHexImm(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
raw_ostream &O);
|
||||||
|
void printHexImm(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
|
||||||
|
raw_ostream &O);
|
||||||
void printPostIncOperand(const MCInst *MI, unsigned OpNo, unsigned Imm,
|
void printPostIncOperand(const MCInst *MI, unsigned OpNo, unsigned Imm,
|
||||||
raw_ostream &O);
|
raw_ostream &O);
|
||||||
template<int Amount>
|
template <int Amount>
|
||||||
void printPostIncOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
|
void printPostIncOperand(const MCInst *MI, unsigned OpNo,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
||||||
printPostIncOperand(MI, OpNo, Amount, O);
|
printPostIncOperand(MI, OpNo, Amount, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printVRegOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
void printVRegOperand(const MCInst *MI, unsigned OpNo,
|
||||||
void printSysCROperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printAddSubImm(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printSysCROperand(const MCInst *MI, unsigned OpNo,
|
||||||
void printLogicalImm32(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printLogicalImm64(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printAddSubImm(const MCInst *MI, unsigned OpNum,
|
||||||
void printShifter(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printShiftedRegister(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printLogicalImm32(const MCInst *MI, unsigned OpNum,
|
||||||
void printExtendedRegister(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printArithExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printLogicalImm64(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printShifter(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printShiftedRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printExtendedRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printArithExtend(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O,
|
void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O,
|
||||||
char SrcRegKind, unsigned Width);
|
char SrcRegKind, unsigned Width);
|
||||||
template <char SrcRegKind, unsigned Width>
|
template <char SrcRegKind, unsigned Width>
|
||||||
void printMemExtend(const MCInst *MI, unsigned OpNum, raw_ostream &O) {
|
void printMemExtend(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
||||||
printMemExtend(MI, OpNum, O, SrcRegKind, Width);
|
printMemExtend(MI, OpNum, O, SrcRegKind, Width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printCondCode(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printCondCode(const MCInst *MI, unsigned OpNum,
|
||||||
void printInverseCondCode(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printAlignedLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printInverseCondCode(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printAlignedLabel(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printUImm12Offset(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
void printUImm12Offset(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
||||||
raw_ostream &O);
|
raw_ostream &O);
|
||||||
void printAMIndexedWB(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
void printAMIndexedWB(const MCInst *MI, unsigned OpNum, unsigned Scale,
|
||||||
raw_ostream &O);
|
raw_ostream &O);
|
||||||
|
|
||||||
template<int Scale>
|
template <int Scale>
|
||||||
void printUImm12Offset(const MCInst *MI, unsigned OpNum, raw_ostream &O) {
|
void printUImm12Offset(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
||||||
printUImm12Offset(MI, OpNum, Scale, O);
|
printUImm12Offset(MI, OpNum, Scale, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<int BitWidth>
|
template <int BitWidth>
|
||||||
void printAMIndexedWB(const MCInst *MI, unsigned OpNum, raw_ostream &O) {
|
void printAMIndexedWB(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O) {
|
||||||
printAMIndexedWB(MI, OpNum, BitWidth / 8, O);
|
printAMIndexedWB(MI, OpNum, BitWidth / 8, O);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printAMNoIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printAMNoIndex(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
template<int Scale>
|
template <int Scale>
|
||||||
void printImmScale(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printImmScale(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
void printPrefetchOp(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printPrefetchOp(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
void printFPImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printFPImmOperand(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
void printVectorList(const MCInst *MI, unsigned OpNum, raw_ostream &O,
|
void printVectorList(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O,
|
||||||
StringRef LayoutSuffix);
|
StringRef LayoutSuffix);
|
||||||
|
|
||||||
/// Print a list of vector registers where the type suffix is implicit
|
/// Print a list of vector registers where the type suffix is implicit
|
||||||
/// (i.e. attached to the instruction rather than the registers).
|
/// (i.e. attached to the instruction rather than the registers).
|
||||||
void printImplicitlyTypedVectorList(const MCInst *MI, unsigned OpNum,
|
void printImplicitlyTypedVectorList(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O);
|
raw_ostream &O);
|
||||||
|
|
||||||
template <unsigned NumLanes, char LaneKind>
|
template <unsigned NumLanes, char LaneKind>
|
||||||
void printTypedVectorList(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printTypedVectorList(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
|
||||||
void printVectorIndex(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printVectorIndex(const MCInst *MI, unsigned OpNum,
|
||||||
void printAdrpLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printBarrierOption(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printAdrpLabel(const MCInst *MI, unsigned OpNum,
|
||||||
void printMSRSystemRegister(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printMRSSystemRegister(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printBarrierOption(const MCInst *MI, unsigned OpNum,
|
||||||
void printSystemPStateField(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
void printSIMDType10Operand(const MCInst *MI, unsigned OpNum, raw_ostream &O);
|
void printMSRSystemRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printMRSSystemRegister(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printSystemPStateField(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
|
void printSIMDType10Operand(const MCInst *MI, unsigned OpNum,
|
||||||
|
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||||
};
|
};
|
||||||
|
|
||||||
class AArch64AppleInstPrinter : public AArch64InstPrinter {
|
class AArch64AppleInstPrinter : public AArch64InstPrinter {
|
||||||
public:
|
public:
|
||||||
AArch64AppleInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
AArch64AppleInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
||||||
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
const MCRegisterInfo &MRI,
|
||||||
|
const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O) override;
|
void printInstruction(const MCInst *MI, const MCSubtargetInfo &STI,
|
||||||
bool printAliasInstr(const MCInst *MI, raw_ostream &O) override;
|
raw_ostream &O) override;
|
||||||
|
bool printAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI,
|
||||||
|
raw_ostream &O) override;
|
||||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||||
unsigned PrintMethodIdx,
|
unsigned PrintMethodIdx,
|
||||||
|
const MCSubtargetInfo &STI,
|
||||||
raw_ostream &O) override;
|
raw_ostream &O) override;
|
||||||
StringRef getRegName(unsigned RegNo) const override {
|
StringRef getRegName(unsigned RegNo) const override {
|
||||||
return getRegisterName(RegNo);
|
return getRegisterName(RegNo);
|
||||||
|
@ -74,7 +74,7 @@ void ARMInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void ARMInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
unsigned Opcode = MI->getOpcode();
|
unsigned Opcode = MI->getOpcode();
|
||||||
|
|
||||||
switch(Opcode) {
|
switch(Opcode) {
|
||||||
|
@ -26,7 +26,8 @@ public:
|
|||||||
ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
ARMInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII,
|
||||||
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
|
@ -27,7 +27,7 @@ using namespace llvm;
|
|||||||
#include "BPFGenAsmWriter.inc"
|
#include "BPFGenAsmWriter.inc"
|
||||||
|
|
||||||
void BPFInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void BPFInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, O);
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ public:
|
|||||||
const MCRegisterInfo &MRI)
|
const MCRegisterInfo &MRI)
|
||||||
: MCInstPrinter(MAI, MII, MRI) {}
|
: MCInstPrinter(MAI, MII, MRI) {}
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
|
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O,
|
||||||
const char *Modifier = nullptr);
|
const char *Modifier = nullptr);
|
||||||
void printMemOperand(const MCInst *MI, int OpNo, raw_ostream &O,
|
void printMemOperand(const MCInst *MI, int OpNo, raw_ostream &O,
|
||||||
|
@ -78,7 +78,8 @@ StringRef HexagonInstPrinter::getRegName(unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HexagonInstPrinter::printInst(MCInst const *MI, raw_ostream &O,
|
void HexagonInstPrinter::printInst(MCInst const *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
const char startPacket = '{',
|
const char startPacket = '{',
|
||||||
endPacket = '}';
|
endPacket = '}';
|
||||||
// TODO: add outer HW loop when it's supported too.
|
// TODO: add outer HW loop when it's supported too.
|
||||||
@ -94,7 +95,7 @@ void HexagonInstPrinter::printInst(MCInst const *MI, raw_ostream &O,
|
|||||||
|
|
||||||
Nop.setOpcode (Hexagon::A2_nop);
|
Nop.setOpcode (Hexagon::A2_nop);
|
||||||
HexagonMCInstrInfo::setPacketBegin (Nop, HexagonMCInstrInfo::isPacketBegin(*MI));
|
HexagonMCInstrInfo::setPacketBegin (Nop, HexagonMCInstrInfo::isPacketBegin(*MI));
|
||||||
printInst (&Nop, O, NoAnnot);
|
printInst (&Nop, O, NoAnnot, STI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the packet.
|
// Close the packet.
|
||||||
|
@ -25,7 +25,8 @@ namespace llvm {
|
|||||||
MCRegisterInfo const &MRI)
|
MCRegisterInfo const &MRI)
|
||||||
: MCInstPrinter(MAI, MII, MRI), MII(MII) {}
|
: MCInstPrinter(MAI, MII, MRI), MII(MII) {}
|
||||||
|
|
||||||
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(MCInst const *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
virtual StringRef getOpcodeName(unsigned Opcode) const;
|
virtual StringRef getOpcodeName(unsigned Opcode) const;
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
StringRef getRegName(unsigned RegNo) const;
|
StringRef getRegName(unsigned RegNo) const;
|
||||||
|
@ -27,7 +27,7 @@ using namespace llvm;
|
|||||||
#include "MSP430GenAsmWriter.inc"
|
#include "MSP430GenAsmWriter.inc"
|
||||||
|
|
||||||
void MSP430InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void MSP430InstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, O);
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ namespace llvm {
|
|||||||
const MCRegisterInfo &MRI)
|
const MCRegisterInfo &MRI)
|
||||||
: MCInstPrinter(MAI, MII, MRI) {}
|
: MCInstPrinter(MAI, MII, MRI) {}
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
|
@ -77,7 +77,7 @@ void MipsInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MipsInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void MipsInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
switch (MI->getOpcode()) {
|
switch (MI->getOpcode()) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -86,7 +86,8 @@ public:
|
|||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
|
bool printAliasInstr(const MCInst *MI, raw_ostream &OS);
|
||||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||||
|
@ -72,7 +72,7 @@ void NVPTXInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NVPTXInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
void NVPTXInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
printInstruction(MI, OS);
|
printInstruction(MI, OS);
|
||||||
|
|
||||||
// Next always print the annotation.
|
// Next always print the annotation.
|
||||||
|
@ -28,7 +28,8 @@ public:
|
|||||||
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
const MCRegisterInfo &MRI, const MCSubtargetInfo &STI);
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
|
@ -51,7 +51,7 @@ void PPCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void PPCInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
// Check for slwi/srwi mnemonics.
|
// Check for slwi/srwi mnemonics.
|
||||||
if (MI->getOpcode() == PPC::RLWINM) {
|
if (MI->getOpcode() == PPC::RLWINM) {
|
||||||
unsigned char SH = MI->getOperand(2).getImm();
|
unsigned char SH = MI->getOperand(2).getImm();
|
||||||
|
@ -32,7 +32,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
|
@ -124,7 +124,8 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
AMDGPUInstPrinter InstPrinter(*TM.getMCAsmInfo(),
|
AMDGPUInstPrinter InstPrinter(*TM.getMCAsmInfo(),
|
||||||
*MF->getSubtarget().getInstrInfo(),
|
*MF->getSubtarget().getInstrInfo(),
|
||||||
*MF->getSubtarget().getRegisterInfo());
|
*MF->getSubtarget().getRegisterInfo());
|
||||||
InstPrinter.printInst(&TmpInst, DisasmStream, StringRef());
|
InstPrinter.printInst(&TmpInst, DisasmStream, StringRef(),
|
||||||
|
MF->getSubtarget());
|
||||||
|
|
||||||
// Disassemble instruction/operands to hex representation.
|
// Disassemble instruction/operands to hex representation.
|
||||||
SmallVector<MCFixup, 4> Fixups;
|
SmallVector<MCFixup, 4> Fixups;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
void AMDGPUInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
void AMDGPUInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
OS.flush();
|
OS.flush();
|
||||||
printInstruction(MI, OS);
|
printInstruction(MI, OS);
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ public:
|
|||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void printU8ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
void printU8ImmOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
||||||
|
@ -44,8 +44,7 @@ void SparcInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SparcInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void SparcInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot)
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
{
|
|
||||||
if (!printAliasInstr(MI, O) && !printSparcAliasInstr(MI, O))
|
if (!printAliasInstr(MI, O) && !printSparcAliasInstr(MI, O))
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, O);
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
: MCInstPrinter(MAI, MII, MRI), STI(sti) {}
|
: MCInstPrinter(MAI, MII, MRI), STI(sti) {}
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
bool printSparcAliasInstr(const MCInst *MI, raw_ostream &OS);
|
bool printSparcAliasInstr(const MCInst *MI, raw_ostream &OS);
|
||||||
bool isV9() const;
|
bool isV9() const;
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@ void SystemZInstPrinter::printOperand(const MCOperand &MO, raw_ostream &O) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SystemZInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void SystemZInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, O);
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ public:
|
|||||||
|
|
||||||
// Override MCInstPrinter.
|
// Override MCInstPrinter.
|
||||||
void printRegName(raw_ostream &O, unsigned RegNo) const override;
|
void printRegName(raw_ostream &O, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Print various types of operand.
|
// Print various types of operand.
|
||||||
|
@ -41,7 +41,7 @@ void X86ATTInstPrinter::printRegName(raw_ostream &OS,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
|
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
|
||||||
uint64_t TSFlags = Desc.TSFlags;
|
uint64_t TSFlags = Desc.TSFlags;
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
// Autogenerated by tblgen, returns true if we successfully printed an
|
// Autogenerated by tblgen, returns true if we successfully printed an
|
||||||
// alias.
|
// alias.
|
||||||
|
@ -33,7 +33,8 @@ void X86IntelInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void X86IntelInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
void X86IntelInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
|
||||||
StringRef Annot) {
|
StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) {
|
||||||
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
|
const MCInstrDesc &Desc = MII.get(MI->getOpcode());
|
||||||
uint64_t TSFlags = Desc.TSFlags;
|
uint64_t TSFlags = Desc.TSFlags;
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ public:
|
|||||||
: MCInstPrinter(MAI, MII, MRI) {}
|
: MCInstPrinter(MAI, MII, MRI) {}
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
|
|
||||||
// Autogenerated by tblgen.
|
// Autogenerated by tblgen.
|
||||||
void printInstruction(const MCInst *MI, raw_ostream &O);
|
void printInstruction(const MCInst *MI, raw_ostream &O);
|
||||||
|
@ -30,7 +30,7 @@ void XCoreInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XCoreInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
void XCoreInstPrinter::printInst(const MCInst *MI, raw_ostream &O,
|
||||||
StringRef Annot) {
|
StringRef Annot, const MCSubtargetInfo &STI) {
|
||||||
printInstruction(MI, O);
|
printInstruction(MI, O);
|
||||||
printAnnotation(O, Annot);
|
printAnnotation(O, Annot);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ public:
|
|||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
|
||||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||||
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot) override;
|
void printInst(const MCInst *MI, raw_ostream &O, StringRef Annot,
|
||||||
|
const MCSubtargetInfo &STI) override;
|
||||||
private:
|
private:
|
||||||
void printInlineJT(const MCInst *MI, int opNum, raw_ostream &O);
|
void printInlineJT(const MCInst *MI, int opNum, raw_ostream &O);
|
||||||
void printInlineJT32(const MCInst *MI, int opNum, raw_ostream &O);
|
void printInlineJT32(const MCInst *MI, int opNum, raw_ostream &O);
|
||||||
|
@ -3347,9 +3347,9 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
|||||||
Annotations.flush();
|
Annotations.flush();
|
||||||
StringRef AnnotationsStr = Annotations.str();
|
StringRef AnnotationsStr = Annotations.str();
|
||||||
if (isThumb)
|
if (isThumb)
|
||||||
ThumbIP->printInst(&Inst, FormattedOS, AnnotationsStr);
|
ThumbIP->printInst(&Inst, FormattedOS, AnnotationsStr, *ThumbSTI);
|
||||||
else
|
else
|
||||||
IP->printInst(&Inst, FormattedOS, AnnotationsStr);
|
IP->printInst(&Inst, FormattedOS, AnnotationsStr, *ThumbSTI);
|
||||||
emitComments(CommentStream, CommentsToEmit, FormattedOS, *AsmInfo);
|
emitComments(CommentStream, CommentsToEmit, FormattedOS, *AsmInfo);
|
||||||
|
|
||||||
// Print debug info.
|
// Print debug info.
|
||||||
@ -3408,7 +3408,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
|||||||
outs() << "\t";
|
outs() << "\t";
|
||||||
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize));
|
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, InstSize));
|
||||||
}
|
}
|
||||||
IP->printInst(&Inst, outs(), "");
|
IP->printInst(&Inst, outs(), "", *ThumbSTI);
|
||||||
outs() << "\n";
|
outs() << "\n";
|
||||||
} else {
|
} else {
|
||||||
unsigned int Arch = MachOOF->getArch();
|
unsigned int Arch = MachOOF->getArch();
|
||||||
|
@ -401,7 +401,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
|
|||||||
outs() << "\t";
|
outs() << "\t";
|
||||||
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size));
|
DumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size));
|
||||||
}
|
}
|
||||||
IP->printInst(&Inst, outs(), "");
|
IP->printInst(&Inst, outs(), "", *STI);
|
||||||
outs() << CommentStream.str();
|
outs() << CommentStream.str();
|
||||||
Comments.clear();
|
Comments.clear();
|
||||||
outs() << "\n";
|
outs() << "\n";
|
||||||
|
@ -278,12 +278,15 @@ static void UnescapeString(std::string &Str) {
|
|||||||
void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) {
|
void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) {
|
||||||
Record *AsmWriter = Target.getAsmWriter();
|
Record *AsmWriter = Target.getAsmWriter();
|
||||||
std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
|
std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
|
||||||
|
unsigned PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget");
|
||||||
|
|
||||||
O <<
|
O <<
|
||||||
"/// printInstruction - This method is automatically generated by tablegen\n"
|
"/// printInstruction - This method is automatically generated by tablegen\n"
|
||||||
"/// from the instruction set description.\n"
|
"/// from the instruction set description.\n"
|
||||||
"void " << Target.getName() << ClassName
|
"void " << Target.getName() << ClassName
|
||||||
<< "::printInstruction(const MCInst *MI, raw_ostream &O) {\n";
|
<< "::printInstruction(const MCInst *MI, "
|
||||||
|
<< (PassSubtarget ? "const MCSubtargetInfo &STI, " : "")
|
||||||
|
<< "raw_ostream &O) {\n";
|
||||||
|
|
||||||
// Build an aggregate string, and build a table of offsets into it.
|
// Build an aggregate string, and build a table of offsets into it.
|
||||||
SequenceToOffsetTable<std::string> StringTable;
|
SequenceToOffsetTable<std::string> StringTable;
|
||||||
@ -787,6 +790,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
|||||||
// Emit the method that prints the alias instruction.
|
// Emit the method that prints the alias instruction.
|
||||||
std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
|
std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
|
||||||
unsigned Variant = AsmWriter->getValueAsInt("Variant");
|
unsigned Variant = AsmWriter->getValueAsInt("Variant");
|
||||||
|
unsigned PassSubtarget = AsmWriter->getValueAsInt("PassSubtarget");
|
||||||
|
|
||||||
std::vector<Record*> AllInstAliases =
|
std::vector<Record*> AllInstAliases =
|
||||||
Records.getAllDerivedDefinitions("InstAlias");
|
Records.getAllDerivedDefinitions("InstAlias");
|
||||||
@ -949,7 +953,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
|||||||
|
|
||||||
HeaderO << "bool " << Target.getName() << ClassName
|
HeaderO << "bool " << Target.getName() << ClassName
|
||||||
<< "::printAliasInstr(const MCInst"
|
<< "::printAliasInstr(const MCInst"
|
||||||
<< " *MI, raw_ostream &OS) {\n";
|
<< " *MI, " << (PassSubtarget ? "const MCSubtargetInfo &STI, " : "")
|
||||||
|
<< "raw_ostream &OS) {\n";
|
||||||
|
|
||||||
std::string Cases;
|
std::string Cases;
|
||||||
raw_string_ostream CasesO(Cases);
|
raw_string_ostream CasesO(Cases);
|
||||||
@ -1027,9 +1032,13 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
|||||||
O << " ++I;\n";
|
O << " ++I;\n";
|
||||||
O << " int OpIdx = AsmString[I++] - 1;\n";
|
O << " int OpIdx = AsmString[I++] - 1;\n";
|
||||||
O << " int PrintMethodIdx = AsmString[I++] - 1;\n";
|
O << " int PrintMethodIdx = AsmString[I++] - 1;\n";
|
||||||
O << " printCustomAliasOperand(MI, OpIdx, PrintMethodIdx, OS);\n";
|
O << " printCustomAliasOperand(MI, OpIdx, PrintMethodIdx, ";
|
||||||
|
O << (PassSubtarget ? "STI, " : "");
|
||||||
|
O << "OS);\n";
|
||||||
O << " } else\n";
|
O << " } else\n";
|
||||||
O << " printOperand(MI, unsigned(AsmString[I++]) - 1, OS);\n";
|
O << " printOperand(MI, unsigned(AsmString[I++]) - 1, ";
|
||||||
|
O << (PassSubtarget ? "STI, " : "");
|
||||||
|
O << "OS);\n";
|
||||||
O << " } else {\n";
|
O << " } else {\n";
|
||||||
O << " OS << AsmString[I++];\n";
|
O << " OS << AsmString[I++];\n";
|
||||||
O << " }\n";
|
O << " }\n";
|
||||||
@ -1046,7 +1055,9 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
|||||||
O << "void " << Target.getName() << ClassName << "::"
|
O << "void " << Target.getName() << ClassName << "::"
|
||||||
<< "printCustomAliasOperand(\n"
|
<< "printCustomAliasOperand(\n"
|
||||||
<< " const MCInst *MI, unsigned OpIdx,\n"
|
<< " const MCInst *MI, unsigned OpIdx,\n"
|
||||||
<< " unsigned PrintMethodIdx, raw_ostream &OS) {\n";
|
<< " unsigned PrintMethodIdx,\n"
|
||||||
|
<< (PassSubtarget ? " const MCSubtargetInfo &STI,\n" : "")
|
||||||
|
<< " raw_ostream &OS) {\n";
|
||||||
if (PrintMethods.empty())
|
if (PrintMethods.empty())
|
||||||
O << " llvm_unreachable(\"Unknown PrintMethod kind\");\n";
|
O << " llvm_unreachable(\"Unknown PrintMethod kind\");\n";
|
||||||
else {
|
else {
|
||||||
@ -1057,7 +1068,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
|||||||
|
|
||||||
for (unsigned i = 0; i < PrintMethods.size(); ++i) {
|
for (unsigned i = 0; i < PrintMethods.size(); ++i) {
|
||||||
O << " case " << i << ":\n"
|
O << " case " << i << ":\n"
|
||||||
<< " " << PrintMethods[i] << "(MI, OpIdx, OS);\n"
|
<< " " << PrintMethods[i] << "(MI, OpIdx, "
|
||||||
|
<< (PassSubtarget ? "STI, " : "") << "OS);\n"
|
||||||
<< " break;\n";
|
<< " break;\n";
|
||||||
}
|
}
|
||||||
O << " }\n";
|
O << " }\n";
|
||||||
@ -1094,7 +1106,8 @@ AsmWriterEmitter::AsmWriterEmitter(RecordKeeper &R) : Records(R), Target(R) {
|
|||||||
for (const CodeGenInstruction *I : Target.instructions())
|
for (const CodeGenInstruction *I : Target.instructions())
|
||||||
if (!I->AsmString.empty() && I->TheDef->getName() != "PHI")
|
if (!I->AsmString.empty() && I->TheDef->getName() != "PHI")
|
||||||
Instructions.push_back(
|
Instructions.push_back(
|
||||||
AsmWriterInst(*I, AsmWriter->getValueAsInt("Variant")));
|
AsmWriterInst(*I, AsmWriter->getValueAsInt("Variant"),
|
||||||
|
AsmWriter->getValueAsInt("PassSubtarget")));
|
||||||
|
|
||||||
// Get the instruction numbering.
|
// Get the instruction numbering.
|
||||||
NumberedInstructions = &Target.getInstructionsByEnumValue();
|
NumberedInstructions = &Target.getInstructionsByEnumValue();
|
||||||
|
@ -39,6 +39,8 @@ std::string AsmWriterOperand::getCode() const {
|
|||||||
std::string Result = Str + "(MI";
|
std::string Result = Str + "(MI";
|
||||||
if (MIOpNo != ~0U)
|
if (MIOpNo != ~0U)
|
||||||
Result += ", " + utostr(MIOpNo);
|
Result += ", " + utostr(MIOpNo);
|
||||||
|
if (PassSubtarget)
|
||||||
|
Result += ", STI";
|
||||||
Result += ", O";
|
Result += ", O";
|
||||||
if (!MiModifier.empty())
|
if (!MiModifier.empty())
|
||||||
Result += ", \"" + MiModifier + '"';
|
Result += ", \"" + MiModifier + '"';
|
||||||
@ -48,7 +50,8 @@ std::string AsmWriterOperand::getCode() const {
|
|||||||
/// ParseAsmString - Parse the specified Instruction's AsmString into this
|
/// ParseAsmString - Parse the specified Instruction's AsmString into this
|
||||||
/// AsmWriterInst.
|
/// AsmWriterInst.
|
||||||
///
|
///
|
||||||
AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
|
AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant,
|
||||||
|
unsigned PassSubtarget) {
|
||||||
this->CGI = &CGI;
|
this->CGI = &CGI;
|
||||||
|
|
||||||
// NOTE: Any extensions to this code need to be mirrored in the
|
// NOTE: Any extensions to this code need to be mirrored in the
|
||||||
@ -163,7 +166,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
|
|||||||
Operands.push_back(AsmWriterOperand("PrintSpecial",
|
Operands.push_back(AsmWriterOperand("PrintSpecial",
|
||||||
~0U,
|
~0U,
|
||||||
~0U,
|
~0U,
|
||||||
Modifier));
|
Modifier,
|
||||||
|
PassSubtarget));
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, normal operand.
|
// Otherwise, normal operand.
|
||||||
unsigned OpNo = CGI.Operands.getOperandNamed(VarName);
|
unsigned OpNo = CGI.Operands.getOperandNamed(VarName);
|
||||||
@ -171,7 +175,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
|
|||||||
|
|
||||||
unsigned MIOp = OpInfo.MIOperandNo;
|
unsigned MIOp = OpInfo.MIOperandNo;
|
||||||
Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName,
|
Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName,
|
||||||
OpNo, MIOp, Modifier));
|
OpNo, MIOp, Modifier,
|
||||||
|
PassSubtarget));
|
||||||
}
|
}
|
||||||
LastEmitted = VarEnd;
|
LastEmitted = VarEnd;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,11 @@ namespace llvm {
|
|||||||
/// an operand, specified with syntax like ${opname:modifier}.
|
/// an operand, specified with syntax like ${opname:modifier}.
|
||||||
std::string MiModifier;
|
std::string MiModifier;
|
||||||
|
|
||||||
|
// PassSubtarget - Pass MCSubtargetInfo to the print method if this is
|
||||||
|
// equal to 1.
|
||||||
|
// FIXME: Remove after all ports are updated.
|
||||||
|
unsigned PassSubtarget;
|
||||||
|
|
||||||
// To make VS STL happy
|
// To make VS STL happy
|
||||||
AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {}
|
AsmWriterOperand(OpType op = isLiteralTextOperand):OperandType(op) {}
|
||||||
|
|
||||||
@ -64,9 +69,10 @@ namespace llvm {
|
|||||||
unsigned _CGIOpNo,
|
unsigned _CGIOpNo,
|
||||||
unsigned _MIOpNo,
|
unsigned _MIOpNo,
|
||||||
const std::string &Modifier,
|
const std::string &Modifier,
|
||||||
|
unsigned PassSubtarget,
|
||||||
OpType op = isMachineInstrOperand)
|
OpType op = isMachineInstrOperand)
|
||||||
: OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo),
|
: OperandType(op), Str(Printer), CGIOpNo(_CGIOpNo), MIOpNo(_MIOpNo),
|
||||||
MiModifier(Modifier) {}
|
MiModifier(Modifier), PassSubtarget(PassSubtarget) {}
|
||||||
|
|
||||||
bool operator!=(const AsmWriterOperand &Other) const {
|
bool operator!=(const AsmWriterOperand &Other) const {
|
||||||
if (OperandType != Other.OperandType || Str != Other.Str) return true;
|
if (OperandType != Other.OperandType || Str != Other.Str) return true;
|
||||||
@ -88,7 +94,7 @@ namespace llvm {
|
|||||||
const CodeGenInstruction *CGI;
|
const CodeGenInstruction *CGI;
|
||||||
|
|
||||||
AsmWriterInst(const CodeGenInstruction &CGI,
|
AsmWriterInst(const CodeGenInstruction &CGI,
|
||||||
unsigned Variant);
|
unsigned Variant, unsigned PassSubtarget);
|
||||||
|
|
||||||
/// MatchesAllButOneOp - If this instruction is exactly identical to the
|
/// MatchesAllButOneOp - If this instruction is exactly identical to the
|
||||||
/// specified instruction except for one differing operand, return the
|
/// specified instruction except for one differing operand, return the
|
||||||
|
Loading…
Reference in New Issue
Block a user