mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-04 02:40:42 +00:00
Add a hook for PBQP clients to run a custom pre-alloc pass to run prior to PBQP allocation. Patch by Arnaud Allard de Grandmaison.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d589099eec
commit
8d857660ce
@ -161,7 +161,8 @@ namespace llvm {
|
|||||||
PBQP::PBQPNum benefit);
|
PBQP::PBQPNum benefit);
|
||||||
};
|
};
|
||||||
|
|
||||||
FunctionPass* createPBQPRegisterAllocator(std::auto_ptr<PBQPBuilder> builder);
|
FunctionPass* createPBQPRegisterAllocator(std::auto_ptr<PBQPBuilder> builder,
|
||||||
|
char *customPassID=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* LLVM_CODEGEN_REGALLOCPBQP_H */
|
#endif /* LLVM_CODEGEN_REGALLOCPBQP_H */
|
||||||
|
@ -84,8 +84,8 @@ public:
|
|||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
/// Construct a PBQP register allocator.
|
/// Construct a PBQP register allocator.
|
||||||
RegAllocPBQP(std::auto_ptr<PBQPBuilder> b)
|
RegAllocPBQP(std::auto_ptr<PBQPBuilder> b, char *cPassID=0)
|
||||||
: MachineFunctionPass(ID), builder(b) {
|
: MachineFunctionPass(ID), builder(b), customPassID(cPassID) {
|
||||||
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
|
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
|
||||||
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
|
initializeLiveIntervalsPass(*PassRegistry::getPassRegistry());
|
||||||
initializeRegisterCoalescerAnalysisGroup(*PassRegistry::getPassRegistry());
|
initializeRegisterCoalescerAnalysisGroup(*PassRegistry::getPassRegistry());
|
||||||
@ -122,6 +122,8 @@ private:
|
|||||||
|
|
||||||
std::auto_ptr<PBQPBuilder> builder;
|
std::auto_ptr<PBQPBuilder> builder;
|
||||||
|
|
||||||
|
char *customPassID;
|
||||||
|
|
||||||
MachineFunction *mf;
|
MachineFunction *mf;
|
||||||
const TargetMachine *tm;
|
const TargetMachine *tm;
|
||||||
const TargetRegisterInfo *tri;
|
const TargetRegisterInfo *tri;
|
||||||
@ -449,6 +451,8 @@ void RegAllocPBQP::getAnalysisUsage(AnalysisUsage &au) const {
|
|||||||
au.addRequired<LiveIntervals>();
|
au.addRequired<LiveIntervals>();
|
||||||
//au.addRequiredID(SplitCriticalEdgesID);
|
//au.addRequiredID(SplitCriticalEdgesID);
|
||||||
au.addRequired<RegisterCoalescer>();
|
au.addRequired<RegisterCoalescer>();
|
||||||
|
if (customPassID)
|
||||||
|
au.addRequiredID(*customPassID);
|
||||||
au.addRequired<CalculateSpillWeights>();
|
au.addRequired<CalculateSpillWeights>();
|
||||||
au.addRequired<LiveStacks>();
|
au.addRequired<LiveStacks>();
|
||||||
au.addPreserved<LiveStacks>();
|
au.addPreserved<LiveStacks>();
|
||||||
@ -702,8 +706,9 @@ bool RegAllocPBQP::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FunctionPass* llvm::createPBQPRegisterAllocator(
|
FunctionPass* llvm::createPBQPRegisterAllocator(
|
||||||
std::auto_ptr<PBQPBuilder> builder) {
|
std::auto_ptr<PBQPBuilder> builder,
|
||||||
return new RegAllocPBQP(builder);
|
char *customPassID) {
|
||||||
|
return new RegAllocPBQP(builder, customPassID);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionPass* llvm::createDefaultPBQPRegisterAllocator() {
|
FunctionPass* llvm::createDefaultPBQPRegisterAllocator() {
|
||||||
|
Loading…
Reference in New Issue
Block a user