[AVX] Make Inits Foldable

Manage Inits in a FoldingSet.  This provides several benefits:

- Memory for Inits is properly managed

- Duplicate Inits are folded into Flyweights, saving memory

- It enforces const-correctness, protecting against certain classes
  of bugs

The above benefits allow Inits to be used in more contexts, which in
turn provides more dynamism to TableGen.  This enhanced capability
will be used by the AVX code generator to a fold common patterns
together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134907 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/CodeGenInstruction.h b/utils/TableGen/CodeGenInstruction.h
index e00b631..797be7c 100644
--- a/utils/TableGen/CodeGenInstruction.h
+++ b/utils/TableGen/CodeGenInstruction.h
@@ -94,7 +94,7 @@
 
       /// MIOperandInfo - Default MI operand type. Note an operand may be made
       /// up of multiple MI operands.
-      DagInit *MIOperandInfo;
+      const DagInit *MIOperandInfo;
 
       /// Constraint info for this operand.  This operand can have pieces, so we
       /// track constraint info for each.
@@ -102,7 +102,7 @@
 
       OperandInfo(Record *R, const std::string &N, const std::string &PMN,
                   const std::string &EMN, unsigned MION, unsigned MINO,
-                  DagInit *MIOI)
+                  const DagInit *MIOI)
       : Rec(R), Name(N), PrinterMethodName(PMN), EncoderMethodName(EMN),
         MIOperandNo(MION), MINumOperands(MINO), MIOperandInfo(MIOI) {}
 
@@ -265,7 +265,7 @@
     std::string AsmString;
 
     /// Result - The result instruction.
-    DagInit *Result;
+    const DagInit *Result;
 
     /// ResultInst - The instruction generated by the alias (decoded from
     /// Result).
@@ -311,7 +311,7 @@
 
     CodeGenInstAlias(Record *R, CodeGenTarget &T);
 
-    bool tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
+    bool tryAliasOpMatch(const DagInit *Result, unsigned AliasOpNo,
                          Record *InstOpRec, bool hasSubOps, SMLoc Loc,
                          CodeGenTarget &T, ResultOperand &ResOp);
   };