Avoid int to string conversion in Twine or raw_ostream contexts.

Some output changes from uppercase hex to lowercase hex, no other functionality change intended.

llvm-svn: 321526
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 7755cd1..64cf233 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1873,7 +1873,7 @@
   // Verify that we are passing the right number of operands.
   if (Frag->getNumArgs() != Children.size()) {
     TP.error("'" + Op->getName() + "' fragment requires " +
-             utostr(Frag->getNumArgs()) + " operands!");
+             Twine(Frag->getNumArgs()) + " operands!");
     return nullptr;
   }
 
@@ -2195,7 +2195,7 @@
             SignBitAndAbove == 1)
           continue;
 
-        TP.error("Integer value '" + itostr(II->getValue()) +
+        TP.error("Integer value '" + Twine(II->getValue()) +
                  "' is out of range for type '" + getEnumName(VT) + "'!");
         break;
       }
@@ -2245,9 +2245,8 @@
       MadeChange |= UpdateNodeType(i, Int->IS.RetVTs[i], TP);
 
     if (getNumChildren() != NumParamVTs + 1) {
-      TP.error("Intrinsic '" + Int->Name + "' expects " +
-               utostr(NumParamVTs) + " operands, not " +
-               utostr(getNumChildren() - 1) + " operands!");
+      TP.error("Intrinsic '" + Int->Name + "' expects " + Twine(NumParamVTs) +
+               " operands, not " + Twine(getNumChildren() - 1) + " operands!");
       return false;
     }
 
@@ -2271,7 +2270,7 @@
     if (NI.getNumOperands() >= 0 &&
         getNumChildren() != (unsigned)NI.getNumOperands()) {
       TP.error(getOperator()->getName() + " node requires exactly " +
-               itostr(NI.getNumOperands()) + " operands!");
+               Twine(NI.getNumOperands()) + " operands!");
       return false;
     }
 
@@ -2340,7 +2339,7 @@
         TreePatternNode *SubIdxChild = getChild(I + 1);
         if (!isOperandClass(SubIdxChild, "SubRegIndex")) {
           TP.error("REG_SEQUENCE requires a SubRegIndex for operand " +
-                   itostr(I + 1) + "!");
+                   Twine(I + 1) + "!");
           return false;
         }
       }
@@ -3514,7 +3513,7 @@
     CGIOperandList::OperandInfo &Op = CGI.Operands[i];
     const std::string &OpName = Op.Name;
     if (OpName.empty())
-      I->error("Operand #" + utostr(i) + " in operands list has no name!");
+      I->error("Operand #" + Twine(i) + " in operands list has no name!");
 
     if (!InstInputsCheck.count(OpName)) {
       // If this is an operand with a DefaultOps set filled in, we can ignore
diff --git a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
index f879a5b..1c1932a 100644
--- a/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
+++ b/llvm/utils/TableGen/DFAPacketizerEmitter.cpp
@@ -283,10 +283,10 @@
     if (i > 0) {
       DEBUG(dbgs() << ", ");
     }
-    DEBUG(dbgs() << "0x" << utohexstr(InsnClass[i]));
+    DEBUG(dbgs() << "0x" << Twine::utohexstr(InsnClass[i]));
   }
   DFAInput InsnInput = getDFAInsnInput(InsnClass);
-  DEBUG(dbgs() << " (input: 0x" << utohexstr(InsnInput) << ")");
+  DEBUG(dbgs() << " (input: 0x" << Twine::utohexstr(InsnInput) << ")");
 }
 
 //
@@ -301,7 +301,7 @@
     if (i > 0) {
       DEBUG(dbgs() << ", ");
     }
-    DEBUG(dbgs() << "0x" << utohexstr(thisState));
+    DEBUG(dbgs() << "0x" << Twine::utohexstr(thisState));
   }
 }
 
@@ -361,7 +361,7 @@
 
     DenseSet<unsigned> VisitedResourceStates;
 
-    DEBUG(dbgs() << "  thisState: 0x" << utohexstr(thisState) << "\n");
+    DEBUG(dbgs() << "  thisState: 0x" << Twine::utohexstr(thisState) << "\n");
     AddInsnClassStages(InsnClass, ComboBitToBitsMap,
                                 numstages - 1, numstages,
                                 thisState, thisState,
@@ -381,7 +381,7 @@
   DEBUG({
     dbgsIndent((1 + numstages - chkstage) << 1);
     dbgs() << "AddInsnClassStages " << chkstage << " (0x"
-           << utohexstr(thisStage) << ") from ";
+           << Twine::utohexstr(thisStage) << ") from ";
     dbgsInsnClass(InsnClass);
     dbgs() << "\n";
   });
@@ -395,9 +395,10 @@
     if (resourceMask & thisStage) {
       unsigned combo = ComboBitToBitsMap[resourceMask];
       if (combo && ((~prevState & combo) != combo)) {
-        DEBUG(dbgs() << "\tSkipped Add 0x" << utohexstr(prevState)
-                     << " - combo op 0x" << utohexstr(resourceMask)
-                     << " (0x" << utohexstr(combo) <<") cannot be scheduled\n");
+        DEBUG(dbgs() << "\tSkipped Add 0x" << Twine::utohexstr(prevState)
+                     << " - combo op 0x" << Twine::utohexstr(resourceMask)
+                     << " (0x" << Twine::utohexstr(combo)
+                     << ") cannot be scheduled\n");
         continue;
       }
       //
@@ -407,11 +408,11 @@
       unsigned ResultingResourceState = prevState | resourceMask | combo;
       DEBUG({
         dbgsIndent((2 + numstages - chkstage) << 1);
-        dbgs() << "0x" << utohexstr(prevState)
-               << " | 0x" << utohexstr(resourceMask);
+        dbgs() << "0x" << Twine::utohexstr(prevState) << " | 0x"
+               << Twine::utohexstr(resourceMask);
         if (combo)
-          dbgs() << " | 0x" << utohexstr(combo);
-        dbgs() << " = 0x" << utohexstr(ResultingResourceState) << " ";
+          dbgs() << " | 0x" << Twine::utohexstr(combo);
+        dbgs() << " = 0x" << Twine::utohexstr(ResultingResourceState) << " ";
       });
 
       //
@@ -433,7 +434,7 @@
             VisitedResourceStates.insert(ResultingResourceState);
             PossibleStates.insert(ResultingResourceState);
             DEBUG(dbgs() << "\tResultingResourceState: 0x"
-                         << utohexstr(ResultingResourceState) << "\n");
+                         << Twine::utohexstr(ResultingResourceState) << "\n");
           } else {
             DEBUG(dbgs() << "\tSkipped Add - state already seen\n");
           }
