mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add a new field to MCOperandInfo that contains information about the type of the Operand.
- The actual values are from the MCOI::OperandType enum. - Teach tblgen to read it from the instruction definition. - This is a better implementation of the hacks in edis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -67,12 +67,14 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
||||
Record *Rec = Arg->getDef();
|
||||
std::string PrintMethod = "printOperand";
|
||||
std::string EncoderMethod;
|
||||
std::string OperandType = "OPERAND_UNKNOWN";
|
||||
unsigned NumOps = 1;
|
||||
DagInit *MIOpInfo = 0;
|
||||
if (Rec->isSubClassOf("RegisterOperand")) {
|
||||
PrintMethod = Rec->getValueAsString("PrintMethod");
|
||||
} else if (Rec->isSubClassOf("Operand")) {
|
||||
PrintMethod = Rec->getValueAsString("PrintMethod");
|
||||
OperandType = Rec->getValueAsString("OperandType");
|
||||
// If there is an explicit encoder method, use it.
|
||||
EncoderMethod = Rec->getValueAsString("EncoderMethod");
|
||||
MIOpInfo = Rec->getValueAsDag("MIOperandInfo");
|
||||
@@ -96,8 +98,9 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
||||
} else if (Rec->getName() == "variable_ops") {
|
||||
isVariadic = true;
|
||||
continue;
|
||||
} else if (!Rec->isSubClassOf("RegisterClass") &&
|
||||
!Rec->isSubClassOf("PointerLikeRegClass") &&
|
||||
} else if (Rec->isSubClassOf("RegisterClass")) {
|
||||
OperandType = "OPERAND_REGISTER";
|
||||
} else if (!Rec->isSubClassOf("PointerLikeRegClass") &&
|
||||
Rec->getName() != "unknown")
|
||||
throw "Unknown operand class '" + Rec->getName() +
|
||||
"' in '" + R->getName() + "' instruction!";
|
||||
@@ -111,7 +114,8 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
|
||||
" has the same name as a previous operand!";
|
||||
|
||||
OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod, EncoderMethod,
|
||||
MIOperandNo, NumOps, MIOpInfo));
|
||||
OperandType, MIOperandNo, NumOps,
|
||||
MIOpInfo));
|
||||
MIOperandNo += NumOps;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user