mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Avoid duplicating logic on frame register selecting when lowering frameaddr
No functionality change git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
149b2a8b92
commit
b9cca13063
@ -11030,7 +11030,9 @@ SDValue X86TargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const {
|
|||||||
EVT VT = Op.getValueType();
|
EVT VT = Op.getValueType();
|
||||||
DebugLoc dl = Op.getDebugLoc(); // FIXME probably not meaningful
|
DebugLoc dl = Op.getDebugLoc(); // FIXME probably not meaningful
|
||||||
unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
|
unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
|
||||||
unsigned FrameReg = Subtarget->is64Bit() ? X86::RBP : X86::EBP;
|
unsigned FrameReg = RegInfo->getFrameRegister(DAG.getMachineFunction());
|
||||||
|
assert(((FrameReg == X86::RBP && VT == MVT::i64) ||
|
||||||
|
(FrameReg == X86::EBP && VT == MVT::i32)) && "Invalid Frame Register!");
|
||||||
SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
|
SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
|
||||||
while (Depth--)
|
while (Depth--)
|
||||||
FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
|
FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user