X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FTarget%2FAMDGPU%2FAMDGPUTargetMachine.cpp;fp=lib%2FTarget%2FAMDGPU%2FAMDGPUTargetMachine.cpp;h=9d86d653b3c1f931c0dee1dc3b71ff6b30b2b38a;hp=25a395941e9f6def4fd5c9504799e618f0da73d5;hb=a7474fd041dfd89ca05ebfc91d7085eabf1b8f87;hpb=fd813994db6b4c9b6195ccff7113ed03366c67d0 diff --git a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 25a395941e9..9d86d653b3c 100644 --- a/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -42,6 +42,9 @@ extern "C" void LLVMInitializeAMDGPUTarget() { // Register the target RegisterTargetMachine X(TheAMDGPUTarget); RegisterTargetMachine Y(TheGCNTarget); + + PassRegistry *PR = PassRegistry::getPassRegistry(); + initializeSIFixSGPRLiveRangesPass(*PR); } static std::unique_ptr createTLOF(const Triple &TT) { @@ -160,6 +163,8 @@ public: : AMDGPUPassConfig(TM, PM) { } bool addPreISel() override; bool addInstSelector() override; + void addFastRegAlloc(FunctionPass *RegAllocPass) override; + void addOptimizedRegAlloc(FunctionPass *RegAllocPass) override; void addPreRegAlloc() override; void addPostRegAlloc() override; void addPreSched2() override; @@ -294,7 +299,18 @@ void GCNPassConfig::addPreRegAlloc() { insertPass(&MachineSchedulerID, &RegisterCoalescerID); } addPass(createSIShrinkInstructionsPass(), false); - addPass(createSIFixSGPRLiveRangesPass()); +} + +void GCNPassConfig::addFastRegAlloc(FunctionPass *RegAllocPass) { + addPass(&SIFixSGPRLiveRangesID); + TargetPassConfig::addFastRegAlloc(RegAllocPass); +} + +void GCNPassConfig::addOptimizedRegAlloc(FunctionPass *RegAllocPass) { + // We want to run this after LiveVariables is computed to avoid computing them + // twice. + insertPass(&LiveVariablesID, &SIFixSGPRLiveRangesID); + TargetPassConfig::addOptimizedRegAlloc(RegAllocPass); } void GCNPassConfig::addPostRegAlloc() {