don't go through getInstructions().
authorChris Lattner <sabre@nondot.org>
Fri, 19 Mar 2010 00:18:23 +0000 (00:18 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 19 Mar 2010 00:18:23 +0000 (00:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98906 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp
utils/TableGen/CodeGenDAGPatterns.cpp
utils/TableGen/CodeGenTarget.h

index 7446ba0efde2066b09b014ddf87acc78a8f4210f..82b064ed33c2a3dd90b4468ad5470d753ed612ec 100644 (file)
@@ -844,19 +844,20 @@ void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) {
   // Parse the instructions; we need to do this first so that we can gather the
   // singleton register classes.
   std::set<std::string> SingletonRegisterNames;
-  for (std::map<std::string, CodeGenInstruction>::const_iterator 
-         it = Target.getInstructions().begin(), 
-         ie = Target.getInstructions().end(); 
-       it != ie; ++it) {
-    const CodeGenInstruction &CGI = it->second;
+  
+  std::vector<const CodeGenInstruction*> InstrList;
+  Target.getInstructionsByEnumValue(InstrList);
+  
+  for (unsigned i = 0, e = InstrList.size(); i != e; ++i) {
+    const CodeGenInstruction &CGI = *InstrList[i];
 
-    if (!StringRef(it->first).startswith(MatchPrefix))
+    if (!StringRef(CGI.TheDef->getName()).startswith(MatchPrefix))
       continue;
 
-    OwningPtr<InstructionInfo> II(new InstructionInfo);
+    OwningPtr<InstructionInfo> II(new InstructionInfo());
     
-    II->InstrName = it->first;
-    II->Instr = &it->second;
+    II->InstrName = CGI.TheDef->getName();
+    II->Instr = &CGI;
     II->AsmString = FlattenVariants(CGI.AsmString, 0);
 
     // Remove comments from the asm string.
@@ -869,7 +870,7 @@ void AsmMatcherInfo::BuildInfo(CodeGenTarget &Target) {
     TokenizeAsmString(II->AsmString, II->Tokens);
 
     // Ignore instructions which shouldn't be matched.
-    if (!IsAssemblerInstruction(it->first, CGI, II->Tokens))
+    if (!IsAssemblerInstruction(CGI.TheDef->getName(), CGI, II->Tokens))
       continue;
 
     // Collect singleton registers, if used.
index fafcd8c30ef9fafcaf3cbe4c021ef40b45b3958d..8c07c4a80c274adc27df9daf25a9b7ace5eb2c09 100644 (file)
@@ -2362,11 +2362,11 @@ void CodeGenDAGPatterns::AddPatternToMatch(const TreePattern *Pattern,
 
 
 void CodeGenDAGPatterns::InferInstructionFlags() {
-  std::map<std::string, CodeGenInstruction> &InstrDescs =
-    Target.getInstructions();
-  for (std::map<std::string, CodeGenInstruction>::iterator
-         II = InstrDescs.begin(), E = InstrDescs.end(); II != E; ++II) {
-    CodeGenInstruction &InstInfo = II->second;
+  std::vector<const CodeGenInstruction*> Instructions;
+  Target.getInstructionsByEnumValue(Instructions);
+  for (unsigned i = 0, e = Instructions.size(); i != e; ++i) {
+    CodeGenInstruction &InstInfo =
+      const_cast<CodeGenInstruction &>(*Instructions[i]);
     // Determine properties of the instruction from its pattern.
     bool MayStore, MayLoad, HasSideEffects;
     InferFromPattern(InstInfo, MayStore, MayLoad, HasSideEffects, *this);
index d20e868da726007e721146121ed3603965c5c9eb..d48e49a8c513dd4fba3f42d650ac429fb375b728 100644 (file)
@@ -185,6 +185,7 @@ public:
 
   /// getInstructions - Return all of the instructions defined for this target.
   ///
+private:
   const std::map<std::string, CodeGenInstruction> &getInstructions() const {
     if (Instructions.empty()) ReadInstructions();
     return Instructions;
@@ -193,7 +194,6 @@ public:
     if (Instructions.empty()) ReadInstructions();
     return Instructions;
   }
-private:
   CodeGenInstruction &getInstruction(const std::string &Name) const {
     const std::map<std::string, CodeGenInstruction> &Insts = getInstructions();
     assert(Insts.count(Name) && "Not an instruction!");