[PATCH] Fix return sequence on armv4 thumb
Tim Northover
t.p.northover at gmail.com
Fri Aug 1 04:40:55 PDT 2014
Hi Jon,
I had a bit of a think about the liveness thing I mentioned. I think it's mostly OK, but there is one issue.
Cheers.
Tim.
================
Comment at: llvm/lib/Target/ARM/Thumb1FrameLowering.cpp:502-503
@@ +501,4 @@
+ // Epilogue: pop LR to R3 and branch off it.
+ AddDefaultPred(BuildMI(MBB, MI, dl, TII.get(ARM::tPOP)))
+ .addReg(ARM::R3, RegState::Define);
+
----------------
I think R3 is potentially reserved for a return value. E.g.
define i128 @foo() {
ret i128 0
}
It's rather an edge-case (particularly on v4t, but then v4t is one big edge case). But we probably shouldn't break it anyway.
The safest thing to do would be use the register scavenger. And if the machinery is wired up to restoreCalleeSavedRegisters (fingers crossed) the easiest way to do *that* is to just create a virtual register (even though it is post regalloc, it's got special handling in PrologEpilogInserter).
http://reviews.llvm.org/D4748
More information about the llvm-commits
mailing list