Add all codegen passes to the PassManager via TargetPassConfig.

This is a preliminary step toward having TargetPassConfig be able to
start and stop the compilation at specified passes for unit testing
and debugging.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159567 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2012-07-02 19:48:31 +00:00
parent 8add7b48d2
commit 564fbf6aff
14 changed files with 113 additions and 100 deletions

View File

@ -55,9 +55,11 @@ public:
/// optimization after regalloc. /// optimization after regalloc.
static char PostRAMachineLICMID; static char PostRAMachineLICMID;
private:
PassManagerBase *PM;
protected: protected:
TargetMachine *TM; TargetMachine *TM;
PassManagerBase *PM;
PassConfigImpl *Impl; // Internal data structures PassConfigImpl *Impl; // Internal data structures
bool Initialized; // Flagged after all passes are configured. bool Initialized; // Flagged after all passes are configured.
@ -122,6 +124,9 @@ public:
/// transforms following machine independent optimization. /// transforms following machine independent optimization.
virtual void addIRPasses(); virtual void addIRPasses();
/// Add passes to lower exception handling for the code generator.
void addPassesToHandleExceptions();
/// Add common passes that perform LLVM IR to IR transforms in preparation for /// Add common passes that perform LLVM IR to IR transforms in preparation for
/// instruction selection. /// instruction selection.
virtual void addISelPrepare(); virtual void addISelPrepare();
@ -235,6 +240,9 @@ protected:
/// Return the pass that was added, or NoPassID. /// Return the pass that was added, or NoPassID.
AnalysisID addPass(char &ID); AnalysisID addPass(char &ID);
/// Add a pass to the PassManager.
void addPass(Pass *P);
/// addMachinePasses helper to create the target-selected or overriden /// addMachinePasses helper to create the target-selected or overriden
/// regalloc pass. /// regalloc pass.
FunctionPass *createRegAllocPass(bool Optimized); FunctionPass *createRegAllocPass(bool Optimized);
@ -242,7 +250,7 @@ protected:
/// printAndVerify - Add a pass to dump then verify the machine function, if /// printAndVerify - Add a pass to dump then verify the machine function, if
/// those steps are enabled. /// those steps are enabled.
/// ///
void printAndVerify(const char *Banner) const; void printAndVerify(const char *Banner);
}; };
} // namespace llvm } // namespace llvm

View File

@ -78,34 +78,6 @@ LLVMTargetMachine::LLVMTargetMachine(const Target &T, StringRef Triple,
"and that InitializeAllTargetMCs() is being invoked!"); "and that InitializeAllTargetMCs() is being invoked!");
} }
/// Turn exception handling constructs into something the code generators can
/// handle.
static void addPassesToHandleExceptions(TargetMachine *TM,
PassManagerBase &PM) {
switch (TM->getMCAsmInfo()->getExceptionHandlingType()) {
case ExceptionHandling::SjLj:
// SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
// Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
// catch info can get misplaced when a selector ends up more than one block
// removed from the parent invoke(s). This could happen when a landing
// pad is shared by multiple invokes and is also a target of a normal
// edge from elsewhere.
PM.add(createSjLjEHPreparePass(TM->getTargetLowering()));
// FALLTHROUGH
case ExceptionHandling::DwarfCFI:
case ExceptionHandling::ARM:
case ExceptionHandling::Win64:
PM.add(createDwarfEHPass(TM));
break;
case ExceptionHandling::None:
PM.add(createLowerInvokePass(TM->getTargetLowering()));
// The lower invoke pass may create unreachable code. Remove it.
PM.add(createUnreachableBlockEliminationPass());
break;
}
}
/// addPassesToX helper drives creation and initialization of TargetPassConfig. /// addPassesToX helper drives creation and initialization of TargetPassConfig.
static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM, static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM,
PassManagerBase &PM, PassManagerBase &PM,
@ -120,7 +92,7 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM,
PassConfig->addIRPasses(); PassConfig->addIRPasses();
addPassesToHandleExceptions(TM, PM); PassConfig->addPassesToHandleExceptions();
PassConfig->addISelPrepare(); PassConfig->addISelPrepare();

View File