@@ -493,9 +494,10 @@
       //       These cases are caught later in AddInsnClass.
       unsigned combo = ComboBitToBitsMap[InsnClass[i]];
       if (combo && ((~resources & combo) != combo)) {
-        DEBUG(dbgs() << "\tSkipped canMaybeAdd 0x" << utohexstr(resources)
-                     << " - combo op 0x" << utohexstr(InsnClass[i])
-                     << " (0x" << utohexstr(combo) <<") cannot be scheduled\n");
+        DEBUG(dbgs() << "\tSkipped canMaybeAdd 0x"
+                     << Twine::utohexstr(resources) << " - combo op 0x"
+                     << Twine::utohexstr(InsnClass[i]) << " (0x"
+                     << Twine::utohexstr(combo) << ") cannot be scheduled\n");
         available = false;
         break;
       }
@@ -573,9 +575,8 @@
     for (State::TransitionMap::iterator
         II = SI->Transitions.begin(), IE = SI->Transitions.end();
         II != IE; ++II) {
-      OS << "{0x" << utohexstr(getDFAInsnInput(II->first)) << ", "
-         << II->second->stateNum
-         << "},\t";
+      OS << "{0x" << Twine::utohexstr(getDFAInsnInput(II->first)) << ", "
+         << II->second->stateNum << "},\t";
     }
     ValidTransitions += SI->Transitions.size();
 
@@ -668,8 +669,8 @@
                       "Exceeded maximum number of representable resources");
       unsigned FuncResources = (unsigned) (1U << j);
       FUNameToBitsMap[FUs[j]->getName()] = FuncResources;
-      DEBUG(dbgs() << " " << FUs[j]->getName()
-                   << ":0x" << utohexstr(FuncResources));
+      DEBUG(dbgs() << " " << FUs[j]->getName() << ":0x"
+                   << Twine::utohexstr(FuncResources));
     }
     if (((int) numFUs) > maxFUs) {
       maxFUs = numFUs;
@@ -713,20 +714,20 @@
       const std::string &ComboFuncName = ComboFunc->getName();
       unsigned ComboBit = FUNameToBitsMap[ComboFuncName];
       unsigned ComboResources = ComboBit;
-      DEBUG(dbgs() << "      combo: " << ComboFuncName
-                   << ":0x" << utohexstr(ComboResources) << "\n");
+      DEBUG(dbgs() << "      combo: " << ComboFuncName << ":0x"
+                   << Twine::utohexstr(ComboResources) << "\n");
       for (unsigned k = 0, M = FuncList.size(); k < M; ++k) {
         std::string FuncName = FuncList[k]->getName();
         unsigned FuncResources = FUNameToBitsMap[FuncName];
-        DEBUG(dbgs() << "        " << FuncName
-                     << ":0x" << utohexstr(FuncResources) << "\n");
+        DEBUG(dbgs() << "        " << FuncName << ":0x"
+                     << Twine::utohexstr(FuncResources) << "\n");
         ComboResources |= FuncResources;
       }
       ComboBitToBitsMap[ComboBit] = ComboResources;
       numCombos++;
       DEBUG(dbgs() << "          => combo bits: " << ComboFuncName << ":0x"
-                   << utohexstr(ComboBit) << " = 0x"
-                   << utohexstr(ComboResources) << "\n");
+                   << Twine::utohexstr(ComboBit) << " = 0x"
+                   << Twine::utohexstr(ComboResources) << "\n");
     }
   }
   return numCombos;
@@ -781,7 +782,7 @@
         dbglen += 8;
         DEBUG(dbgs() << "\t");
     }
-    DEBUG(dbgs() << " (bits: 0x" << utohexstr(UnitBitValue) << ")\n");
+    DEBUG(dbgs() << " (bits: 0x" << Twine::utohexstr(UnitBitValue) << ")\n");
   }
 
   if (!UnitBits.empty())
diff --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp
index 37e024b..ba793ad 100644
--- a/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -448,7 +448,7 @@
 
     // If the entry fit in the table, just emit it.
     if (FixedEncodings[i] != ~0U) {
-      OS << "0x" << utohexstr(FixedEncodings[i]) << ", ";
+      OS << "0x" << Twine::utohexstr(FixedEncodings[i]) << ", ";
       continue;
     }