Commit dd165074 by Jim Stichnoth

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
parent bca2f655
......@@ -509,6 +509,8 @@ void TargetX8632::emitVariable(const Variable *Var) const {
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 @@ void TargetX8632::emitVariable(const Variable *Var) const {
}
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 @@ void TargetX8632::lowerCall(const InstCall *Instr) {
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 @@ Operand *TargetX8632::legalize(Operand *From, LegalMask Allowed,
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;
......
......@@ -147,13 +147,10 @@ protected:
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment