This is an archive of the discontinued LLVM Phabricator instance.

Add MCRegister and use it in MCRegisterClass::contains()
ClosedPublic

Authored by dsanders on Aug 1 2019, 12:02 PM.

Details

Summary

Register can cast to MCRegister and we may want to consider asserting
!isValid() || isPhysical() when expensive checks are on.

Depends on D65554

Diff Detail

Repository
rL LLVM

Event Timeline

dsanders created this revision.Aug 1 2019, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2019, 12:02 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Aug 1 2019, 2:02 PM
llvm/include/llvm/MC/MCRegister.h
18 ↗(On Diff #212877)

MCPhysReg?

21 ↗(On Diff #212877)

MCPhysReg?

53 ↗(On Diff #212877)

I would expect this to be trivially true?

dsanders marked 2 inline comments as done.Aug 1 2019, 2:16 PM
dsanders added inline comments.
llvm/include/llvm/MC/MCRegister.h
18 ↗(On Diff #212877)

I didn't want to change the size but also I didn't want to change the sentinel values for DenseMapInfo which are 0xFFFFFFFF and 0xFFFFFFFE.

53 ↗(On Diff #212877)

It's false for 0 ($noreg) and illegal values. If neither isValid() or isPhysical() are true then something is leaking illegal values into the MC layer.

arsenm accepted this revision.Aug 1 2019, 5:59 PM

LGTM

This revision is now accepted and ready to land.Aug 1 2019, 5:59 PM
This revision was automatically updated to reflect the committed changes.