Give tablegen's Type a destructor, to suppress spurious
[oota-llvm.git] / utils / TableGen / CodeEmitterGen.cpp
index 74268a3c3e7a3efa7849423f7b5eaf3c49e6545d..ae4a6aa445b1ca0f80316202f0a61b2f0751f8e5 100644 (file)
@@ -100,8 +100,6 @@ void CodeEmitterGen::run(std::ostream &o) {
     const CodeGenInstruction *CGI = *IN;
     Record *R = CGI->TheDef;
     
-    if (IN != NumberedInstructions.begin()) o << ",\n";
-    
     if (R->getName() == "PHI" ||
         R->getName() == "INLINEASM" ||
         R->getName() == "DBG_LABEL" ||
@@ -112,7 +110,7 @@ void CodeEmitterGen::run(std::ostream &o) {
         R->getName() == "INSERT_SUBREG" ||
         R->getName() == "IMPLICIT_DEF" ||
         R->getName() == "SUBREG_TO_REG") {
-      o << "    0U";
+      o << "    0U,\n";
       continue;
     }
     
@@ -125,9 +123,9 @@ void CodeEmitterGen::run(std::ostream &o) {
         Value |= B->getValue() << (e-i-1);
       }
     }
-    o << "    " << Value << "U";
+    o << "    " << Value << "U," << '\t' << "// " << R->getName() << "\n";
   }
-  o << "\n  };\n";
+  o << "    0U\n  };\n";
   
   // Map to accumulate all the cases.
   std::map<std::string, std::vector<std::string> > CaseMap;
@@ -193,7 +191,7 @@ void CodeEmitterGen::run(std::ostream &o) {
               gotOp = true;
             }
             
-            unsigned opMask = (1 << N) - 1;
+            unsigned opMask = ~0U >> (32-N);
             int opShift = beginVarBit - N + 1;
             opMask <<= opShift;
             opShift = beginInstBit - beginVarBit;
@@ -220,7 +218,7 @@ void CodeEmitterGen::run(std::ostream &o) {
   // Emit initial function code
   o << "  const unsigned opcode = MI.getOpcode();\n"
     << "  unsigned Value = InstBits[opcode];\n"
-    << "  unsigned op;\n"
+    << "  unsigned op = 0;\n"
     << "  op = op;  // suppress warning\n"
     << "  switch (opcode) {\n";