1 //===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Top-level implementation for the Cell SPU target.
12 //===----------------------------------------------------------------------===//
15 #include "SPURegisterNames.h"
16 #include "SPUTargetAsmInfo.h"
17 #include "SPUTargetMachine.h"
18 #include "llvm/Module.h"
19 #include "llvm/PassManager.h"
20 #include "llvm/Target/TargetMachineRegistry.h"
21 #include "llvm/CodeGen/RegAllocRegistry.h"
22 #include "llvm/CodeGen/SchedulerRegistry.h"
26 extern Target TheCellSPUTarget;
28 // Register the targets
29 RegisterTarget<SPUTargetMachine>
30 CELLSPU(TheCellSPUTarget, "cellspu", "STI CBEA Cell SPU [experimental]");
33 // Force static initialization.
34 extern "C" void LLVMInitializeCellSPUTarget() { }
36 const std::pair<unsigned, int> *
37 SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
43 SPUTargetMachine::createTargetAsmInfo() const
45 return new SPULinuxTargetAsmInfo(*this);
48 SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M,
49 const std::string &FS)
50 : LLVMTargetMachine(T),
51 Subtarget(*this, M, FS),
52 DataLayout(Subtarget.getTargetDataString()),
56 InstrItins(Subtarget.getInstrItineraryData())
58 // For the time being, use static relocations, since there's really no
59 // support for PIC yet.
60 setRelocationModel(Reloc::Static);
63 //===----------------------------------------------------------------------===//
64 // Pass Pipeline Configuration
65 //===----------------------------------------------------------------------===//
68 SPUTargetMachine::addInstSelector(PassManagerBase &PM,
69 CodeGenOpt::Level OptLevel)
71 // Install an instruction selector.
72 PM.add(createSPUISelDag(*this));
76 bool SPUTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
77 CodeGenOpt::Level OptLevel,
79 formatted_raw_ostream &Out) {
80 FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
82 llvm_report_error("unable to create assembly printer");