Variable *TargetX8632::copyToReg(Operand *Src, int32_t RegNum) {
Type Ty = Src->getType();
Variable *Reg = makeReg(Ty, RegNum);
- if (isVectorType(Src->getType())) {
+ if (isVectorType(Ty)) {
_movp(Reg, Src);
} else {
_mov(Reg, Src);
From = Ctx->getConstantZero(From->getType());
}
}
+ // There should be no constants of vector type (other than undef).
+ assert(!isVectorType(From->getType()));
bool NeedsReg = false;
if (!(Allowed & Legal_Imm))
// Immediate specifically not allowed
return From;
}
if (Variable *Var = llvm::dyn_cast<Variable>(From)) {
+ // Check if the variable is guaranteed a physical register. This
+ // can happen either when the variable is pre-colored or when it is
+ // assigned infinite weight.
+ bool MustHaveRegister =
+ (Var->hasReg() || Var->getWeight() == RegWeight::Inf);
// We need a new physical register for the operand if:
// Mem is not allowed and Var isn't guaranteed a physical
// register, or
// RegNum is required and Var->getRegNum() doesn't match.
- bool WillHaveRegister =
- (Var->hasReg() || Var->getWeight() == RegWeight::Inf);
- if ((!(Allowed & Legal_Mem) && !WillHaveRegister) ||
+ if ((!(Allowed & Legal_Mem) && !MustHaveRegister) ||
(RegNum != Variable::NoRegister && RegNum != Var->getRegNum())) {
Variable *Reg = copyToReg(From, RegNum);
if (RegNum == Variable::NoRegister) {
InstCall *makeHelperCall(const IceString &Name, Variable *Dest,
SizeT MaxSrcs) {
bool SuppressMangling = true;
- Type Ty = Dest ? Dest->getType() : IceType_void;
- Constant *CallTarget = Ctx->getConstantSym(Ty, 0, Name, SuppressMangling);
+ const Type FunctionPointerType = IceType_i32;
+ Constant *CallTarget =
+ Ctx->getConstantSym(FunctionPointerType, 0, Name, SuppressMangling);
InstCall *Call = InstCall::create(Func, MaxSrcs, Dest, CallTarget);
return Call;
}