mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
ARM: consolidate frame pointer register knowledge
Use the ARMBaseRegisterInfo to query the frame register. The base register info is aware of the frame register that is used for the frame pointer. Use that to determine the frame register rather than duplicating the knowledge. Although, the code path is slightly different in that it may return SP, that can only occur if the frame pointer has been omitted in the machine function, which is supposed to contain the desired value in that case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
82b1114fef
commit
4da07c2038
@ -3930,14 +3930,16 @@ SDValue ARMTargetLowering::LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const{
|
||||
}
|
||||
|
||||
SDValue ARMTargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
|
||||
MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
|
||||
const ARMBaseRegisterInfo &ARI =
|
||||
*static_cast<const ARMBaseRegisterInfo*>(RegInfo);
|
||||
MachineFunction &MF = DAG.getMachineFunction();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MFI->setFrameAddressIsTaken(true);
|
||||
|
||||
EVT VT = Op.getValueType();
|
||||
SDLoc dl(Op); // FIXME probably not meaningful
|
||||
unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
|
||||
unsigned FrameReg = (Subtarget->isThumb() || Subtarget->isTargetMachO())
|
||||
? ARM::R7 : ARM::R11;
|
||||
unsigned FrameReg = ARI.getFrameRegister(MF);
|
||||
SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
|
||||
while (Depth--)
|
||||
FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
|
||||
|
Loading…
Reference in New Issue
Block a user