================ @@ -783,6 +783,54 @@ void RISCVFrameLowering::allocateStack(MachineBasicBlock &MBB, } } +static bool isPush(unsigned Opcode) { + switch (Opcode) { + case RISCV::CM_PUSH: + case RISCV::QC_CM_PUSH: + case RISCV::QC_CM_PUSHFP: + return true; + default: + return false; + } +} + +static bool isPop(unsigned Opcode) { + // There are other pops but these are the only ones introduced during this + // pass. + switch (Opcode) { + case RISCV::CM_POP: + case RISCV::QC_CM_POP: + return true; + default: + return false; + } +} + +static unsigned getPushOpcode(RISCVMachineFunctionInfo::PushKind Kind, + bool hasFP) { + switch (Kind) { + case RISCVMachineFunctionInfo::PushKind::StdExtZcmp: + return RISCV::CM_PUSH; + case RISCVMachineFunctionInfo::PushKind::VendorXqccmp: + return hasFP ? RISCV::QC_CM_PUSHFP : RISCV::QC_CM_PUSH; + default: + llvm_unreachable("Unhandled PushKind"); + } +} + +static unsigned getPopOpcode(RISCVMachineFunctionInfo::PushKind Kind) { + // There are other pops but they are introduced later by the Push/Pop + // Optimizer. + switch (Kind) { + case RISCVMachineFunctionInfo::PushKind::StdExtZcmp: + return RISCV::CM_POP; + case llvm::RISCVMachineFunctionInfo::PushKind::VendorXqccmp: + return RISCV::CM_POP; ---------------- topperc wrote:
Should this be RISCV::QC_CM_POP? https://github.com/llvm/llvm-project/pull/128815 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits