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 "SPUMCAsmInfo.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"
25 extern "C" void LLVMInitializeCellSPUTarget() {
26 // Register the target.
27 RegisterTargetMachine
<SPUTargetMachine
> X(TheCellSPUTarget
);
28 RegisterAsmInfo
<SPULinuxMCAsmInfo
> Y(TheCellSPUTarget
);
31 const std::pair
<unsigned, int> *
32 SPUFrameLowering::getCalleeSaveSpillSlots(unsigned &NumEntries
) const {
37 SPUTargetMachine::SPUTargetMachine(const Target
&T
, const std::string
&TT
,
38 const std::string
&CPU
,const std::string
&FS
)
39 : LLVMTargetMachine(T
, TT
, CPU
, FS
),
40 Subtarget(TT
, CPU
, FS
),
41 DataLayout(Subtarget
.getTargetDataString()),
43 FrameLowering(Subtarget
),
46 InstrItins(Subtarget
.getInstrItineraryData()) {
47 // For the time being, use static relocations, since there's really no
48 // support for PIC yet.
49 setRelocationModel(Reloc::Static
);
52 //===----------------------------------------------------------------------===//
53 // Pass Pipeline Configuration
54 //===----------------------------------------------------------------------===//
56 bool SPUTargetMachine::addInstSelector(PassManagerBase
&PM
,
57 CodeGenOpt::Level OptLevel
) {
58 // Install an instruction selector.
59 PM
.add(createSPUISelDag(*this));
63 // passes to run just before printing the assembly
64 bool SPUTargetMachine::
65 addPreEmitPass(PassManagerBase
&PM
, CodeGenOpt::Level OptLevel
)
67 //align instructions with nops/lnops for dual issue
68 PM
.add(createSPUNopFillerPass(*this));