[PATCH] D46243: Move Schedule class to header file for allowing inheritance

Atheel Massalha via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 01:48:19 PDT 2018


atheel.ma added a comment.

thanks for your comment, 
I’m implementing an optimization pass analysis that will be used from the TargetHazardRecognizer, so I must pass its result in the constructor of the HazaradRecognizer.
I have encountered some open source classes that I need to expand (using inheritance) but couldn’t due to some reasons:

1. Expanding “MachineSchedulerBase” from MachineScheduler.cpp:

I want to inherit it and expand it (for changing the call of CreateTargetPostRAHazardRecognizer)but I can’t because its declared in cpp file not in header

2. Expanding BasicAAResult from BasicAliasAnalysis.h:

Its inheriting the “AAResultBase<BasicAAResult>” using “Mixin”, it looks like its not designed for been inherited again.

•	In BasicAAResult I have added “CheckBankConflict” functions that uses functions from this class (need to re-design it into TargetBankConflict.cpp)
•	In MachineSchedulerBase I want to change the call for the HazardRecognizer. I need to pass the BasicAAResults when creating the HazaradRecognizer:
llvm::createTargetHazardRecognizer(MachineFunction &MF) (I cant created it inside the HazaradRecognizer because its not a pass)
so I have changed it into:
llvm::createTargetHazardRecognizer(MachineFunction &MF, BasicAAResult *BCA)
and I need to change the functions declaration and implementation that calls it. (functions from (class MachineScheduler : public MachineSchedulerBase ) and more…
so I want to:

- Create TaregtBankConflict.h pass and pass its result to the CXDHazaradRecognizer. For that I will need to:

•	Inherit BasicAAResult for avoiding code copy (I have no solution for it).
•	Inherit MachineScheduler for avoiding code copy. (my suggestion is to move it to the header file)


Repository:
  rL LLVM

https://reviews.llvm.org/D46243





More information about the llvm-commits mailing list