Subzero: Cleanly implement register allocation after phi lowering.

After finding a valid linearization of phi assignments, the old approach calls a complicated target-specific method that lowers and ad-hoc register allocates the phi assignments.

In the new approach, we use existing target lowering to lower assignments into mov/whatever instructions, and enhance the register allocator to be able to forcibly spill and reload a register if one is needed but none are available.

The new approach incrementally updates liveness and live ranges for newly added nodes and variable uses, to avoid having to expensively recompute it all.

Advanced phi lowering is enabled now on ARM, and constant blinding no longer needs to be disabled during phi lowering.

Some of the metadata regarding which CfgNode a local variable belongs to, needed to be made non-const, in order to add spill/fill instructions to a CfgNode during register allocation.

Most of the testing came from spec2k.  There are some minor differences in the output regarding stack frame offsets, probably related to the order that new nodes are phi-lowered.  The changes related to constant blinding were tested by running spec with "-randomize-pool-immediates=randomize -randomize-pool-threshold=8".

Unfortunately, this appears to add about 10% to the translation time for 176.gcc.  The cost is clear in the -timing output so it can be investigated later.  There is a TODO suggesting the possible cause and solution, for later investigation.

BUG= none
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/1253833002.
diff --git a/src/IceOperand.cpp b/src/IceOperand.cpp
index 0d739ca..815efaf 100644
--- a/src/IceOperand.cpp
+++ b/src/IceOperand.cpp
@@ -146,8 +146,7 @@
 }
 
 void VariableTracking::markUse(MetadataKind TrackingKind, const Inst *Instr,
-                               const CfgNode *Node, bool IsFromDef,
-                               bool IsImplicit) {
+                               CfgNode *Node, bool IsImplicit) {
   (void)TrackingKind;
   if (MultiBlock == MBS_MultiBlock)
     return;
@@ -165,7 +164,7 @@
   // is because there can be additional control flow before branching
   // back to this node, and the variable is live throughout those
   // nodes.
-  if (!IsFromDef && Instr && llvm::isa<InstPhi>(Instr))
+  if (Instr && llvm::isa<InstPhi>(Instr))
     MakeMulti = true;
 
   if (!MakeMulti) {
@@ -190,7 +189,7 @@
 }
 
 void VariableTracking::markDef(MetadataKind TrackingKind, const Inst *Instr,
-                               const CfgNode *Node) {
+                               CfgNode *Node) {
   // TODO(stichnot): If the definition occurs in the last instruction
   // of the block, consider not marking this as a separate use.  But
   // be careful not to omit all uses of the variable if markDef() and
@@ -205,9 +204,8 @@
            Instr->getNumber() >= LastInstruction->getNumber());
   }
 #endif
-  const bool IsFromDef = true;
-  const bool IsImplicit = false;
-  markUse(TrackingKind, Instr, Node, IsFromDef, IsImplicit);
+  constexpr bool IsImplicit = false;
+  markUse(TrackingKind, Instr, Node, IsImplicit);
   if (TrackingKind == VMK_Uses)
     return;
   if (FirstOrSingleDefinition == nullptr)
@@ -276,12 +274,10 @@
 
   // Mark implicit args as being used in the entry node.
   for (Variable *Var : Func->getImplicitArgs()) {
-    const Inst *NoInst = nullptr;
-    const CfgNode *EntryNode = Func->getEntryNode();
-    const bool IsFromDef = false;
-    const bool IsImplicit = true;
-    Metadata[Var->getIndex()].markUse(Kind, NoInst, EntryNode, IsFromDef,
-                                      IsImplicit);
+    constexpr Inst *NoInst = nullptr;
+    CfgNode *EntryNode = Func->getEntryNode();
+    constexpr bool IsImplicit = true;
+    Metadata[Var->getIndex()].markUse(Kind, NoInst, EntryNode, IsImplicit);
   }
 
   for (CfgNode *Node : Func->getNodes())
@@ -304,9 +300,8 @@
       if (const Variable *Var = llvm::dyn_cast<Variable>(I.getSrc(SrcNum))) {
         SizeT VarNum = Var->getIndex();
         assert(VarNum < Metadata.size());
-        const bool IsFromDef = false;
-        const bool IsImplicit = false;
-        Metadata[VarNum].markUse(Kind, &I, Node, IsFromDef, IsImplicit);
+        constexpr bool IsImplicit = false;
+        Metadata[VarNum].markUse(Kind, &I, Node, IsImplicit);
       }
     }
   }
@@ -328,9 +323,8 @@
         const Variable *Var = Src->getVar(J);
         SizeT VarNum = Var->getIndex();
         assert(VarNum < Metadata.size());
-        const bool IsFromDef = false;
-        const bool IsImplicit = false;
-        Metadata[VarNum].markUse(Kind, &I, Node, IsFromDef, IsImplicit);
+        constexpr bool IsImplicit = false;
+        Metadata[VarNum].markUse(Kind, &I, Node, IsImplicit);
       }
     }
   }
@@ -382,7 +376,7 @@
   return Metadata[VarNum].getLatterDefinitions();
 }
 
-const CfgNode *VariablesMetadata::getLocalUseNode(const Variable *Var) const {
+CfgNode *VariablesMetadata::getLocalUseNode(const Variable *Var) const {
   if (!isTracked(Var))
     return nullptr; // conservative answer
   SizeT VarNum = Var->getIndex();