* Do not allow nodes which produce chain results (e.g. loads) to be folded if
[oota-llvm.git] / utils / TableGen / AsmWriterEmitter.cpp
index 34aaf15b5a7517522040071c4155fad643022bf5..cc59aa105ad1108b31c222c341d73eaaa75eb6b9 100644 (file)
@@ -38,21 +38,16 @@ namespace {
     /// machine instruction.
     unsigned MIOpNo;
 
-    /// OpVT - For isMachineInstrOperand, this is the value type for the
-    /// operand.
-    MVT::ValueType OpVT;
-
     AsmWriterOperand(const std::string &LitStr)
-      : OperandType(isLiteralTextOperand),  Str(LitStr) {}
+      : OperandType(isLiteralTextOperand), Str(LitStr) {}
 
-    AsmWriterOperand(const std::string &Printer, unsigned OpNo,
-                     MVT::ValueType VT) : OperandType(isMachineInstrOperand),
-                                          Str(Printer), MIOpNo(OpNo), OpVT(VT){}
+    AsmWriterOperand(const std::string &Printer, unsigned OpNo) 
+      : OperandType(isMachineInstrOperand), Str(Printer), MIOpNo(OpNo) {}
 
     bool operator!=(const AsmWriterOperand &Other) const {
       if (OperandType != Other.OperandType || Str != Other.Str) return true;
       if (OperandType == isMachineInstrOperand)
-        return MIOpNo != Other.MIOpNo || OpVT != Other.OpVT;
+        return MIOpNo != Other.MIOpNo;
       return false;
     }
     bool operator==(const AsmWriterOperand &Other) const {
@@ -90,7 +85,7 @@ void AsmWriterOperand::EmitCode(std::ostream &OS) const {
   if (OperandType == isLiteralTextOperand)
     OS << "O << \"" << Str << "\"; ";
   else
-    OS << Str << "(MI, " << MIOpNo << ", MVT::" << getEnumName(OpVT) << "); ";
+    OS << Str << "(MI, " << MIOpNo << "); ";
 }
 
 
@@ -116,7 +111,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
       LastEmitted = DollarPos;
     } else if (AsmString[DollarPos] == '{') {
       if (inVariant)
-        throw "Nested variants found for instruction '" + CGI.Name + "'!";
+        throw "Nested variants found for instruction '" +
+              CGI.TheDef->getName() + "'!";
       LastEmitted = DollarPos+1;
       inVariant = true;   // We are now inside of the variant!
       for (unsigned i = 0; i != Variant; ++i) {
@@ -126,7 +122,8 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
         std::string::size_type NP =
           AsmString.find_first_of("|}", LastEmitted);
         if (NP == std::string::npos)
-          throw "Incomplete variant for instruction '" + CGI.Name + "'!";
+          throw "Incomplete variant for instruction '" +
+                CGI.TheDef->getName() + "'!";
         LastEmitted = NP+1;
         if (AsmString[NP] == '}') {
           inVariant = false;        // No text for this variant.
@@ -136,17 +133,18 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
     } else if (AsmString[DollarPos] == '|') {
       if (!inVariant)
         throw "'|' character found outside of a variant in instruction '"
-          + CGI.Name + "'!";
+          + CGI.TheDef->getName() + "'!";
       // Move to the end of variant list.
       std::string::size_type NP = AsmString.find('}', LastEmitted);
       if (NP == std::string::npos)
-        throw "Incomplete variant for instruction '" + CGI.Name + "'!";
+        throw "Incomplete variant for instruction '" +
+              CGI.TheDef->getName() + "'!";
       LastEmitted = NP+1;
       inVariant = false;
     } else if (AsmString[DollarPos] == '}') {
       if (!inVariant)
         throw "'}' character found outside of a variant in instruction '"
-          + CGI.Name + "'!";
+          + CGI.TheDef->getName() + "'!";
       LastEmitted = DollarPos+1;
       inVariant = false;
     } else if (DollarPos+1 != AsmString.size() &&
@@ -178,14 +176,15 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
       if (hasCurlyBraces) {
         if (VarEnd >= AsmString.size())
           throw "Reached end of string before terminating curly brace in '"
-                + CGI.Name + "'";
+                + CGI.TheDef->getName() + "'";
         if (AsmString[VarEnd] != '}')
           throw "Variant name beginning with '{' did not end with '}' in '"
-                + CGI.Name + "'";
+                + CGI.TheDef->getName() + "'";
         ++VarEnd;
       }
       if (VarName.empty())
-        throw "Stray '$' in '" + CGI.Name + "' asm string, maybe you want $$?";
+        throw "Stray '$' in '" + CGI.TheDef->getName() +
+              "' asm string, maybe you want $$?";
 
       unsigned OpNo = CGI.getOperandNamed(VarName);
       CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo];
@@ -196,12 +195,11 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned Variant) {
       if (CGI.isTwoAddress && MIOp != 0) {
         if (MIOp == 1)
           throw "Should refer to operand #0 instead of #1 for two-address"
-            " instruction '" + CGI.Name + "'!";
+            " instruction '" + CGI.TheDef->getName() + "'!";
         --MIOp;
       }
 
-      Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName,
-                                          MIOp, OpInfo.Ty));
+      Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp));
       LastEmitted = VarEnd;
     }
   }