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 "SPUTargetMachine.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/CodeGen/RegAllocRegistry.h"
18 #include "llvm/CodeGen/SchedulerRegistry.h"
19 #include "llvm/Target/TargetRegistry.h"
23 extern "C" void LLVMInitializeCellSPUTarget() {
24 // Register the target.
25 RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
28 const std::pair<unsigned, int> *
29 SPUFrameLowering::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
34 SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
35 const std::string &CPU,const std::string &FS)
36 : LLVMTargetMachine(T, TT, CPU, FS),
37 Subtarget(TT, CPU, FS),
38 DataLayout(Subtarget.getTargetDataString()),
40 FrameLowering(Subtarget),
43 InstrItins(Subtarget.getInstrItineraryData()) {
44 // For the time being, use static relocations, since there's really no
45 // support for PIC yet.
46 setRelocationModel(Reloc::Static);
49 //===----------------------------------------------------------------------===//
50 // Pass Pipeline Configuration
51 //===----------------------------------------------------------------------===//
53 bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
54 CodeGenOpt::Level OptLevel) {
55 // Install an instruction selector.
56 PM.add(createSPUISelDag(*this));
60 // passes to run just before printing the assembly
61 bool SPUTargetMachine::
62 addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel)
64 //align instructions with nops/lnops for dual issue
65 PM.add(createSPUNopFillerPass(*this));