[llvm] [M68k] Emit RTE for interrupt handler. (PR #72787)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 03:52:14 PST 2023


================
@@ -252,12 +252,11 @@ bool M68kExpandPseudo::ExpandMI(MachineBasicBlock &MBB,
     return true;
   }
   case M68k::RET: {
-    // Adjust stack to erase error code
-    int64_t StackAdj = MBBI->getOperand(0).getImm();
-    MachineInstrBuilder MIB;
-
-    if (StackAdj == 0) {
-      MIB = BuildMI(MBB, MBBI, DL, TII->get(M68k::RTS));
+    if (MBB.getParent()->getFunction().getCallingConv() ==
+        CallingConv::M68k_INTR) {
+      BuildMI(MBB, MBBI, DL, TII->get(M68k::RTE));
+    } else if (int64_t StackAdj = MBBI->getOperand(0).getImm(); StackAdj == 0) {
----------------
RKSimon wrote:

Why not just `} else if (MBBI->getOperand(0).getImm() == 0) {` ?

https://github.com/llvm/llvm-project/pull/72787


More information about the llvm-commits mailing list