[llvm-dev] Advice for Porting SafeStack to New Pass Manager
Leonard Chan via llvm-dev
llvm-dev at lists.llvm.org
Fri Dec 28 11:09:58 PST 2018
Hello,
I'm in the process of creating a pass for the new PM for SafeStack
which is only available as a part of the legacy PM. The only thing
bugging me is in regards to the TargetPassConfig analysis. Whereas
most other passes/analyses I have seen separate the logic between the
actual pass and anything it does to the IRUnits it runs over are in 2
separate classes, TargetPassConfig has them both in the same class and
many other analysis inherit from this class as well. I also do not
think this analysis has a new PM equivalent.
My question is what would be the correct way to proceed with porting
TargetPassConfig to the new PM? Normally, what I have done before and
what I have seen from other examples is to separate the logic of what
the pass does to an IRUnit and the pass itself into 2 separate
classes, then an instance of the class that contains the logic can be
owned by a pass for the new PM. The only trouble I see with this is
that this will require a lot of refactoring (that I started but
haven't finished), since TargetPassConfig is the parent to many other
passes/analyses and these classes override many virtual methods in
TargetPassConfig, so it may not be the cleanest solution and
potentially prone to a lot of error.
Another potential idea which I am exploring in parallel to the first
is to instead make the existing TargetPassConfig also a pass that
works with the new PM by adding a run() method. This seems like less
work, but feels incorrect since I'm shoving more things into this
class.
Any opinions on this?
Thanks,
Leonard Chan
More information about the llvm-dev
mailing list