[PATCH] D122832: [TableGen] Add a backend to help with target enums
Min-Yih Hsu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 10 11:45:40 PDT 2022
myhsu added inline comments.
================
Comment at: llvm/utils/TableGen/EnumEmitter.cpp:117
+ // Emit the enum definition itself
+ std::string EnumGuard = "GET_" + EnumName.str() + "_ENUM";
+ OS << "#ifdef " << EnumGuard << "\n";
----------------
I wonder if it will be better to use Twine here?
================
Comment at: llvm/utils/TableGen/EnumEmitter.cpp:141
+ // Emit the print (or 'as string') function definition
+ if (!Enum->isValueUnset("PrintMethod")) {
+ if (HasDuplicateVals)
----------------
can we simplify this using Record::getValueAsOptionalString?
================
Comment at: llvm/utils/TableGen/EnumEmitter.cpp:165
+ // Emit the match (or 'from string') function definition
+ if (!Enum->isValueUnset("MatchMethod")) {
+ SmallSet<StringRef, 8> SeenStrings;
----------------
ditto
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122832/new/
https://reviews.llvm.org/D122832
More information about the llvm-commits
mailing list