blob: 85dda310d28896d40b2240bac5cf7df5adbb82fb [file] [log] [blame]
Scott Michel564427e2007-12-05 01:24:05 +00001//===-- SPUTargetMachine.cpp - Define TargetMachine for Cell SPU ----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Scott Michel564427e2007-12-05 01:24:05 +00007//
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"
Scott Michel564427e2007-12-05 01:24:05 +000018#include "llvm/PassManager.h"
Scott Michelaedc6372008-12-10 00:15:19 +000019#include "llvm/CodeGen/RegAllocRegistry.h"
20#include "llvm/CodeGen/SchedulerRegistry.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000021#include "llvm/Target/TargetRegistry.h"
Scott Michel564427e2007-12-05 01:24:05 +000022
23using namespace llvm;
24
Daniel Dunbar0c795d62009-07-25 06:49:55 +000025extern "C" void LLVMInitializeCellSPUTarget() {
26 // Register the target.
27 RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
Scott Michel564427e2007-12-05 01:24:05 +000028}
29
30const std::pair<unsigned, int> *
31SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
32 NumEntries = 1;
33 return &LR[0];
34}
35
Chris Lattner09e820b2009-08-02 04:44:33 +000036const TargetAsmInfo *SPUTargetMachine::createTargetAsmInfo() const {
37 return new SPULinuxTargetAsmInfo();
Scott Michel564427e2007-12-05 01:24:05 +000038}
39
Daniel Dunbare28039c2009-08-02 23:37:13 +000040SPUTargetMachine::SPUTargetMachine(const Target &T, const std::string &TT,
Daniel Dunbar51b198a2009-07-15 20:24:03 +000041 const std::string &FS)
Chris Lattner0a31d2f2009-08-11 20:42:37 +000042 : LLVMTargetMachine(T, TT),
Daniel Dunbare28039c2009-08-02 23:37:13 +000043 Subtarget(TT, FS),
Scott Michel564427e2007-12-05 01:24:05 +000044 DataLayout(Subtarget.getTargetDataString()),
45 InstrInfo(*this),
46 FrameInfo(*this),
47 TLInfo(*this),
Chris Lattner09e820b2009-08-02 04:44:33 +000048 InstrItins(Subtarget.getInstrItineraryData()) {
Scott Michel564427e2007-12-05 01:24:05 +000049 // 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
Chris Lattner09e820b2009-08-02 04:44:33 +000058bool SPUTargetMachine::addInstSelector(PassManagerBase &PM,
59 CodeGenOpt::Level OptLevel) {
Scott Michel564427e2007-12-05 01:24:05 +000060 // Install an instruction selector.
61 PM.add(createSPUISelDag(*this));
62 return false;
63}