blob: 8d05ab9d74c9d9ee04ec19cde2f0c31ce33b52cd [file] [log] [blame]
Scott Michel564427e2007-12-05 01:24:05 +00001//===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- C++ -*-=//
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// This file declares the CellSPU-specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPU_TARGETMACHINE_H
15#define SPU_TARGETMACHINE_H
16
17#include "SPUSubtarget.h"
18#include "SPUInstrInfo.h"
19#include "SPUISelLowering.h"
20#include "SPUFrameInfo.h"
21#include "llvm/Target/TargetMachine.h"
22#include "llvm/Target/TargetData.h"
23
24namespace llvm {
25class PassManager;
26class GlobalValue;
27class TargetFrameInfo;
28
29/// SPUTargetMachine
30///
31class SPUTargetMachine : public LLVMTargetMachine {
32 SPUSubtarget Subtarget;
33 const TargetData DataLayout;
34 SPUInstrInfo InstrInfo;
35 SPUFrameInfo FrameInfo;
36 SPUTargetLowering TLInfo;
37 InstrItineraryData InstrItins;
38
39protected:
40 virtual const TargetAsmInfo *createTargetAsmInfo() const;
41
42public:
43 SPUTargetMachine(const Module &M, const std::string &FS);
44
45 /// Return the subtarget implementation object
46 virtual const SPUSubtarget *getSubtargetImpl() const {
47 return &Subtarget;
48 }
49 virtual const SPUInstrInfo *getInstrInfo() const {
50 return &InstrInfo;
51 }
52 virtual const TargetFrameInfo *getFrameInfo() const {
53 return &FrameInfo;
54 }
55 /*!
56 \note Cell SPU does not support JIT today. It could support JIT at some
57 point.
58 */
59 virtual TargetJITInfo *getJITInfo() {
60 return NULL;
61 }
62
63 //! Module match function
64 /*!
65 Module matching function called by TargetMachineRegistry().
66 */
67 static unsigned getModuleMatchQuality(const Module &M);
68
69 virtual SPUTargetLowering *getTargetLowering() const {
70 return const_cast<SPUTargetLowering*>(&TLInfo);
71 }
72
73 virtual const MRegisterInfo *getRegisterInfo() const {
74 return &InstrInfo.getRegisterInfo();
75 }
76
77 virtual const TargetData *getTargetData() const {
78 return &DataLayout;
79 }
80
81 virtual const InstrItineraryData getInstrItineraryData() const {
82 return InstrItins;
83 }
84
85 // Pass Pipeline Configuration
86 virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
87 virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
88 std::ostream &Out);
89};
90
91} // end namespace llvm
92
93#endif