Have SPU backend use the external TCE scheduler, if the library is loaded as a

module.

Patch by Pekka Jääskeläinen.

llvm-svn: 138037
This commit is contained in:
Kalle Raiskila 2011-08-19 10:50:24 +00:00
parent a87bee84cf
commit 024d2614b6
1 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "llvm/CodeGen/RegAllocRegistry.h"
#include "llvm/CodeGen/SchedulerRegistry.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/DynamicLibrary.h"
using namespace llvm;
@ -59,6 +60,16 @@ bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
bool SPUTargetMachine::
addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
{
// load the TCE instruction scheduler, if available via
// loaded plugins
typedef llvm::FunctionPass* (*BuilderFunc)(const char*);
BuilderFunc schedulerCreator =
(BuilderFunc)llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(
"createTCESchedulerPass");
if (schedulerCreator != NULL)
PM.add(schedulerCreator("cellspu"));
//align instructions with nops/lnops for dual issue
PM.add(createSPUNopFillerPass(*this));
return true;