Page MenuHomePhabricator

[TableGen] Emit OperandType enums for RegisterOperands/RegisterClasses
ClosedPublic

Authored by nlguillemot on Aug 26 2019, 4:19 PM.

Details

Reviewers
ab
dsanders
bogner
Summary

The OpTypes::OperandType was creating an enum for all records that inherit from
Operand, but in reality there are operands for instructions that inherit from
other types too. In particular, RegisterOperand and RegisterClass. This
commit adds those types to the list of operand types that are tracked by
the OperandType enum.

Diff Detail

Event Timeline

nlguillemot created this revision.Aug 26 2019, 4:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2019, 4:19 PM
dsanders added inline comments.Wed, Sep 18, 12:50 PM
utils/TableGen/InstrInfoEmitter.cpp
347–355

Wouldn't it be simpler to have:

for (const std::vector<Record *> &CurrentVec
        : { &Operands, &RegisterOperands, &RegisterClasses }) {
  for (const Record *Op : CurrentVec) {
nlguillemot marked an inline comment as done.Wed, Sep 18, 1:00 PM
nlguillemot added inline comments.
utils/TableGen/InstrInfoEmitter.cpp
347–355

I think my thought process at the time was that I didn't want to "hard code" the fact that the data comes from a vector... but yeah it's complex and I think I like your suggestion better.

dsanders accepted this revision.Wed, Sep 18, 1:02 PM

LGTM with that change

This revision is now accepted and ready to land.Wed, Sep 18, 1:02 PM

Refactored loop over the list of vectors to avoid the tricky array/pointer loops.

Committed revision 372641