mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[MCInstPrinter] Add parameter Address
to printCustomAliasOperand. NFC
Follow-up of D72172 and llvmorg-11-init-6896-gb3cc5dcef0f.
This commit is contained in:
parent
e4e5f3ffca
commit
9b4e24b4ac
@ -34,8 +34,8 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
virtual bool printAliasInstr(const MCInst *MI, uint64_t Address,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
virtual void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
const MCSubtargetInfo &STI,
|
||||
raw_ostream &O);
|
||||
|
||||
@ -207,8 +207,8 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O) override;
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O) override;
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
const MCSubtargetInfo &STI,
|
||||
raw_ostream &O) override;
|
||||
|
||||
|
@ -34,8 +34,8 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
virtual bool printAliasInstr(const MCInst *MI, uint64_t Address,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
virtual void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
virtual void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
const MCSubtargetInfo &STI,
|
||||
raw_ostream &O);
|
||||
static const char *getRegisterName(unsigned RegNo,
|
||||
|
@ -47,8 +47,9 @@ private:
|
||||
// Autogenerated by TableGen.
|
||||
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -45,8 +45,9 @@ public:
|
||||
// Autogenerated by tblgen.
|
||||
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
void printRegName(raw_ostream &OS, unsigned RegNo) const override;
|
||||
|
||||
|
@ -28,8 +28,9 @@ namespace llvm {
|
||||
// Autogenerated by tblgen.
|
||||
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
||||
private:
|
||||
|
@ -87,8 +87,9 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O) override;
|
||||
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
|
||||
private:
|
||||
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
||||
|
@ -40,8 +40,8 @@ public:
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &OS);
|
||||
|
||||
void printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O);
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
static const char *getRegisterName(unsigned RegNo, unsigned AltIdx);
|
||||
|
@ -35,8 +35,8 @@ public:
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx,
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
const MCSubtargetInfo &STI, raw_ostream &O);
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
||||
|
@ -31,8 +31,9 @@ public:
|
||||
// Autogenerated by tblgen, returns true if we successfully printed an
|
||||
// alias.
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
|
||||
// Autogenerated by tblgen.
|
||||
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
|
@ -32,8 +32,9 @@ public:
|
||||
// Autogenerated by tblgen, returns true if we successfully printed an
|
||||
// alias.
|
||||
bool printAliasInstr(const MCInst *MI, uint64_t Address, raw_ostream &OS);
|
||||
void printCustomAliasOperand(const MCInst *MI, unsigned OpIdx,
|
||||
unsigned PrintMethodIdx, raw_ostream &O);
|
||||
void printCustomAliasOperand(const MCInst *MI, uint64_t Address,
|
||||
unsigned OpIdx, unsigned PrintMethodIdx,
|
||||
raw_ostream &O);
|
||||
|
||||
// Autogenerated by tblgen.
|
||||
void printInstruction(const MCInst *MI, uint64_t Address, raw_ostream &O);
|
||||
|
@ -783,7 +783,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
||||
// before it can be matched to the mnemonic.
|
||||
std::map<std::string, std::vector<IAPrinter>> IAPrinterMap;
|
||||
|
||||
std::vector<std::string> PrintMethods;
|
||||
std::vector<std::pair<std::string, bool>> PrintMethods;
|
||||
|
||||
// A list of MCOperandPredicates for all operands in use, and the reverse map
|
||||
std::vector<const Record*> MCOpPredicates;
|
||||
@ -855,11 +855,16 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
||||
if (Rec->isSubClassOf("RegisterOperand") ||
|
||||
Rec->isSubClassOf("Operand")) {
|
||||
StringRef PrintMethod = Rec->getValueAsString("PrintMethod");
|
||||
bool IsPCRel =
|
||||
Rec->getValueAsString("OperandType") == "OPERAND_PCREL";
|
||||
if (PrintMethod != "" && PrintMethod != "printOperand") {
|
||||
PrintMethodIdx =
|
||||
llvm::find(PrintMethods, PrintMethod) - PrintMethods.begin();
|
||||
PrintMethodIdx = llvm::find_if(PrintMethods,
|
||||
[&](auto &X) {
|
||||
return X.first == PrintMethod;
|
||||
}) -
|
||||
PrintMethods.begin();
|
||||
if (static_cast<unsigned>(PrintMethodIdx) == PrintMethods.size())
|
||||
PrintMethods.push_back(std::string(PrintMethod));
|
||||
PrintMethods.emplace_back(std::string(PrintMethod), IsPCRel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1149,7 +1154,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
||||
O << " ++I;\n";
|
||||
O << " int OpIdx = AsmString[I++] - 1;\n";
|
||||
O << " int PrintMethodIdx = AsmString[I++] - 1;\n";
|
||||
O << " printCustomAliasOperand(MI, OpIdx, PrintMethodIdx, ";
|
||||
O << " printCustomAliasOperand(MI, Address, OpIdx, PrintMethodIdx, ";
|
||||
O << (PassSubtarget ? "STI, " : "");
|
||||
O << "OS);\n";
|
||||
O << " } else\n";
|
||||
@ -1171,7 +1176,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
||||
|
||||
O << "void " << Target.getName() << ClassName << "::"
|
||||
<< "printCustomAliasOperand(\n"
|
||||
<< " const MCInst *MI, unsigned OpIdx,\n"
|
||||
<< " const MCInst *MI, uint64_t Address, unsigned OpIdx,\n"
|
||||
<< " unsigned PrintMethodIdx,\n"
|
||||
<< (PassSubtarget ? " const MCSubtargetInfo &STI,\n" : "")
|
||||
<< " raw_ostream &OS) {\n";
|
||||
@ -1185,7 +1190,8 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
|
||||
|
||||
for (unsigned i = 0; i < PrintMethods.size(); ++i) {
|
||||
O << " case " << i << ":\n"
|
||||
<< " " << PrintMethods[i] << "(MI, OpIdx, "
|
||||
<< " " << PrintMethods[i].first << "(MI, "
|
||||
<< (PrintMethods[i].second ? "Address, " : "") << "OpIdx, "
|
||||
<< (PassSubtarget ? "STI, " : "") << "OS);\n"
|
||||
<< " break;\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user