@@ -498,36 +498,6 @@ getPushOrLibCallsSavedInfo(const MachineFunction &MF,
498
498
return PushOrLibCallsCSI;
499
499
}
500
500
501
- void RISCVFrameLowering::adjustStackForRVV (MachineFunction &MF,
502
- MachineBasicBlock &MBB,
503
- MachineBasicBlock::iterator MBBI,
504
- const DebugLoc &DL, int64_t Amount,
505
- MachineInstr::MIFlag Flag) const {
506
- assert (Amount != 0 && " Did not need to adjust stack pointer for RVV." );
507
-
508
- // Optimize compile time offset case
509
- StackOffset Offset = StackOffset::getScalable (Amount);
510
- if (auto VLEN = STI.getRealVLen ()) {
511
- // 1. Multiply the number of v-slots by the (constant) length of register
512
- const int64_t VLENB = *VLEN / 8 ;
513
- assert (Amount % 8 == 0 &&
514
- " Reserve the stack by the multiple of one vector size." );
515
- const int64_t NumOfVReg = Amount / 8 ;
516
- const int64_t FixedOffset = NumOfVReg * VLENB;
517
- if (!isInt<32 >(FixedOffset)) {
518
- report_fatal_error (
519
- " Frame size outside of the signed 32-bit range not supported" );
520
- }
521
- Offset = StackOffset::getFixed (FixedOffset);
522
- }
523
-
524
- const RISCVRegisterInfo &RI = *STI.getRegisterInfo ();
525
- // We must keep the stack pointer aligned through any intermediate
526
- // updates.
527
- RI.adjustReg (MBB, MBBI, DL, SPReg, SPReg, Offset,
528
- Flag, getStackAlign ());
529
- }
530
-
531
501
static void appendScalableVectorExpression (const TargetRegisterInfo &TRI,
532
502
SmallVectorImpl<char > &Expr,
533
503
int FixedOffset, int ScalableOffset,
@@ -799,8 +769,12 @@ void RISCVFrameLowering::emitPrologue(MachineFunction &MF,
799
769
}
800
770
801
771
if (RVVStackSize) {
802
- adjustStackForRVV (MF, MBB, MBBI, DL, -RVVStackSize,
803
- MachineInstr::FrameSetup);
772
+ // We must keep the stack pointer aligned through any intermediate
773
+ // updates.
774
+ RI->adjustReg (MBB, MBBI, DL, SPReg, SPReg,
775
+ StackOffset::getScalable (-RVVStackSize),
776
+ MachineInstr::FrameSetup, getStackAlign ());
777
+
804
778
if (!hasFP (MF)) {
805
779
// Emit .cfi_def_cfa_expression "sp + StackSize + RVVStackSize * vlenb".
806
780
unsigned CFIIndex = MF.addFrameInst (createDefCFAExpression (
@@ -925,8 +899,9 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF,
925
899
// If RestoreSPFromFP the stack pointer will be restored using the frame
926
900
// pointer value.
927
901
if (!RestoreSPFromFP)
928
- adjustStackForRVV (MF, MBB, LastFrameDestroy, DL, RVVStackSize,
929
- MachineInstr::FrameDestroy);
902
+ RI->adjustReg (MBB, LastFrameDestroy, DL, SPReg, SPReg,
903
+ StackOffset::getScalable (RVVStackSize),
904
+ MachineInstr::FrameDestroy, getStackAlign ());
930
905
931
906
if (!hasFP (MF)) {
932
907
unsigned CFIIndex = MF.addFrameInst (MCCFIInstruction::cfiDefCfa (
0 commit comments