}
void ARMFastISel::ARMSimplifyRegOffset(unsigned &Base, int &Offset, EVT VT) {
-
+
assert(VT.isSimple() && "Non-simple types are invalid here!");
-
+
bool needsLowering = false;
switch (VT.getSimpleVT().SimpleTy) {
default:
needsLowering = ((Offset & 0xff) != Offset);
break;
}
-
+
// Since the offset is too large for the load/store instruction
// get the reg+offset into a register.
if (needsLowering) {
}
ResultReg = createResultReg(RC);
-
+
ARMSimplifyRegOffset(Base, Offset, VT);
-
+
// addrmode5 output depends on the selection dag addressing dividing the
// offset by 4 that it then later multiplies. Do this here as well.
if (isFloat)
Offset /= 4;
-
+
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(Opc), ResultReg)
.addReg(Base).addImm(Offset));
}
ARMSimplifyRegOffset(Base, Offset, VT);
-
+
// addrmode5 output depends on the selection dag addressing dividing the
// offset by 4 that it then later multiplies. Do this here as well.
if (isFloat)
Offset /= 4;
-
+
// The thumb addressing mode has operands swapped from the arm addressing
// mode, the floating point one only has two operands.
if (isFloat || isThumb)
EVT SrcVT, unsigned &ResultReg) {
unsigned RR = FastEmit_r(SrcVT.getSimpleVT(), DstVT.getSimpleVT(), Opc,
Src, /*TODO: Kill=*/false);
-
+
if (RR != 0) {
ResultReg = RR;
return true;
} else
- return false;
+ return false;
}
// This is largely taken directly from CCAssignFnForNode - we don't support
} else if (VA.needsCustom()) {
// TODO: We need custom lowering for vector (v2f64) args.
if (VA.getLocVT() != MVT::f64) return false;
-
+
CCValAssign &NextVA = ArgLocs[++i];
// TODO: Only handle register args for now.
UsedRegs.push_back(RVLocs[0].getLocReg());
UsedRegs.push_back(RVLocs[1].getLocReg());
-
+
// Finally update the result.
UpdateValueMap(I, ResultReg);
} else {
bool ARMFastISel::SelectRet(const Instruction *I) {
const ReturnInst *Ret = cast<ReturnInst>(I);
const Function &F = *I->getParent()->getParent();
-
+
if (!FuncInfo.CanLowerReturn)
return false;
-
+
if (F.isVarArg())
return false;
return false;
CCValAssign &VA = ValLocs[0];
-
+
// Don't bother handling odd stuff for now.
if (VA.getLocInfo() != CCValAssign::Full)
return false;
// says Full but the types don't match.
if (VA.getValVT() != TLI.getValueType(RV->getType()))
return false;
-
+
// Make the copy.
unsigned SrcReg = Reg + VA.getValNo();
unsigned DstReg = VA.getLocReg();
// Mark the register as live out of the function.
MRI.addLiveOut(VA.getLocReg());
}
-
+
unsigned RetOpc = isThumb ? ARM::tBX_RET : ARM::BX_RET;
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
TII.get(RetOpc)));