This is an archive of the discontinued LLVM Phabricator instance.

Add LiveRegUnits class.
ClosedPublic

Authored by MatzeB on Jun 30 2016, 5:52 PM.

Details

Summary

This is a set of register units intended to track register liveness, it
is similar in spirit to LivePhysRegs.
You can also think of this as the liveness tracking parts of the
RegisterScavenger factored out into an own class.

This was proposed in http://llvm.org/PR27609

  • Many of the current LivePhysRegs uses can be replaced by this (I will do that in upcoming patches). This patch only switches the internal RegisterScavenger state to show the concept. Using LiveRegUnits should be slightly more efficient than LivePhysRegs.
  • It cannot completely LivePhysRegs right now, because some cases like %xmm0 vs. %ymm0 on x86 have the exact same register units but need to be differntiated for ABI reasons. (We may be able to introduce additional register units for this in another patch).
  • I decided not to add forward walking support as that only works reliably with kill flags which are intended to be remove long term.
  • This patch applies on top of http://reviews.llvm.org/D21885 but it shouldn't be too hard to rebase if

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 62452.Jun 30 2016, 5:52 PM
MatzeB retitled this revision from to Add LiveRegUnits class..
MatzeB updated this object.
MatzeB added a reviewer: qcolombet.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
qcolombet accepted this revision.Jul 21 2016, 3:50 PM
qcolombet edited edge metadata.

Hi Matthias,

LGTM modulo nitpicks on the name of the regmask method.

Cheers,
-Quentin

include/llvm/CodeGen/LiveRegUnits.h
77 ↗(On Diff #62452)

Maybe rename the method into removeRegsNotPreservedByMask because unless we read the comment each time we see an instance of that call, I believe we would infer that it does the opposite.

95 ↗(On Diff #62452)

I am not sure I am happy adding the pristine register at this point. I understand why we need that, but my concern is that the name of does not convey (again without looking at the comments) that the pristine are added. Anyhow, that is consistent with LivePhysReg so fine, however, we should have a variant without the pristine.

Perhaps you wanted to add it only when we need it… and I can live with that.
The bottom line is that you can ignore that comment :P.

This revision is now accepted and ready to land.Jul 21 2016, 3:50 PM
This revision was automatically updated to reflect the committed changes.
MatzeB marked an inline comment as done.Aug 18 2016, 3:20 PM
MatzeB added inline comments.
include/llvm/CodeGen/LiveRegUnits.h
95 ↗(On Diff #62452)

Most users want the variant with the pristine registers (esp. the ones that do not know what pristine registers are), so I think it is warranted to use the simple name for this. Of course we should add the variant without pristine registers as soon as we need it.

In the interest of not having this lying around uncommitted for much longer, I am committing this without the RegisterScavenging parts (the RegisterScavenging rewrite this was based on caused build failures).