This is an archive of the discontinued LLVM Phabricator instance.

[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.Sep 18 2019, 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.Sep 18 2019, 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.Sep 18 2019, 1:02 PM

LGTM with that change

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

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

Committed revision 372641