This is an archive of the discontinued LLVM Phabricator instance.

[MC] Make more use of MCInstrDesc::operands. NFC.
ClosedPublic

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

Details

Summary

Change MCInstrDesc::operands to return an ArrayRef so we can easily use
it everywhere instead of the (IMHO ugly) opInfo_begin and opInfo_end.
A future patch will remove opInfo_begin and opInfo_end.

Also use it instead of raw access to the OpInfo pointer. A future patch
will remove this pointer.

Diff Detail

Event Timeline

foad created this revision.Jan 20 2023, 7:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 7:14 AM
foad requested review of this revision.Jan 20 2023, 7:14 AM
Herald added a project: Restricted Project. · View Herald Transcript
foad added inline comments.Jan 20 2023, 7:29 AM
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
5126–5127

Just wanted to highlight this pre-existing bug, which I did not feel like trying to fix as part of this patch.

arsenm accepted this revision.Jan 20 2023, 7:29 AM
This revision is now accepted and ready to land.Jan 20 2023, 7:29 AM
barannikov88 added inline comments.
llvm/include/llvm/MC/MCInstrDesc.h
238–239

Why does it not return a canonical iterator_range?

barannikov88 added inline comments.Jan 20 2023, 7:41 AM
llvm/include/llvm/MC/MCInstrDesc.h
238–239

Sorry, I got it. This is so that you can use operands()[i].

This revision was landed with ongoing or failed builds.Jan 23 2023, 3:32 AM
This revision was automatically updated to reflect the committed changes.