Move most targets TargetMachine constructor to only taking a target triple.
[oota-llvm.git] / lib / Target / CellSPU / SPUTargetMachine.cpp
1 //===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Top-level implementation for the Cell SPU target.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SPU.h"
15 #include "SPURegisterNames.h"
16 #include "SPUTargetAsmInfo.h"
17 #include "SPUTargetMachine.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/CodeGen/RegAllocRegistry.h"
20 #include "llvm/CodeGen/SchedulerRegistry.h"
21 #include "llvm/Target/TargetRegistry.h"
22
23 using namespace llvm;
24
25 extern "C" void LLVMInitializeCellSPUTarget() { 
26   // Register the target.
27   RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
28 }
29
30 const std::pair<unsigned, int> *
31 SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
32   NumEntries = 1;
33   return &LR[0];
34 }
35
36 const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const {
37   return new SPULinuxTargetAsmInfo();
38 }
39
40 SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
41                                    const std::string &FS)
42   : LLVMTargetMachine(T),
43     Subtarget(TT, FS),
44     DataLayout(Subtarget.getTargetDataString()),
45     InstrInfo(*this),
46     FrameInfo(*this),
47     TLInfo(*this),
48     InstrItins(Subtarget.getInstrItineraryData()) {
49   // For the time being, use static relocations, since there's really no
50   // support for PIC yet.
51   setRelocationModel(Reloc::Static);
52 }
53
54 //===----------------------------------------------------------------------===//
55 // Pass Pipeline Configuration
56 //===----------------------------------------------------------------------===//
57
58 bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
59                                        CodeGenOpt::Level OptLevel) {
60   // Install an instruction selector.
61   PM.add(createSPUISelDag(*this));
62   return false;
63 }