[PATCH] D97722: [NewPM] Revamp pass names
Madhur Amilkanthwar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 11:12:33 PST 2021
madhur13490 added a comment.
In D97722#2595404 <https://reviews.llvm.org/D97722#2595404>, @aeubanks wrote:
> I'd like to get some feedback to see if this is reasonable before fixing up the tests and adding a description
The downside of this approach is that we no longer see raw strings in PassRegistry.def which were aiding "grep"ing the names of passes. With this pass, developers will have to go to the pass, see its name() to find the name. Another downside, this patch touches a lot of files but since you have already went through that pain, it may no longer seen as pain point.
A slightly different approach:
1. Have a static table of pass class name and its corresponding string representation. Something like,
static std::map<StringRef, StringRef> PassNames = {{"DDGAnalysis", "ddg"}, {"DependeceAnalysis", "da"}}
2. Have a static function getName() in PassInfoMixin which uses ` __PRETTY_FUNCTION__` to get the name of the derived class to index into this table to retrieve its string representation. This is somewhat similar to current technique except that the name is now used as the index into the above table.
This way all derived mixins and their string representation would reside at one place and easy to look. Moreover, you could avoid touching all the files because PassInfoMixin is providing the definition and deriving the name using derived type name.
(FWIW, for 1, we can write TD files and a new a TableGen backend to emit the table.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97722/new/
https://reviews.llvm.org/D97722
More information about the llvm-commits
mailing list