blob: 26215cd26fc27015b88ee507bfaf17a0ce4e595a [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"
18#include "llvm/Module.h"
19#include "llvm/PassManager.h"
Scott Michelaedc6372008-12-10 00:15:19 +000020#include "llvm/CodeGen/RegAllocRegistry.h"
21#include "llvm/CodeGen/SchedulerRegistry.h"
Daniel Dunbar0c795d62009-07-25 06:49:55 +000022#include "llvm/Target/TargetRegistry.h"
Scott Michel564427e2007-12-05 01:24:05 +000023
24using namespace llvm;
25
Daniel Dunbar0c795d62009-07-25 06:49:55 +000026extern "C" void LLVMInitializeCellSPUTarget() {
27 // Register the target.
28 RegisterTargetMachine<SPUTargetMachine> X(TheCellSPUTarget);
Scott Michel564427e2007-12-05 01:24:05 +000029}
30
31const std::pair<unsigned, int> *
32SPUFrameInfo::getCalleeSaveSpillSlots(unsigned &NumEntries) const {
33 NumEntries = 1;
34 return &LR[0];
35}
36
37const TargetAsmInfo *
38SPUTargetMachine::createTargetAsmInfo() const
39{
Scott Micheld03eeaf2008-11-07 04:36:25 +000040 return new SPULinuxTargetAsmInfo(*this);
Scott Michel564427e2007-12-05 01:24:05 +000041}
42
Daniel Dunbar51b198a2009-07-15 20:24:03 +000043SPUTargetMachine::SPUTargetMachine(const Target &T, const Module &M,
44 const std::string &FS)
45 : LLVMTargetMachine(T),
46 Subtarget(*this, M, FS),
Scott Michel564427e2007-12-05 01:24:05 +000047 DataLayout(Subtarget.getTargetDataString()),
48 InstrInfo(*this),
49 FrameInfo(*this),
50 TLInfo(*this),
51 InstrItins(Subtarget.getInstrItineraryData())
52{
53 // For the time being, use static relocations, since there's really no
54 // support for PIC yet.
55 setRelocationModel(Reloc::Static);
56}
57
58//===----------------------------------------------------------------------===//
59// Pass Pipeline Configuration
60//===----------------------------------------------------------------------===//
61
62bool
Bill Wendling98a366d2009-04-29 23:29:43 +000063SPUTargetMachine::addInstSelector(PassManagerBase &PM,
64 CodeGenOpt::Level OptLevel)
Scott Michel564427e2007-12-05 01:24:05 +000065{
66 // Install an instruction selector.
67 PM.add(createSPUISelDag(*this));
68 return false;
69}