Subzero: Remove the LEAHACK workarounds.

They are no longer needed now that we aren't using the buggy llvm-mc parser for Intel syntax.

This also gets all spec2k components to work with -build-on-read.

Also, adds an emit-time check that infinite-weight Variables actually got a physical register.

BUG= none
R=jvoung@chromium.org

Review URL: https://codereview.chromium.org/696153002
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 881bb14..f06c2e4 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -509,6 +509,8 @@
     Str << "%" << getRegName(Var->getRegNum(), Var->getType());
     return;
   }
+  if (Var->getWeight().isInf())
+    llvm_unreachable("Infinite-weight Variable has no register assigned");
   const Type Ty = IceType_i32;
   int32_t Offset = Var->getStackOffset();
   if (!hasFramePointer())
@@ -519,7 +521,10 @@
 }
 
 x86::Address TargetX8632::stackVarToAsmOperand(const Variable *Var) const {
-  assert(!Var->hasReg());
+  if (Var->hasReg())
+    llvm_unreachable("Stack Variable has a register assigned");
+  if (Var->getWeight().isInf())
+    llvm_unreachable("Infinite-weight Variable has no register assigned");
   int32_t Offset = Var->getStackOffset();
   if (!hasFramePointer())
     Offset += getStackAdjustment();
@@ -1850,9 +1855,7 @@
       break;
     }
   }
-  // TODO(stichnot): LEAHACK: remove Legal_All (and use default) once
-  // a proper emitter is used.
-  Operand *CallTarget = legalize(Instr->getCallTarget(), Legal_All);
+  Operand *CallTarget = legalize(Instr->getCallTarget());
   Inst *NewCall = InstX8632Call::create(Func, ReturnReg, CallTarget);
   Context.insert(NewCall);
   if (ReturnRegHi)
@@ -4407,11 +4410,6 @@
     if (!(Allowed & Legal_Imm))
       // Immediate specifically not allowed
       NeedsReg = true;
-    // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper
-    // emitter is used.
-    if (!(Allowed & Legal_Reloc) && llvm::isa<ConstantRelocatable>(From))
-      // Relocatable specifically not allowed
-      NeedsReg = true;
     if (!(Allowed & Legal_Mem) && isScalarFloatingType(From->getType()))
       // On x86, FP constants are lowered to mem operands.
       NeedsReg = true;
diff --git a/src/IceTargetLoweringX8632.h b/src/IceTargetLoweringX8632.h
index 85d6a67..7422f8a 100644
--- a/src/IceTargetLoweringX8632.h
+++ b/src/IceTargetLoweringX8632.h
@@ -147,13 +147,10 @@
     Legal_Reg = 1 << 0, // physical register, not stack location
     Legal_Imm = 1 << 1,
     Legal_Mem = 1 << 2, // includes [eax+4*ecx] as well as [esp+12]
-    // TODO(stichnot): LEAHACK: remove Legal_Reloc once a proper
-    // emitter is used.
-    Legal_Reloc = 1 << 3,
     Legal_All = ~Legal_None
   };
   typedef uint32_t LegalMask;
-  Operand *legalize(Operand *From, LegalMask Allowed = Legal_All & ~Legal_Reloc,
+  Operand *legalize(Operand *From, LegalMask Allowed = Legal_All,
                     int32_t RegNum = Variable::NoRegister);
   Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister);
   // Turn a pointer operand into a memory operand that can be