@ -22,6 +22,7 @@
#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/Assembly/PrintModulePass.h" #include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
@ -215,7 +216,7 @@ TargetPassConfig::~TargetPassConfig() {
// Out of line constructor provides default values for pass options and // Out of line constructor provides default values for pass options and
// registers all common codegen passes. // registers all common codegen passes.
TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm) TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm)
: ImmutablePass(ID), TM(tm), PM(&pm), Impl(0), Initialized(false), : ImmutablePass(ID), PM(&pm), TM(tm), Impl(0), Initialized(false),
DisableVerify(false), DisableVerify(false),
EnableTailMerge(true) { EnableTailMerge(true) {
@ -272,6 +273,11 @@ AnalysisID TargetPassConfig::getPassSubstitution(AnalysisID ID) const {
return I->second; return I->second;
} }
/// Add a pass to the PassManager.
void TargetPassConfig::addPass(Pass *P) {
PM->add(P);
}
/// Add a CodeGen pass at this point in the pipeline after checking for target /// Add a CodeGen pass at this point in the pipeline after checking for target
/// and command line overrides. /// and command line overrides.
AnalysisID TargetPassConfig::addPass(char &ID) { AnalysisID TargetPassConfig::addPass(char &ID) {
@ -285,7 +291,7 @@ AnalysisID TargetPassConfig::addPass(char &ID) {
Pass *P = Pass::createPass(FinalID); Pass *P = Pass::createPass(FinalID);
if (!P) if (!P)
llvm_unreachable("Pass ID not registered"); llvm_unreachable("Pass ID not registered");
PM->add(P); addPass(P);
// Add the passes after the pass P if there is any. // Add the passes after the pass P if there is any.
for (SmallVector<std::pair<AnalysisID, AnalysisID>, 4>::iterator for (SmallVector<std::pair<AnalysisID, AnalysisID>, 4>::iterator
I = Impl->InsertedPasses.begin(), E = Impl->InsertedPasses.end(); I = Impl->InsertedPasses.begin(), E = Impl->InsertedPasses.end();
@ -294,18 +300,18 @@ AnalysisID TargetPassConfig::addPass(char &ID) {
assert((*I).second && "Illegal Pass ID!"); assert((*I).second && "Illegal Pass ID!");
Pass *NP = Pass::createPass((*I).second); Pass *NP = Pass::createPass((*I).second);
assert(NP && "Pass ID not registered"); assert(NP && "Pass ID not registered");
PM->add(NP); addPass(NP);
} }
} }
return FinalID; return FinalID;
} }
void TargetPassConfig::printAndVerify(const char *Banner) const { void TargetPassConfig::printAndVerify(const char *Banner) {
if (TM->shouldPrintMachineCode()) if (TM->shouldPrintMachineCode())
PM->add(createMachineFunctionPrinterPass(dbgs(), Banner)); addPass(createMachineFunctionPrinterPass(dbgs(), Banner));
if (VerifyMachineCode) if (VerifyMachineCode)
PM->add(createMachineVerifierPass(Banner)); addPass(createMachineVerifierPass(Banner));
} }
/// Add common target configurable passes that perform LLVM IR to IR transforms /// Add common target configurable passes that perform LLVM IR to IR transforms
@ -315,46 +321,73 @@ void TargetPassConfig::addIRPasses() {
// Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
// BasicAliasAnalysis wins if they disagree. This is intended to help // BasicAliasAnalysis wins if they disagree. This is intended to help
// support "obvious" type-punning idioms. // support "obvious" type-punning idioms.
PM->add(createTypeBasedAliasAnalysisPass()); addPass(createTypeBasedAliasAnalysisPass());
PM->add(createBasicAliasAnalysisPass()); addPass(createBasicAliasAnalysisPass());
// Before running any passes, run the verifier to determine if the input // Before running any passes, run the verifier to determine if the input
// coming from the front-end and/or optimizer is valid. // coming from the front-end and/or optimizer is valid.
if (!DisableVerify) if (!DisableVerify)
PM->add(createVerifierPass()); addPass(createVerifierPass());
// Run loop strength reduction before anything else. // Run loop strength reduction before anything else.
if (getOptLevel() != CodeGenOpt::None && !DisableLSR) { if (getOptLevel() != CodeGenOpt::None && !DisableLSR) {
PM->add(createLoopStrengthReducePass(getTargetLowering())); addPass(createLoopStrengthReducePass(getTargetLowering()));
if (PrintLSR) if (PrintLSR)
PM->add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs())); addPass(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs()));
} }
PM->add(createGCLoweringPass()); addPass(createGCLoweringPass());
// Make sure that no unreachable blocks are instruction selected. // Make sure that no unreachable blocks are instruction selected.
PM->add(createUnreachableBlockEliminationPass()); addPass(createUnreachableBlockEliminationPass());
}
/// Turn exception handling constructs into something the code generators can
/// handle.
void TargetPassConfig::addPassesToHandleExceptions() {
switch (TM->getMCAsmInfo()->getExceptionHandlingType()) {
case ExceptionHandling::SjLj:
// SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
// Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
// catch info can get misplaced when a selector ends up more than one block
// removed from the parent invoke(s). This could happen when a landing
// pad is shared by multiple invokes and is also a target of a normal
// edge from elsewhere.
addPass(createSjLjEHPreparePass(TM->getTargetLowering()));
// FALLTHROUGH
case ExceptionHandling::DwarfCFI:
case ExceptionHandling::ARM:
case ExceptionHandling::Win64:
addPass(createDwarfEHPass(TM));
break;
case ExceptionHandling::None:
addPass(createLowerInvokePass(TM->getTargetLowering()));
// The lower invoke pass may create unreachable code. Remove it.
addPass(createUnreachableBlockEliminationPass());
break;
}
} }
/// Add common passes that perform LLVM IR to IR transforms in preparation for /// Add common passes that perform LLVM IR to IR transforms in preparation for
/// instruction selection. /// instruction selection.
void TargetPassConfig::addISelPrepare() { void TargetPassConfig::addISelPrepare() {
if (getOptLevel() != CodeGenOpt::None && !DisableCGP) if (getOptLevel() != CodeGenOpt::None && !DisableCGP)
PM->add(createCodeGenPreparePass(getTargetLowering())); addPass(createCodeGenPreparePass(getTargetLowering()));
PM->add(createStackProtectorPass(getTargetLowering())); addPass(createStackProtectorPass(getTargetLowering()));
addPreISel(); addPreISel();
if (PrintISelInput) if (PrintISelInput)
PM->add(createPrintFunctionPass("\n\n" addPass(createPrintFunctionPass("\n\n"
"*** Final LLVM Code input to ISel ***\n", "*** Final LLVM Code input to ISel ***\n",
&dbgs())); &dbgs()));
// All passes which modify the LLVM IR are now complete; run the verifier // All passes which modify the LLVM IR are now complete; run the verifier
// to ensure that the IR is valid. // to ensure that the IR is valid.
if (!DisableVerify) if (!DisableVerify)
PM->add(createVerifierPass()); addPass(createVerifierPass());
} }
/// Add the complete set of target-independent postISel code generator passes. /// Add the complete set of target-independent postISel code generator passes.
@ -447,7 +480,7 @@ void TargetPassConfig::addMachinePasses() {
// GC // GC
addPass(GCMachineCodeAnalysisID); addPass(GCMachineCodeAnalysisID);
if (PrintGCInfo) if (PrintGCInfo)
PM->add(createGCInfoPrinter(dbgs())); addPass(createGCInfoPrinter(dbgs()));
// Basic block placement. // Basic block placement.
if (getOptLevel() != CodeGenOpt::None) if (getOptLevel() != CodeGenOpt::None)
@ -564,7 +597,7 @@ void TargetPassConfig::addFastRegAlloc(FunctionPass *RegAllocPass) {
addPass(PHIEliminationID); addPass(PHIEliminationID);
addPass(TwoAddressInstructionPassID); addPass(TwoAddressInstructionPassID);
PM->add(RegAllocPass); addPass(RegAllocPass);
printAndVerify("After Register Allocation"); printAndVerify("After Register Allocation");
} }
@ -602,7 +635,7 @@ void TargetPassConfig::addOptimizedRegAlloc(FunctionPass *RegAllocPass) {
printAndVerify("After Machine Scheduling"); printAndVerify("After Machine Scheduling");
// Add the selected register allocation pass. // Add the selected register allocation pass.
PM->add(RegAllocPass); addPass(RegAllocPass);
printAndVerify("After Register Allocation, before rewriter"); printAndVerify("After Register Allocation, before rewriter");
// Allow targets to change the register assignments before rewriting. // Allow targets to change the register assignments before rewriting.

View File

@ -136,22 +136,22 @@ TargetPassConfig *ARMBaseTargetMachine::createPassConfig(PassManagerBase &PM) {
bool ARMPassConfig::addPreISel() { bool ARMPassConfig::addPreISel() {
if (TM->getOptLevel() != CodeGenOpt::None && EnableGlobalMerge) if (TM->getOptLevel() != CodeGenOpt::None && EnableGlobalMerge)
PM->add(createGlobalMergePass(TM->getTargetLowering())); addPass(createGlobalMergePass(TM->getTargetLowering()));
return false; return false;
} }
bool ARMPassConfig::addInstSelector() { bool ARMPassConfig::addInstSelector() {
PM->add(createARMISelDag(getARMTargetMachine(), getOptLevel())); addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
return false; return false;
} }
bool ARMPassConfig::addPreRegAlloc() { bool ARMPassConfig::addPreRegAlloc() {
// FIXME: temporarily disabling load / store optimization pass for Thumb1. // FIXME: temporarily disabling load / store optimization pass for Thumb1.
if (getOptLevel() != CodeGenOpt::None && !getARMSubtarget().isThumb1Only()) if (getOptLevel() != CodeGenOpt::None && !getARMSubtarget().isThumb1Only())
PM->add(createARMLoadStoreOptimizationPass(true)); addPass(createARMLoadStoreOptimizationPass(true));
if (getOptLevel() != CodeGenOpt::None && getARMSubtarget().isCortexA9()) if (getOptLevel() != CodeGenOpt::None && getARMSubtarget().isCortexA9())
PM->add(createMLxExpansionPass()); addPass(createMLxExpansionPass());
return true; return true;
} }
@ -159,23 +159,23 @@ bool ARMPassConfig::addPreSched2() {
// FIXME: temporarily disabling load / store optimization pass for Thumb1. // FIXME: temporarily disabling load / store optimization pass for Thumb1.
if (getOptLevel() != CodeGenOpt::None) { if (getOptLevel() != CodeGenOpt::None) {
if (!getARMSubtarget().isThumb1Only()) { if (!getARMSubtarget().isThumb1Only()) {
PM->add(createARMLoadStoreOptimizationPass()); addPass(createARMLoadStoreOptimizationPass());
printAndVerify("After ARM load / store optimizer"); printAndVerify("After ARM load / store optimizer");
} }
if (getARMSubtarget().hasNEON()) if (getARMSubtarget().hasNEON())
PM->add(createExecutionDependencyFixPass(&ARM::DPRRegClass)); addPass(createExecutionDependencyFixPass(&ARM::DPRRegClass));
} }
// Expand some pseudo instructions into multiple instructions to allow // Expand some pseudo instructions into multiple instructions to allow
// proper scheduling. // proper scheduling.
PM->add(createARMExpandPseudoPass()); addPass(createARMExpandPseudoPass());
if (getOptLevel() != CodeGenOpt::None) { if (getOptLevel() != CodeGenOpt::None) {
if (!getARMSubtarget().isThumb1Only()) if (!getARMSubtarget().isThumb1Only())
addPass(IfConverterID); addPass(IfConverterID);
} }
if (getARMSubtarget().isThumb2()) if (getARMSubtarget().isThumb2())
PM->add(createThumb2ITBlockPass()); addPass(createThumb2ITBlockPass());
return true; return true;
} }
@ -183,13 +183,13 @@ bool ARMPassConfig::addPreSched2() {
bool ARMPassConfig::addPreEmitPass() { bool ARMPassConfig::addPreEmitPass() {
if (getARMSubtarget().isThumb2()) { if (getARMSubtarget().isThumb2()) {
if (!getARMSubtarget().prefers32BitThumb()) if (!getARMSubtarget().prefers32BitThumb())
PM->add(createThumb2SizeReductionPass()); addPass(createThumb2SizeReductionPass());
// Constant island pass work on unbundled instructions. // Constant island pass work on unbundled instructions.
addPass(UnpackMachineBundlesID); addPass(UnpackMachineBundlesID);
} }
PM->add(createARMConstantIslandPass()); addPass(createARMConstantIslandPass());
return true; return true;
} }

View File

@ -72,7 +72,7 @@ TargetPassConfig *SPUTargetMachine::createPassConfig(PassManagerBase &PM) {
bool SPUPassConfig::addInstSelector() { bool SPUPassConfig::addInstSelector() {
// Install an instruction selector. // Install an instruction selector.
PM->add(createSPUISelDag(getSPUTargetMachine())); addPass(createSPUISelDag(getSPUTargetMachine()));
return false; return false;
} }
@ -85,9 +85,9 @@ bool SPUPassConfig::addPreEmitPass() {
(BuilderFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol( (BuilderFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(
"createTCESchedulerPass"); "createTCESchedulerPass");
if (schedulerCreator != NULL) if (schedulerCreator != NULL)
PM->add(schedulerCreator("cellspu")); addPass(schedulerCreator("cellspu"));
//align instructions with nops/lnops for dual issue //align instructions with nops/lnops for dual issue
PM->add(createSPUNopFillerPass(getSPUTargetMachine())); addPass(createSPUNopFillerPass(getSPUTargetMachine()));
return true; return true;
} }

View File

@ -102,22 +102,22 @@ TargetPassConfig *HexagonTargetMachine::createPassConfig(PassManagerBase &PM) {
} }
bool HexagonPassConfig::addInstSelector() { bool HexagonPassConfig::addInstSelector() {
PM->add(createHexagonRemoveExtendOps(getHexagonTargetMachine())); addPass(createHexagonRemoveExtendOps(getHexagonTargetMachine()));
PM->add(createHexagonISelDag(getHexagonTargetMachine())); addPass(createHexagonISelDag(getHexagonTargetMachine()));
PM->add(createHexagonPeephole()); addPass(createHexagonPeephole());
return false; return false;
} }
bool HexagonPassConfig::addPreRegAlloc() { bool HexagonPassConfig::addPreRegAlloc() {
if (!DisableHardwareLoops) { if (!DisableHardwareLoops) {
PM->add(createHexagonHardwareLoops()); addPass(createHexagonHardwareLoops());
} }
return false; return false;
} }
bool HexagonPassConfig::addPostRegAlloc() { bool HexagonPassConfig::addPostRegAlloc() {
PM->add(createHexagonCFGOptimizer(getHexagonTargetMachine())); addPass(createHexagonCFGOptimizer(getHexagonTargetMachine()));
return true; return true;
} }
@ -130,19 +130,19 @@ bool HexagonPassConfig::addPreSched2() {
bool HexagonPassConfig::addPreEmitPass() { bool HexagonPassConfig::addPreEmitPass() {
if (!DisableHardwareLoops) { if (!DisableHardwareLoops) {
PM->add(createHexagonFixupHwLoops()); addPass(createHexagonFixupHwLoops());
} }
PM->add(createHexagonNewValueJump()); addPass(createHexagonNewValueJump());
// Expand Spill code for predicate registers. // Expand Spill code for predicate registers.
PM->add(createHexagonExpandPredSpillCode(getHexagonTargetMachine())); addPass(createHexagonExpandPredSpillCode(getHexagonTargetMachine()));
// Split up TFRcondsets into conditional transfers. // Split up TFRcondsets into conditional transfers.
PM->add(createHexagonSplitTFRCondSets(getHexagonTargetMachine())); addPass(createHexagonSplitTFRCondSets(getHexagonTargetMachine()));
// Create Packets. // Create Packets.
PM->add(createHexagonPacketizer()); addPass(createHexagonPacketizer());
return false; return false;
} }

View File

@ -68,7 +68,7 @@ TargetPassConfig *MBlazeTargetMachine::createPassConfig(PassManagerBase &PM) {
// Install an instruction selector pass using // Install an instruction selector pass using
// the ISelDag to gen MBlaze code. // the ISelDag to gen MBlaze code.
bool MBlazePassConfig::addInstSelector() { bool MBlazePassConfig::addInstSelector() {
PM->add(createMBlazeISelDag(getMBlazeTargetMachine())); addPass(createMBlazeISelDag(getMBlazeTargetMachine()));
return false; return false;
} }
@ -76,6 +76,6 @@ bool MBlazePassConfig::addInstSelector() {
// machine code is emitted. return true if -print-machineinstrs should // machine code is emitted. return true if -print-machineinstrs should
// print out the code after the passes. // print out the code after the passes.
bool MBlazePassConfig::addPreEmitPass() { bool MBlazePassConfig::addPreEmitPass() {
PM->add(createMBlazeDelaySlotFillerPass(getMBlazeTargetMachine())); addPass(createMBlazeDelaySlotFillerPass(getMBlazeTargetMachine()));
return true; return true;
} }

View File

@ -60,12 +60,12 @@ TargetPassConfig *MSP430TargetMachine::createPassConfig(PassManagerBase &PM) {
bool MSP430PassConfig::addInstSelector() { bool MSP430PassConfig::addInstSelector() {
// Install an instruction selector. // Install an instruction selector.
PM->add(createMSP430ISelDag(getMSP430TargetMachine(), getOptLevel())); addPass(createMSP430ISelDag(getMSP430TargetMachine(), getOptLevel()));
return false; return false;
} }
bool MSP430PassConfig::addPreEmitPass() { bool MSP430PassConfig::addPreEmitPass() {
// Must run branch selection immediately preceding the asm printer. // Must run branch selection immediately preceding the asm printer.
PM->add(createMSP430BranchSelectionPass()); addPass(createMSP430BranchSelectionPass());
return false; return false;
} }

View File

@ -116,7 +116,7 @@ TargetPassConfig *MipsTargetMachine::createPassConfig(PassManagerBase &PM) {
// Install an instruction selector pass using // Install an instruction selector pass using
// the ISelDag to gen Mips code. // the ISelDag to gen Mips code.
bool MipsPassConfig::addInstSelector() { bool MipsPassConfig::addInstSelector() {
PM->add(createMipsISelDag(getMipsTargetMachine())); addPass(createMipsISelDag(getMipsTargetMachine()));
return false; return false;
} }
@ -125,11 +125,11 @@ bool MipsPassConfig::addInstSelector() {
// print out the code after the passes. // print out the code after the passes.
bool MipsPassConfig::addPreEmitPass() { bool MipsPassConfig::addPreEmitPass() {
MipsTargetMachine &TM = getMipsTargetMachine(); MipsTargetMachine &TM = getMipsTargetMachine();
PM->add(createMipsDelaySlotFillerPass(TM)); addPass(createMipsDelaySlotFillerPass(TM));
// NOTE: long branch has not been implemented for mips16. // NOTE: long branch has not been implemented for mips16.
if (TM.getSubtarget<MipsSubtarget>().hasStandardEncoding()) if (TM.getSubtarget<MipsSubtarget>().hasStandardEncoding())
PM->add(createMipsLongBranchPass(TM)); addPass(createMipsLongBranchPass(TM));
return true; return true;
} }

View File

@ -120,11 +120,11 @@ TargetPassConfig *NVPTXTargetMachine::createPassConfig(PassManagerBase &PM) {
} }
bool NVPTXPassConfig::addInstSelector() { bool NVPTXPassConfig::addInstSelector() {
PM->add(createLowerAggrCopies()); addPass(createLowerAggrCopies());
PM->add(createSplitBBatBarPass()); addPass(createSplitBBatBarPass());
PM->add(createAllocaHoisting()); addPass(createAllocaHoisting());
PM->add(createNVPTXISelDag(getNVPTXTargetMachine(), getOptLevel())); addPass(createNVPTXISelDag(getNVPTXTargetMachine(), getOptLevel()));
PM->add(createVectorElementizePass(getNVPTXTargetMachine())); addPass(createVectorElementizePass(getNVPTXTargetMachine()));
return false; return false;
} }

View File

@ -98,20 +98,20 @@ TargetPassConfig *PPCTargetMachine::createPassConfig(PassManagerBase &PM) {
bool PPCPassConfig::addPreRegAlloc() { bool PPCPassConfig::addPreRegAlloc() {
if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
PM->add(createPPCCTRLoops()); addPass(createPPCCTRLoops());
return false; return false;
} }
bool PPCPassConfig::addInstSelector() { bool PPCPassConfig::addInstSelector() {
// Install an instruction selector. // Install an instruction selector.
PM->add(createPPCISelDag(getPPCTargetMachine())); addPass(createPPCISelDag(getPPCTargetMachine()));
return false; return false;
} }
bool PPCPassConfig::addPreEmitPass() { bool PPCPassConfig::addPreEmitPass() {
// Must run branch selection immediately preceding the asm printer. // Must run branch selection immediately preceding the asm printer.
PM->add(createPPCBranchSelectionPass()); addPass(createPPCBranchSelectionPass());
return false; return false;
} }

View File

@ -60,7 +60,7 @@ TargetPassConfig *SparcTargetMachine::createPassConfig(PassManagerBase &PM) {
} }
bool SparcPassConfig::addInstSelector() { bool SparcPassConfig::addInstSelector() {
PM->add(createSparcISelDag(getSparcTargetMachine())); addPass(createSparcISelDag(getSparcTargetMachine()));
return false; return false;
} }
@ -68,8 +68,8 @@ bool SparcPassConfig::addInstSelector() {
/// passes immediately before machine code is emitted. This should return /// passes immediately before machine code is emitted. This should return
/// true if -print-machineinstrs should print out the code after the passes. /// true if -print-machineinstrs should print out the code after the passes.
bool SparcPassConfig::addPreEmitPass(){ bool SparcPassConfig::addPreEmitPass(){
PM->add(createSparcFPMoverPass(getSparcTargetMachine())); addPass(createSparcFPMoverPass(getSparcTargetMachine()));
PM->add(createSparcDelaySlotFillerPass(getSparcTargetMachine())); addPass(createSparcDelaySlotFillerPass(getSparcTargetMachine()));
return true; return true;
} }

View File

@ -145,38 +145,38 @@ TargetPassConfig *X86TargetMachine::createPassConfig(PassManagerBase &PM) {
bool X86PassConfig::addInstSelector() { bool X86PassConfig::addInstSelector() {
// Install an instruction selector. // Install an instruction selector.
PM->add(createX86ISelDag(getX86TargetMachine(), getOptLevel())); addPass(createX86ISelDag(getX86TargetMachine(), getOptLevel()));
// For ELF, cleanup any local-dynamic TLS accesses. // For ELF, cleanup any local-dynamic TLS accesses.
if (getX86Subtarget().isTargetELF() && getOptLevel() != CodeGenOpt::None) if (getX86Subtarget().isTargetELF() && getOptLevel() != CodeGenOpt::None)
PM->add(createCleanupLocalDynamicTLSPass()); addPass(createCleanupLocalDynamicTLSPass());
// For 32-bit, prepend instructions to set the "global base reg" for PIC. // For 32-bit, prepend instructions to set the "global base reg" for PIC.
if (!getX86Subtarget().is64Bit()) if (!getX86Subtarget().is64Bit())
PM->add(createGlobalBaseRegPass()); addPass(createGlobalBaseRegPass());
return false; return false;
} }
bool X86PassConfig::addPreRegAlloc() { bool X86PassConfig::addPreRegAlloc() {
PM->add(createX86MaxStackAlignmentHeuristicPass()); addPass(createX86MaxStackAlignmentHeuristicPass());
return false; // -print-machineinstr shouldn't print after this. return false; // -print-machineinstr shouldn't print after this.
} }
bool X86PassConfig::addPostRegAlloc() { bool X86PassConfig::addPostRegAlloc() {
PM->add(createX86FloatingPointStackifierPass()); addPass(createX86FloatingPointStackifierPass());
return true; // -print-machineinstr should print after this. return true; // -print-machineinstr should print after this.
} }
bool X86PassConfig::addPreEmitPass() { bool X86PassConfig::addPreEmitPass() {
bool ShouldPrint = false; bool ShouldPrint = false;
if (getOptLevel() != CodeGenOpt::None && getX86Subtarget().hasSSE2()) { if (getOptLevel() != CodeGenOpt::None && getX86Subtarget().hasSSE2()) {
PM->add(createExecutionDependencyFixPass(&X86::VR128RegClass)); addPass(createExecutionDependencyFixPass(&X86::VR128RegClass));
ShouldPrint = true; ShouldPrint = true;
} }
if (getX86Subtarget().hasAVX() && UseVZeroUpper) { if (getX86Subtarget().hasAVX() && UseVZeroUpper) {
PM->add(createX86IssueVZeroUpperPass()); addPass(createX86IssueVZeroUpperPass());
ShouldPrint = true; ShouldPrint = true;
} }

View File

@ -55,7 +55,7 @@ TargetPassConfig *XCoreTargetMachine::createPassConfig(PassManagerBase &PM) {
} }
bool XCorePassConfig::addInstSelector() { bool XCorePassConfig::addInstSelector() {
PM->add(createXCoreISelDag(getXCoreTargetMachine(), getOptLevel())); addPass(createXCoreISelDag(getXCoreTargetMachine(), getOptLevel()));
return false; return false;
} }