Move DataLayout back to the TargetMachine from TargetSubtargetInfo
[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 LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H
15 #define LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H
16
17 #include "ARMInstrInfo.h"
18 #include "ARMSubtarget.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/Target/TargetMachine.h"
21
22 namespace llvm {
23
24 class ARMBaseTargetMachine : public LLVMTargetMachine {
25 public:
26   enum ARMABI {
27     ARM_ABI_UNKNOWN,
28     ARM_ABI_APCS,
29     ARM_ABI_AAPCS // ARM EABI
30   } TargetABI;
31
32 protected:
33   const DataLayout DL;
34   std::unique_ptr<TargetLoweringObjectFile> TLOF;
35   ARMSubtarget        Subtarget;
36   bool isLittle;
37   mutable StringMap<std::unique_ptr<ARMSubtarget>> SubtargetMap;
38
39 public:
40   ARMBaseTargetMachine(const Target &T, StringRef TT,
41                        StringRef CPU, StringRef FS,
42                        const TargetOptions &Options,
43                        Reloc::Model RM, CodeModel::Model CM,
44                        CodeGenOpt::Level OL,
45                        bool isLittle);
46   ~ARMBaseTargetMachine() override;
47
48   const ARMSubtarget *getSubtargetImpl() const override { return &Subtarget; }
49   const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
50   const DataLayout *getDataLayout() const override { return &DL; }
51
52   /// \brief Register ARM analysis passes with a pass manager.
53   void addAnalysisPasses(PassManagerBase &PM) override;
54
55   // Pass Pipeline Configuration
56   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
57
58   TargetLoweringObjectFile *getObjFileLowering() const override {
59     return TLOF.get();
60   }
61 };
62
63 /// ARMTargetMachine - ARM target machine.
64 ///
65 class ARMTargetMachine : public ARMBaseTargetMachine {
66   virtual void anchor();
67  public:
68    ARMTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
69                     const TargetOptions &Options, Reloc::Model RM,
70                     CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
71 };
72
73 /// ARMLETargetMachine - ARM little endian target machine.
74 ///
75 class ARMLETargetMachine : public ARMTargetMachine {
76   void anchor() override;
77 public:
78   ARMLETargetMachine(const Target &T, StringRef TT,
79                      StringRef CPU, StringRef FS, const TargetOptions &Options,
80                      Reloc::Model RM, CodeModel::Model CM,
81                      CodeGenOpt::Level OL);
82 };
83
84 /// ARMBETargetMachine - ARM big endian target machine.
85 ///
86 class ARMBETargetMachine : public ARMTargetMachine {
87   void anchor() override;
88 public:
89   ARMBETargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
90                      const TargetOptions &Options, Reloc::Model RM,
91                      CodeModel::Model CM, CodeGenOpt::Level OL);
92 };
93
94 /// ThumbTargetMachine - Thumb target machine.
95 /// Due to the way architectures are handled, this represents both
96 ///   Thumb-1 and Thumb-2.
97 ///
98 class ThumbTargetMachine : public ARMBaseTargetMachine {
99   virtual void anchor();
100 public:
101   ThumbTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS,
102                      const TargetOptions &Options, Reloc::Model RM,
103                      CodeModel::Model CM, CodeGenOpt::Level OL, bool isLittle);
104 };
105
106 /// ThumbLETargetMachine - Thumb little endian target machine.
107 ///
108 class ThumbLETargetMachine : public ThumbTargetMachine {
109   void anchor() override;
110 public:
111   ThumbLETargetMachine(const Target &T, StringRef TT, StringRef CPU,
112                        StringRef FS, const TargetOptions &Options,
113                        Reloc::Model RM, CodeModel::Model CM,
114                        CodeGenOpt::Level OL);
115 };
116
117 /// ThumbBETargetMachine - Thumb big endian target machine.
118 ///
119 class ThumbBETargetMachine : public ThumbTargetMachine {
120   void anchor() override;
121 public:
122   ThumbBETargetMachine(const Target &T, StringRef TT, StringRef CPU,
123                        StringRef FS, const TargetOptions &Options,
124                        Reloc::Model RM, CodeModel::Model CM,
125                        CodeGenOpt::Level OL);
126 };
127
128 } // end namespace llvm
129
130 #endif