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

module.

Patch by Pekka Jääskeläinen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138037 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kalle Raiskila 2011-08-19 10:50:24 +00:00
parent e004d941ec
commit 67a9b1fcc7

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;