put instructions into a map instead of a vector for quick lookup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23368 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelEmitter.h b/utils/TableGen/DAGISelEmitter.h
index a8726d9..bd1018b 100644
--- a/utils/TableGen/DAGISelEmitter.h
+++ b/utils/TableGen/DAGISelEmitter.h
@@ -317,7 +317,7 @@
std::map<Record*, SDNodeInfo> SDNodes;
std::map<Record*, std::pair<Record*, std::string> > SDNodeXForms;
std::map<Record*, TreePattern*> PatternFragments;
- std::vector<DAGInstruction> Instructions;
+ std::map<Record*, DAGInstruction> Instructions;
/// PatternsToMatch - All of the things we are matching on the DAG. The first
/// value is the pattern to match, the second pattern is the result to
@@ -344,6 +344,11 @@
return SDNodeXForms.find(R)->second;
}
+ const DAGInstruction &getInstruction(Record *R) const {
+ assert(Instructions.count(R) && "Unknown instruction!");
+ return Instructions.find(R)->second;
+ }
+
private:
void ParseNodeInfo();
void ParseNodeTransforms(std::ostream &OS);