Move global variables in TargetMachine into new TargetOptions class. As an API
[oota-llvm.git] / lib / Target / CellSPU / SPUTargetMachine.h
1 //===-- SPUTargetMachine.h - Define TargetMachine for Cell SPU ----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
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 "SPUSelectionDAGInfo.h"
21 #include "SPUFrameLowering.h"
22 #include "llvm/Target/TargetMachine.h"
23 #include "llvm/Target/TargetData.h"
24
25 namespace llvm {
26 class PassManager;
27 class GlobalValue;
28 class TargetFrameLowering;
29
30 /// SPUTargetMachine
31 ///
32 class SPUTargetMachine : public LLVMTargetMachine {
33   SPUSubtarget        Subtarget;
34   const TargetData    DataLayout;
35   SPUInstrInfo        InstrInfo;
36   SPUFrameLowering    FrameLowering;
37   SPUTargetLowering   TLInfo;
38   SPUSelectionDAGInfo TSInfo;
39   InstrItineraryData  InstrItins;
40 public:
41   SPUTargetMachine(const Target &T, StringRef TT,
42                    StringRef CPU, StringRef FS, const TargetOptions &Options,
43                    Reloc::Model RM, CodeModel::Model CM,
44                    CodeGenOpt::Level OL);
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 SPUFrameLowering *getFrameLowering() const {
54     return &FrameLowering;
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   virtual const SPUTargetLowering *getTargetLowering() const { 
65    return &TLInfo;
66   }
67
68   virtual const SPUSelectionDAGInfo* getSelectionDAGInfo() const {
69     return &TSInfo;
70   }
71
72   virtual const SPURegisterInfo *getRegisterInfo() const {
73     return &InstrInfo.getRegisterInfo();
74   }
75   
76   virtual const TargetData *getTargetData() const {
77     return &DataLayout;
78   }
79
80   virtual const InstrItineraryData *getInstrItineraryData() const {
81     return &InstrItins;
82   }
83   
84   // Pass Pipeline Configuration
85   virtual bool addInstSelector(PassManagerBase &PM);
86   virtual bool addPreEmitPass(PassManagerBase &);       
87 };
88
89 } // end namespace llvm
90
91 #endif