Page MenuHomePhabricator

[CodeGen] Add begin-end iterators to MachineInstr

Authored by javed.absar on Jul 14 2017, 8:35 AM.



Probably there are more use cases of this,
but I got triggered by the one included in this patch

Diff Detail

Event Timeline

javed.absar created this revision.Jul 14 2017, 8:35 AM

There is already MachineInstr::operands. Why do we need this?

rovka added a subscriber: echristo.
rovka added inline comments.
308 ↗(On Diff #106643)

This looks identical to operands_begin/operands_end. I don't see a good reason for having both.
I don't know what to say about being concise vs being explicit in this context. @echristo, WDYT?


Unless I'm missing something (Friday evening etc etc), you can use

for (const auto &MO : MI->operands())

to the same effect.

echristo added inline comments.Jul 14 2017, 10:07 AM

Agreed, and it's more clear what you mean here.

Ok, I see that now too. Will use MI->operands() as suggested, as that will suffice.

javed.absar marked 2 inline comments as done.
rovka accepted this revision.Jul 17 2017, 1:30 AM


This revision is now accepted and ready to land.Jul 17 2017, 1:30 AM
This revision was automatically updated to reflect the committed changes.