using namespace llvm;
-/// CellSPUTargetMachineModule - Note that this is used on hosts that
-/// cannot link in a library unless there are references into the
-/// library. In particular, it seems that it is not possible to get
-/// things to work on Win32 without this. Though it is unused, do not
-/// remove it.
-extern "C" int CellSPUTargetMachineModule;
-int CellSPUTargetMachineModule = 0;
-
+extern Target TheCellSPUTarget;
namespace {
// Register the targets
RegisterTarget<SPUTargetMachine>
- CELLSPU("cellspu", "STI CBEA Cell SPU [experimental]");
+ CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]");
}
+// No assembler printer by default
+SPUTargetMachine::AsmPrinterCtorFn SPUTargetMachine::AsmPrinterCtor = 0;
+
+// Force static initialization.
+extern "C" void LLVMInitializeCellSPUTarget() { }
+
const std::pair<unsigned, int> *
SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
NumEntries = 1;
return new SPULinuxTargetAsmInfo(*this);
}
-unsigned
-SPUTargetMachine::getModuleMatchQuality(const Module &M)
-{
- // We strongly match "spu-*" or "cellspu-*".
- std::string TT = M.getTargetTriple();
- if ((TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "spu")
- || (TT.size() == 7 && std::string(TT.begin(), TT.begin()+7) == "cellspu")
- || (TT.size() >= 4 && std::string(TT.begin(), TT.begin()+4) == "spu-")
- || (TT.size() >= 8 && std::string(TT.begin(), TT.begin()+8) == "cellspu-"))
- return 20;
-
- return 0; // No match at all...
-}
-
-SPUTargetMachine::SPUTargetMachine(const Module &M, const std::string &FS)
- : Subtarget(*this, M, FS),
+SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M,
+ const std::string &FS)
+ : LLVMTargetMachine(T),
+ Subtarget(*this, M, FS),
DataLayout(Subtarget.getTargetDataString()),
InstrInfo(*this),
FrameInfo(*this),
//===----------------------------------------------------------------------===//
bool
-SPUTargetMachine::addInstSelector(PassManagerBase &PM, unsigned OptLevel)
+SPUTargetMachine::addInstSelector(PassManagerBase &PM,
+ CodeGenOpt::Level OptLevel)
{
// Install an instruction selector.
PM.add(createSPUISelDag(*this));
}
bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
- unsigned OptLevel,
+ CodeGenOpt::Level OptLevel,
bool Verbose,
- raw_ostream &Out) {
- PM.add(createSPUAsmPrinterPass(Out, *this, OptLevel, Verbose));
+ formatted_raw_ostream &Out) {
+ // Output assembly language.
+ assert(AsmPrinterCtor && "AsmPrinter was not linked in");
+ if (AsmPrinterCtor)
+ PM.add(AsmPrinterCtor(Out, *this, Verbose));
return false;
}