This is an archive of the discontinued LLVM Phabricator instance.

[MC] Define and use MCInstrDesc implicit_uses and implicit_defs. NFC.
ClosedPublic

Authored by foad on Jan 20 2023, 7:15 AM.

Details

Summary

The new methods return a range for easier iteration. Use them everywhere
instead of getImplicitUses, getNumImplicitUses, getImplicitDefs and
getNumImplicitDefs. A future patch will remove the old methods.

In some use cases the new methods are less efficient because they always
have to scan the whole uses/defs array to count its length, but that
will be fixed in a future patch by storing the number of implicit
uses/defs explicitly in MCInstrDesc. At that point there will be no need
to 0-terminate the arrays.

Diff Detail

Event Timeline

foad created this revision.Jan 20 2023, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 7:15 AM
foad requested review of this revision.Jan 20 2023, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 7:15 AM
arsenm accepted this revision.Jan 20 2023, 7:40 AM
arsenm added inline comments.
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1942

Just taking the first implicit def looks suspect to me. I'd expect something like MachineInstrBuilder::copyImplicitOps for an MCInstrDesc

llvm/lib/MC/MCInstrDesc.cpp
33–34

Using MRI when that's usually MachineRegisterInfo is a bit jarring. This API that doesn't work correctly if you don't pass it in is also just broken

This revision is now accepted and ready to land.Jan 20 2023, 7:40 AM
foad added inline comments.Jan 23 2023, 6:19 AM
llvm/lib/MC/MCInstrDesc.cpp
33–34

Massive patch to rename MRI to MCRI for MCRegisterInfo throughout llvm/: D142356

foad added inline comments.Jan 23 2023, 6:27 AM
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1942
This revision was landed with ongoing or failed builds.Jan 23 2023, 6:45 AM
This revision was automatically updated to reflect the committed changes.