Implemented caller/callee saved registers for FPXX modeless calling convention.
Details
Diff Detail
Event Timeline
lib/Target/Mips/MipsCallingConv.td | ||
---|---|---|
242–247 | I'm not sure these are correct. What happens when only F21 is touched by a function? It should cause D10 to be saved/restored. We don't appear to test this case. getCallPreservedMask() returns CSR_O32_FPXX_NoOdd_RegMask which contains F20, F22, ..., F30 but does not contain D10, D11, ..., D15. I would have expected this function to return the evens from F20 to F30 as well as D10 to D15. Also, I believe that if you merged these two classes into the same definition like this: def CSR_O32_FPXX : CalleeSavedRegs<(add (sequence "D%u", 15, 10), RA, FP, (sequence "S%u", 7, 0))> { let OtherPreserved = (add F20, F22, F24, F26, F28, F30); } then you wouldn't need two definitions and it would make getCallPreservedMask() do the right thing. | |
lib/Target/Mips/MipsSubtarget.cpp | ||
89 | Style nit: This ought to be in the member initializer list | |
lib/Target/Mips/MipsSubtarget.h | ||
62–64 | Would it be easy to make this a member of the MipsABIEnum enum? As far as I can tell there are only two explicit checks for the O32 ABI in our backend. One is in MipsAsmParser.cpp (search for FeatureO32), the other is in MipsLongBranch.cpp. These would need to become tests for O32 || O32FPXX. This isn't a blocking issue in my opinion but it would be best to put it in the enum if we can do so easily. | |
test/CodeGen/Mips/cconv/callee-saved-fpxx.ll | ||
56–62 | The O32-FPXX-INV-NOT's in this region are redundant. They are covered on lines 40-43, |
Also, use of FPXX needs to cause a '.module fp=fpxx' to be emitted (you'll need the patch in D4031). That directive can be emitted by a follow-up patch if you prefer. Without it, the binaries will be treated as using the O32 ABI rather than the O32+fpxx ABI.
lib/Target/Mips/MipsSubtarget.h | ||
---|---|---|
62–64 | I added this flag according to the way O32 FP32/FP64 are currently implemented. I think that both ways make sense, but if we add O32FPXX to MipsABIEnum, I think that probably O32FP64 should be added there as well. I would like to leave this as it is for now. |
lib/Target/Mips/MipsCallingConv.td | ||
---|---|---|
242–247 | ||
243 | indent | |
lib/Target/Mips/MipsSubtarget.h | ||
62–64 | That makes sense. We'll leave it as-is for now. I agree with your comment that O32FP64 belongs in the enum too. We should fix that when we move O32FPXX there. It can be part of general the work to handle ABI's more sensibly. |
LGTM with one last test addition. Please add a check to callee-saved-fpxx1.ll to check that the base O32 doesn't save 64-bit $f20 when 32-bit $f21 is touched.
Added check to callee-saved-fpxx1.ll that the base O32 doesn't save 64-bit $f20 when 32-bit $f21 is touched.
indent