[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp DAGISelEmitter.h

Evan Cheng evan.cheng at apple.com
Fri Aug 25 18:02:33 PDT 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.246 -> 1.247
DAGISelEmitter.h updated: 1.68 -> 1.69
---
Log message:

A bit more clean up.

---
Diffs of the changes:  (+14 -17)

 DAGISelEmitter.cpp |   29 +++++++++++++----------------
 DAGISelEmitter.h   |    2 +-
 2 files changed, 14 insertions(+), 17 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.246 llvm/utils/TableGen/DAGISelEmitter.cpp:1.247
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.246	Fri Aug 25 19:59:04 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Fri Aug 25 20:02:19 2006
@@ -2126,7 +2126,7 @@
   std::vector<std::pair<unsigned, std::string> > &GeneratedCode;
   /// GeneratedDecl - This is the set of all SDOperand declarations needed for
   /// the set of patterns for each top-level opcode.
-  std::set<std::pair<unsigned, std::string> > &GeneratedDecl;
+  std::set<std::string> &GeneratedDecl;
   /// TargetOpcodes - The target specific opcodes used by the resulting
   /// instructions.
   std::vector<std::string> &TargetOpcodes;
@@ -2149,9 +2149,9 @@
     if (!S.empty())
       GeneratedCode.push_back(std::make_pair(2, S));
   }
-  void emitDecl(const std::string &S, unsigned T=0) {
+  void emitDecl(const std::string &S) {
     assert(!S.empty() && "Invalid declaration");
-    GeneratedDecl.insert(std::make_pair(T, S));
+    GeneratedDecl.insert(S);
   }
   void emitOpcode(const std::string &Opc) {
     TargetOpcodes.push_back(Opc);
@@ -2165,7 +2165,7 @@
   PatternCodeEmitter(DAGISelEmitter &ise, ListInit *preds,
                      TreePatternNode *pattern, TreePatternNode *instr,
                      std::vector<std::pair<unsigned, std::string> > &gc,
-                     std::set<std::pair<unsigned, std::string> > &gd,
+                     std::set<std::string> &gd,
                      std::vector<std::string> &to,
                      std::vector<std::string> &tv)
   : ISE(ise), Predicates(preds), Pattern(pattern), Instruction(instr),
@@ -2986,9 +2986,9 @@
 /// succeeds.  Returns true if the pattern is not guaranteed to match.
 void DAGISelEmitter::GenerateCodeForPattern(PatternToMatch &Pattern,
                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
-                     std::set<std::pair<unsigned, std::string> > &GeneratedDecl,
+                                           std::set<std::string> &GeneratedDecl,
                                         std::vector<std::string> &TargetOpcodes,
-                                            std::vector<std::string> &TargetVTs) {
+                                          std::vector<std::string> &TargetVTs) {
   PatternCodeEmitter Emitter(*this, Pattern.getPredicates(),
                              Pattern.getSrcPattern(), Pattern.getDstPattern(),
                              GeneratedCode, GeneratedDecl,
@@ -3274,10 +3274,10 @@
       std::vector<std::pair<PatternToMatch*, CodeList> > CodeForPatterns;
       std::vector<std::vector<std::string> > PatternOpcodes;
       std::vector<std::vector<std::string> > PatternVTs;
-      std::vector<std::set<std::pair<unsigned, std::string> > > PatternDecls;
+      std::vector<std::set<std::string> > PatternDecls;
       for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
         CodeList GeneratedCode;
-        std::set<std::pair<unsigned, std::string> > GeneratedDecl;
+        std::set<std::string> GeneratedDecl;
         std::vector<std::string> TargetOpcodes;
         std::vector<std::string> TargetVTs;
         GenerateCodeForPattern(*Patterns[i], GeneratedCode, GeneratedDecl,
@@ -3319,7 +3319,7 @@
         CodeList &GeneratedCode = CodeForPatterns[i].second;
         std::vector<std::string> &TargetOpcodes = PatternOpcodes[i];
         std::vector<std::string> &TargetVTs = PatternVTs[i];
-        std::set<std::pair<unsigned, std::string> > Decls = PatternDecls[i];
+        std::set<std::string> Decls = PatternDecls[i];
         std::vector<std::string> AddedInits;
         int CodeSize = (int)GeneratedCode.size();
         int LastPred = -1;
@@ -3340,9 +3340,9 @@
           CalleeCode += ", MVT::ValueType VT" + utostr(j);
           CallerCode += ", " + TargetVTs[j];
         }
-        for (std::set<std::pair<unsigned, std::string> >::iterator
+        for (std::set<std::string>::iterator
                I = Decls.begin(), E = Decls.end(); I != E; ++I) {
-          std::string Name = I->second;
+          std::string Name = *I;
           CalleeCode += ", SDOperand &" + Name;
           CallerCode += ", " + Name;
         }
@@ -3357,11 +3357,8 @@
                I = AddedInits.rbegin(), E = AddedInits.rend(); I != E; ++I)
           CalleeCode += "  " + *I + "\n";
 
-        for (int j = LastPred+1; j < CodeSize; ++j) {
-          std::string code = GeneratedCode[j].second;
-          //          if (!AddedDecls.count(code))
-            CalleeCode += "  " + code + "\n";
-        }
+        for (int j = LastPred+1; j < CodeSize; ++j)
+          CalleeCode += "  " + GeneratedCode[j].second + "\n";
         for (int j = LastPred+1; j < CodeSize; ++j)
           GeneratedCode.pop_back();
         CalleeCode += "}\n";


Index: llvm/utils/TableGen/DAGISelEmitter.h
diff -u llvm/utils/TableGen/DAGISelEmitter.h:1.68 llvm/utils/TableGen/DAGISelEmitter.h:1.69
--- llvm/utils/TableGen/DAGISelEmitter.h:1.68	Fri Aug 25 19:59:04 2006
+++ llvm/utils/TableGen/DAGISelEmitter.h	Fri Aug 25 20:02:19 2006
@@ -521,7 +521,7 @@
                                    std::vector<Record*> &InstImpResults);
   void GenerateCodeForPattern(PatternToMatch &Pattern,
                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
-                     std::set<std::pair<unsigned, std::string> > &GeneratedDecl,
+                              std::set<std::string> &GeneratedDecl,
                               std::vector<std::string> &TargetOpcodes,
                               std::vector<std::string> &TargetVTs);
   void EmitPatterns(std::vector<std::pair<PatternToMatch*, 






More information about the llvm-commits mailing list