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