mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-02 11:30:10 +00:00
Avoid duplicating logic on frame register selecting when lowering eh_return
No functionality change git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180914 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b9cca13063
commit
db7da200a4
@ -11052,21 +11052,23 @@ SDValue X86TargetLowering::LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const {
|
|||||||
SDValue Handler = Op.getOperand(2);
|
SDValue Handler = Op.getOperand(2);
|
||||||
DebugLoc dl = Op.getDebugLoc();
|
DebugLoc dl = Op.getDebugLoc();
|
||||||
|
|
||||||
SDValue Frame = DAG.getCopyFromReg(DAG.getEntryNode(), dl,
|
EVT PtrVT = getPointerTy();
|
||||||
Subtarget->is64Bit() ? X86::RBP : X86::EBP,
|
unsigned FrameReg = RegInfo->getFrameRegister(DAG.getMachineFunction());
|
||||||
getPointerTy());
|
assert(((FrameReg == X86::RBP && PtrVT == MVT::i64) ||
|
||||||
unsigned StoreAddrReg = (Subtarget->is64Bit() ? X86::RCX : X86::ECX);
|
(FrameReg == X86::EBP && PtrVT == MVT::i32)) &&
|
||||||
|
"Invalid Frame Register!");
|
||||||
|
SDValue Frame = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, PtrVT);
|
||||||
|
unsigned StoreAddrReg = (PtrVT == MVT::i64) ? X86::RCX : X86::ECX;
|
||||||
|
|
||||||
SDValue StoreAddr = DAG.getNode(ISD::ADD, dl, getPointerTy(), Frame,
|
SDValue StoreAddr = DAG.getNode(ISD::ADD, dl, PtrVT, Frame,
|
||||||
DAG.getIntPtrConstant(RegInfo->getSlotSize()));
|
DAG.getIntPtrConstant(RegInfo->getSlotSize()));
|
||||||
StoreAddr = DAG.getNode(ISD::ADD, dl, getPointerTy(), StoreAddr, Offset);
|
StoreAddr = DAG.getNode(ISD::ADD, dl, PtrVT, StoreAddr, Offset);
|
||||||
Chain = DAG.getStore(Chain, dl, Handler, StoreAddr, MachinePointerInfo(),
|
Chain = DAG.getStore(Chain, dl, Handler, StoreAddr, MachinePointerInfo(),
|
||||||
false, false, 0);
|
false, false, 0);
|
||||||
Chain = DAG.getCopyToReg(Chain, dl, StoreAddrReg, StoreAddr);
|
Chain = DAG.getCopyToReg(Chain, dl, StoreAddrReg, StoreAddr);
|
||||||
|
|
||||||
return DAG.getNode(X86ISD::EH_RETURN, dl,
|
return DAG.getNode(X86ISD::EH_RETURN, dl, MVT::Other, Chain,
|
||||||
MVT::Other,
|
DAG.getRegister(StoreAddrReg, PtrVT));
|
||||||
Chain, DAG.getRegister(StoreAddrReg, getPointerTy()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue X86TargetLowering::lowerEH_SJLJ_SETJMP(SDValue Op,
|
SDValue X86TargetLowering::lowerEH_SJLJ_SETJMP(SDValue Op,
|
||||||
|
Loading…
Reference in New Issue
Block a user