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