Unconstify Inits

Remove const qualifiers from Init references, per Chris' request.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136531 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp
index fdeb507..86a377b 100644
--- a/utils/TableGen/CodeGenInstruction.cpp
+++ b/utils/TableGen/CodeGenInstruction.cpp
@@ -30,9 +30,9 @@
   hasOptionalDef = false;
   isVariadic = false;
 
-  const DagInit *OutDI = R->getValueAsDag("OutOperandList");
+  DagInit *OutDI = R->getValueAsDag("OutOperandList");
 
-  if (const DefInit *Init = dynamic_cast<const DefInit*>(OutDI->getOperator())) {
+  if (DefInit *Init = dynamic_cast<DefInit*>(OutDI->getOperator())) {
     if (Init->getDef()->getName() != "outs")
       throw R->getName() + ": invalid def name for output list: use 'outs'";
   } else
@@ -40,8 +40,8 @@
 
   NumDefs = OutDI->getNumArgs();
 
-  const DagInit *InDI = R->getValueAsDag("InOperandList");
-  if (const DefInit *Init = dynamic_cast<const DefInit*>(InDI->getOperator())) {
+  DagInit *InDI = R->getValueAsDag("InOperandList");
+  if (DefInit *Init = dynamic_cast<DefInit*>(InDI->getOperator())) {
     if (Init->getDef()->getName() != "ins")
       throw R->getName() + ": invalid def name for input list: use 'ins'";
   } else
@@ -50,7 +50,7 @@
   unsigned MIOperandNo = 0;
   std::set<std::string> OperandNames;
   for (unsigned i = 0, e = InDI->getNumArgs()+OutDI->getNumArgs(); i != e; ++i){
-    const Init *ArgInit;
+    Init *ArgInit;
     std::string ArgName;
     if (i < NumDefs) {
       ArgInit = OutDI->getArg(i);
@@ -60,7 +60,7 @@
       ArgName = InDI->getArgName(i-NumDefs);
     }
 
-    const DefInit *Arg = dynamic_cast<const DefInit*>(ArgInit);
+    DefInit *Arg = dynamic_cast<DefInit*>(ArgInit);
     if (!Arg)
       throw "Illegal operand for the '" + R->getName() + "' instruction!";
 
@@ -69,7 +69,7 @@
     std::string EncoderMethod;
     std::string OperandType = "OPERAND_UNKNOWN";
     unsigned NumOps = 1;
-    const DagInit *MIOpInfo = 0;
+    DagInit *MIOpInfo = 0;
     if (Rec->isSubClassOf("RegisterOperand")) {
       PrintMethod = Rec->getValueAsString("PrintMethod");
     } else if (Rec->isSubClassOf("Operand")) {
@@ -80,8 +80,8 @@
       MIOpInfo = Rec->getValueAsDag("MIOperandInfo");
 
       // Verify that MIOpInfo has an 'ops' root value.
-      if (!dynamic_cast<const DefInit*>(MIOpInfo->getOperator()) ||
-          dynamic_cast<const DefInit*>(MIOpInfo->getOperator())
+      if (!dynamic_cast<DefInit*>(MIOpInfo->getOperator()) ||
+          dynamic_cast<DefInit*>(MIOpInfo->getOperator())
           ->getDef()->getName() != "ops")
         throw "Bad value for MIOperandInfo in operand '" + Rec->getName() +
         "'\n";
@@ -182,7 +182,7 @@
   }
 
   // Find the suboperand number involved.
-  const DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
+  DagInit *MIOpInfo = OperandList[OpIdx].MIOperandInfo;
   if (MIOpInfo == 0)
     throw TheDef->getName() + ": unknown suboperand name in '" + Op + "'";
 
@@ -405,12 +405,12 @@
 /// constructor.  It checks if an argument in an InstAlias pattern matches
 /// the corresponding operand of the instruction.  It returns true on a
 /// successful match, with ResOp set to the result operand to be used.
-bool CodeGenInstAlias::tryAliasOpMatch(const DagInit *Result, unsigned AliasOpNo,
+bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
                                        Record *InstOpRec, bool hasSubOps,
                                        SMLoc Loc, CodeGenTarget &T,
                                        ResultOperand &ResOp) {
-  const Init *Arg = Result->getArg(AliasOpNo);
-  const DefInit *ADI = dynamic_cast<const DefInit*>(Arg);
+  Init *Arg = Result->getArg(AliasOpNo);
+  DefInit *ADI = dynamic_cast<DefInit*>(Arg);
 
   if (ADI && ADI->getDef() == InstOpRec) {
     // If the operand is a record, it must have a name, and the record type
@@ -456,7 +456,7 @@
     return true;
   }
 
-  if (const IntInit *II = dynamic_cast<const IntInit*>(Arg)) {
+  if (IntInit *II = dynamic_cast<IntInit*>(Arg)) {
     if (hasSubOps || !InstOpRec->isSubClassOf("Operand"))
       return false;
     // Integer arguments can't have names.
@@ -475,7 +475,7 @@
   Result = R->getValueAsDag("ResultInst");
 
   // Verify that the root of the result is an instruction.
-  const DefInit *DI = dynamic_cast<const DefInit*>(Result->getOperator());
+  DefInit *DI = dynamic_cast<DefInit*>(Result->getOperator());
   if (DI == 0 || !DI->getDef()->isSubClassOf("Instruction"))
     throw TGError(R->getLoc(), "result of inst alias should be an instruction");
 
@@ -485,7 +485,7 @@
   // the same class.
   StringMap<Record*> NameClass;
   for (unsigned i = 0, e = Result->getNumArgs(); i != e; ++i) {
-    const DefInit *ADI = dynamic_cast<const DefInit*>(Result->getArg(i));
+    DefInit *ADI = dynamic_cast<DefInit*>(Result->getArg(i));
     if (!ADI || Result->getArgName(i).empty())
       continue;
     // Verify we don't have something like: (someinst GR16:$foo, GR32:$foo)
@@ -524,11 +524,11 @@
     // If the argument did not match the instruction operand, and the operand
     // is composed of multiple suboperands, try matching the suboperands.
     if (NumSubOps > 1) {
-      const DagInit *MIOI = ResultInst->Operands[i].MIOperandInfo;
+      DagInit *MIOI = ResultInst->Operands[i].MIOperandInfo;
       for (unsigned SubOp = 0; SubOp != NumSubOps; ++SubOp) {
         if (AliasOpNo >= Result->getNumArgs())
           throw TGError(R->getLoc(), "not enough arguments for instruction!");
-        Record *SubRec = dynamic_cast<const DefInit*>(MIOI->getArg(SubOp))->getDef();
+        Record *SubRec = dynamic_cast<DefInit*>(MIOI->getArg(SubOp))->getDef();
         if (tryAliasOpMatch(Result, AliasOpNo, SubRec, false,
                             R->getLoc(), T, ResOp)) {
           ResultOperands.push_back(ResOp);