aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-07-14 21:47:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-07-14 21:47:18 +0000
commitc8dc46bc01a989c91b4ff95279b8d4c7bad4d861 (patch)
tree14208b39f85e8a139520c1c91a7df33a7e27cd6d /llvm/utils/TableGen/CodeGenInstruction.cpp
parent51849920f18a59c50ac4030f6b3e4fc6de2e685e (diff)
downloadllvm-c8dc46bc01a989c91b4ff95279b8d4c7bad4d861.zip
llvm-c8dc46bc01a989c91b4ff95279b8d4c7bad4d861.tar.gz
llvm-c8dc46bc01a989c91b4ff95279b8d4c7bad4d861.tar.bz2
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. llvm-svn: 135197
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenInstruction.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp
index d1e63a9..a52ce86c 100644
--- a/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -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;
}