Pluggable coalescers inplementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41743 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Greene
2007-09-06 16:18:45 +00:00
parent 455e176ffb
commit 2c17c4d8d9
7 changed files with 238 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/CodeGen/RegisterCoalescer.h"
#include "llvm/CodeGen/SSARegMap.h"
#include "llvm/Target/MRegisterInfo.h"
#include "llvm/Target/TargetMachine.h"
@ -96,7 +97,9 @@ namespace {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveIntervals>();
AU.addRequiredID(SimpleRegisterCoalescingID);
// Make sure PassManager knows which analyses to make available
// to coalescing and which analyses coalescing invalidates.
AU.addRequiredTransitive<RegisterCoalescer>();
MachineFunctionPass::getAnalysisUsage(AU);
}
@ -194,6 +197,11 @@ bool RALinScan::runOnMachineFunction(MachineFunction &fn) {
mri_ = tm_->getRegisterInfo();
li_ = &getAnalysis<LiveIntervals>();
// We don't run the coalescer here because we have no reason to
// interact with it. If the coalescer requires interaction, it
// won't do anything. If it doesn't require interaction, we assume
// it was run as a separate pass.
// If this is the first function compiled, compute the related reg classes.
if (RelatedRegClasses.empty())
ComputeRelatedRegClasses();