[PATCH] [mips] Do not place users of $ra in the delay slot of call instructions.

Daniel Sanders daniel.sanders at imgtec.com
Tue May 12 07:51:01 PDT 2015


LGTM with a couple minor changes.


================
Comment at: lib/Target/Mips/MipsDelaySlotFiller.cpp:319-322
@@ +318,6 @@
+  // Add RA to Defs to prevent users of RA from going into the delay slot.
+  if (MI.definesRegister(Mips::RA) || MI.definesRegister(Mips::RA_64)) {
+    Defs.set(Mips::RA);
+    Defs.set(Mips::RA_64);
+  }
+
----------------
Can you use this?:
  if (MI.definesRegister(Mips::RA))
    Defs.set(Mips::RA);
  if (MI.definesRegister(Mips::RA_64))
    Defs.set(Mips::RA_64);
so we don't add defs that weren't in the original instruction.

Could you also elaborate on the comment to explain the quirk that makes this necessary. The delay slot is very slightly inside the function. It's sufficiently inside that RA/RA_64 have already been updated and must be preserved, but not so far inside that we can't preserve values in the other callee-saved registers.

http://reviews.llvm.org/D9670

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list