Page MenuHomePhabricator

Eliminate implicit Register->unsigned conversions in VirtRegMap. NFC
ClosedPublic

Authored by dsanders on Aug 2 2019, 5:26 PM.

Details

Summary

This was mostly an experiment to assess the feasibility of completely
eliminating a problematic implicit conversion case in D61321 in advance of
landing that* but it also happens to align with the goal of propagating the
use of Register/MCRegister instead of unsigned so I believe it makes sense
to commit it.

The overall process for eliminating the implicit conversions from
Register/MCRegister -> unsigned was to:

  1. Add an explicit conversion to support genuinely required conversions to unsigned. For example, using them as an index for IndexedMap. Sadly it's not possible to have an explicit and implicit conversion to the same type and only deprecate the implicit one so I called the explicit conversion get().
  2. Temporarily annotate the implicit conversion to unsigned with LLVM_ATTRIBUTE_DEPRECATED to make them visible
  3. Eliminate implicit conversions by propagating Register/MCRegister/ explicit-conversions appropriately
  4. Remove the deprecation added in 2.
  • My conclusion is that it isn't feasible as there's too much code to update in one go.

Depends on D65678

Event Timeline

dsanders created this revision.Aug 2 2019, 5:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2019, 5:26 PM
arsenm added inline comments.Aug 2 2019, 8:28 PM
llvm/include/llvm/CodeGen/Register.h
109

I would somewhat prefer to call this value() or getValue()

dsanders marked an inline comment as done.Aug 2 2019, 8:32 PM
dsanders added inline comments.
llvm/include/llvm/CodeGen/Register.h
109

Hmm, SrcReg.value() would give the wrong impression. SrcReg.id()?

dsanders updated this revision to Diff 214057.Aug 7 2019, 7:49 PM

Renamed Register::get() to Register::id(). The reason for not going with value()
is that it sounds too much like accessing the contents of the register.

arsenm accepted this revision.Aug 12 2019, 4:37 PM

LGTM

This revision is now accepted and ready to land.Aug 12 2019, 4:37 PM
This revision was automatically updated to reflect the committed changes.