This is an archive of the discontinued LLVM Phabricator instance.

Fix and test inter-procedural register allocation for ARM
ClosedPublic

Authored by ostannard on Jul 18 2019, 2:57 AM.

Details

Summary
  • Avoid a crash when IPRA calls ARMFrameLowering::determineCalleeSaves with a null RegScavenger. Simply not updating the register scavenger is fine because IPRA only cares about the SavedRegs vector, the acutal code of the function has already been generated at this point.
  • Add a new hook to TargetRegisterInfo to get the set of registers which can be clobbered inside a call, even if the compiler can see both sides, by linker-generated code.

Diff Detail

Repository
rL LLVM

Event Timeline

ostannard created this revision.Jul 18 2019, 2:57 AM
arsenm added inline comments.Jul 18 2019, 5:33 AM
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
493 ↗(On Diff #210509)

Why aren’t these explicit clobbers on the call itself?

ostannard marked an inline comment as done.Jul 18 2019, 5:45 AM
ostannard added inline comments.
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
493 ↗(On Diff #210509)

This is a property of the calling convention, not the BL instruction, so I think it makes more sense to have it here. I think we also use BL as a long branch inside Thumb1 functions, in which case it clobbers lr but nor r12.

dmgreen added inline comments.Aug 1 2019, 9:44 AM
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
492 ↗(On Diff #210509)

*which

496 ↗(On Diff #210509)

This returns a Null terminated list (or null), in the same way as getCalleeSavedRegs above? I guess that's Ok.

An arrayref might be a better interface for it, all the same.

ostannard marked 2 inline comments as done and an inline comment as not done.Aug 2 2019, 2:45 AM
ostannard added inline comments.
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
496 ↗(On Diff #210509)

Yes, it matches the functions above, but I suppose an ArrayRef would be a better interface, so I'll change it.

ostannard updated this revision to Diff 213004.Aug 2 2019, 2:55 AM
  • Switch to using ArrayRef instead of null-terminated array
dmgreen accepted this revision.Aug 2 2019, 3:07 AM

LGTM. I think this is a sensible way to deal with r12. It is a bit special.

llvm/include/llvm/CodeGen/TargetRegisterInfo.h
453 ↗(On Diff #213004)

Nit: is it worth making an ArrayRef const?

This revision is now accepted and ready to land.Aug 2 2019, 3:07 AM
This revision was automatically updated to reflect the committed changes.