@@ -1489,6 +1489,27 @@ SDValue VETargetLowering::lowerDYNAMIC_STACKALLOC(SDValue Op,
1489
1489
return DAG.getMergeValues (Ops, DL);
1490
1490
}
1491
1491
1492
+ static SDValue lowerFRAMEADDR (SDValue Op, SelectionDAG &DAG,
1493
+ const VETargetLowering &TLI,
1494
+ const VESubtarget *Subtarget) {
1495
+ SDLoc DL (Op);
1496
+ MachineFunction &MF = DAG.getMachineFunction ();
1497
+ EVT PtrVT = TLI.getPointerTy (MF.getDataLayout ());
1498
+
1499
+ MachineFrameInfo &MFI = MF.getFrameInfo ();
1500
+ MFI.setFrameAddressIsTaken (true );
1501
+
1502
+ unsigned Depth = Op.getConstantOperandVal (0 );
1503
+ const VERegisterInfo *RegInfo = Subtarget->getRegisterInfo ();
1504
+ unsigned FrameReg = RegInfo->getFrameRegister (MF);
1505
+ SDValue FrameAddr =
1506
+ DAG.getCopyFromReg (DAG.getEntryNode (), DL, FrameReg, PtrVT);
1507
+ while (Depth--)
1508
+ FrameAddr = DAG.getLoad (Op.getValueType (), DL, DAG.getEntryNode (),
1509
+ FrameAddr, MachinePointerInfo ());
1510
+ return FrameAddr;
1511
+ }
1512
+
1492
1513
static SDValue getSplatValue (SDNode *N) {
1493
1514
if (auto *BuildVec = dyn_cast<BuildVectorSDNode>(N)) {
1494
1515
return BuildVec->getSplatValue ();
@@ -1529,6 +1550,8 @@ SDValue VETargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
1529
1550
return lowerConstantPool (Op, DAG);
1530
1551
case ISD::DYNAMIC_STACKALLOC:
1531
1552
return lowerDYNAMIC_STACKALLOC (Op, DAG);
1553
+ case ISD::FRAMEADDR:
1554
+ return lowerFRAMEADDR (Op, DAG, *this , Subtarget);
1532
1555
case ISD::GlobalAddress:
1533
1556
return lowerGlobalAddress (Op, DAG);
1534
1557
case ISD::GlobalTLSAddress:
0 commit comments