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