In the ELFv2 ABI, we are not required to save all CR fields. If only one nonvolatile CR field is clobbered, use mfocrf instead of mfcr to selectively save the field, because mfocrf has short latency compares to mfcr.
Diff Detail
Event Timeline
lib/Target/PowerPC/PPCFrameLowering.cpp | ||
---|---|---|
845 | Do we not want to do this if we're serializing the CR/LR save sequences (i.e. when the prologue has a single scratch register available)? Perhaps define MfcrOpcode above and use it here as well. | |
test/CodeGen/PowerPC/crsave.ll | ||
24 | Do we not know which CR field we need to save here? |
- Also use MfcrOpcode checking in the CR/LR serializing case
- Only do this for ELFv2ABI
- Fix test case
lib/Target/PowerPC/PPCFrameLowering.cpp | ||
---|---|---|
845 | Thanks : ) I fixed it. By the way, I am curious about in which circumstance TempReg == ScratchReg? Because of shrink-wrapping? | |
test/CodeGen/PowerPC/crsave.ll | ||
24 | Yes we know it. |
lib/Target/PowerPC/PPCFrameLowering.cpp | ||
---|---|---|
845 | Yes. When we sink the prologue into the function for shrink wrapping and the BB has only one available register we use that register to save both the CR and the LR. |
Do we not want to do this if we're serializing the CR/LR save sequences (i.e. when the prologue has a single scratch register available)? Perhaps define MfcrOpcode above and use it here as well.