Sort includes for all of the .h files under the 'lib' tree. These were
[oota-llvm.git] / lib / Target / ARM / ARMTargetMachine.h
1 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- 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 ARM specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef ARMTARGETMACHINE_H
15 #define ARMTARGETMACHINE_H
16
17 #include "ARMFrameLowering.h"
18 #include "ARMISelLowering.h"
19 #include "ARMInstrInfo.h"
20 #include "ARMJITInfo.h"
21 #include "ARMSelectionDAGInfo.h"
22 #include "ARMSubtarget.h"
23 #include "Thumb1FrameLowering.h"
24 #include "Thumb1InstrInfo.h"
25 #include "Thumb2InstrInfo.h"
26 #include "llvm/ADT/OwningPtr.h"
27 #include "llvm/DataLayout.h"
28 #include "llvm/MC/MCStreamer.h"
29 #include "llvm/Target/TargetMachine.h"
30 #include "llvm/Target/TargetTransformImpl.h"
31
32 namespace llvm {
33
34 class ARMBaseTargetMachine : public LLVMTargetMachine {
35 protected:
36   ARMSubtarget        Subtarget;
37 private:
38   ARMJITInfo          JITInfo;
39   InstrItineraryData  InstrItins;
40
41 public:
42   ARMBaseTargetMachine(const Target &T, StringRef TT,
43                        StringRef CPU, StringRef FS,
44                        const TargetOptions &Options,
45                        Reloc::Model RM, CodeModel::Model CM,
46                        CodeGenOpt::Level OL);
47
48   virtual       ARMJITInfo       *getJITInfo()         { return &JITInfo; }
49   virtual const ARMSubtarget  *getSubtargetImpl() const { return &Subtarget; }
50   virtual const InstrItineraryData *getInstrItineraryData() const {
51     return &InstrItins;
52   }
53
54   // Pass Pipeline Configuration
55   virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
56
57   virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &MCE);
58 };
59
60 /// ARMTargetMachine - ARM target machine.
61 ///
62 class ARMTargetMachine : public ARMBaseTargetMachine {
63   virtual void anchor();
64   ARMInstrInfo        InstrInfo;
65   const DataLayout    DL;       // Calculates type size & alignment
66   ARMTargetLowering   TLInfo;
67   ARMSelectionDAGInfo TSInfo;
68   ARMFrameLowering    FrameLowering;
69   ScalarTargetTransformImpl STTI;
70   VectorTargetTransformImpl VTTI;
71  public:
72   ARMTargetMachine(const Target &T, StringRef TT,
73                    StringRef CPU, StringRef FS,
74                    const TargetOptions &Options,
75                    Reloc::Model RM, CodeModel::Model CM,
76                    CodeGenOpt::Level OL);
77
78   virtual const ARMRegisterInfo  *getRegisterInfo() const {
79     return &InstrInfo.getRegisterInfo();
80   }
81
82   virtual const ARMTargetLowering *getTargetLowering() const {
83     return &TLInfo;
84   }
85
86   virtual const ARMSelectionDAGInfo* getSelectionDAGInfo() const {
87     return &TSInfo;
88   }
89   virtual const ARMFrameLowering *getFrameLowering() const {
90     return &FrameLowering;
91   }
92   virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
93     return &STTI;
94   }
95   virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
96     return &VTTI;
97   }
98   virtual const ARMInstrInfo     *getInstrInfo() const { return &InstrInfo; }
99   virtual const DataLayout       *getDataLayout() const { return &DL; }
100 };
101
102 /// ThumbTargetMachine - Thumb target machine.
103 /// Due to the way architectures are handled, this represents both
104 ///   Thumb-1 and Thumb-2.
105 ///
106 class ThumbTargetMachine : public ARMBaseTargetMachine {
107   virtual void anchor();
108   // Either Thumb1InstrInfo or Thumb2InstrInfo.
109   OwningPtr<ARMBaseInstrInfo> InstrInfo;
110   const DataLayout    DL;   // Calculates type size & alignment
111   ARMTargetLowering   TLInfo;
112   ARMSelectionDAGInfo TSInfo;
113   // Either Thumb1FrameLowering or ARMFrameLowering.
114   OwningPtr<ARMFrameLowering> FrameLowering;
115   ScalarTargetTransformImpl STTI;
116   VectorTargetTransformImpl VTTI;
117 public:
118   ThumbTargetMachine(const Target &T, StringRef TT,
119                      StringRef CPU, StringRef FS,
120                      const TargetOptions &Options,
121                      Reloc::Model RM, CodeModel::Model CM,
122                      CodeGenOpt::Level OL);
123
124   /// returns either Thumb1RegisterInfo or Thumb2RegisterInfo
125   virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
126     return &InstrInfo->getRegisterInfo();
127   }
128
129   virtual const ARMTargetLowering *getTargetLowering() const {
130     return &TLInfo;
131   }
132
133   virtual const ARMSelectionDAGInfo *getSelectionDAGInfo() const {
134     return &TSInfo;
135   }
136
137   /// returns either Thumb1InstrInfo or Thumb2InstrInfo
138   virtual const ARMBaseInstrInfo *getInstrInfo() const {
139     return InstrInfo.get();
140   }
141   /// returns either Thumb1FrameLowering or ARMFrameLowering
142   virtual const ARMFrameLowering *getFrameLowering() const {
143     return FrameLowering.get();
144   }
145   virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
146     return &STTI;
147   }
148   virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
149     return &VTTI;
150   }
151   virtual const DataLayout       *getDataLayout() const { return &DL; }
152 };
153
154 } // end namespace llvm
155
156 #endif