7143adf6c095af6d83272f6fa2d095cc11e82661
[oota-llvm.git] / lib / Target / AArch64 / AArch64TargetMachine.h
1 //==-- AArch64TargetMachine.h - Define TargetMachine for AArch64 -*- 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 AArch64 specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64TARGETMACHINE_H
16
17 #include "AArch64InstrInfo.h"
18 #include "AArch64Subtarget.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/Target/TargetMachine.h"
21
22 namespace llvm {
23
24 class AArch64TargetMachine : public LLVMTargetMachine {
25 protected:
26   const DataLayout DL;
27   std::unique_ptr<TargetLoweringObjectFile> TLOF;
28   AArch64Subtarget Subtarget;
29   mutable StringMap<std::unique_ptr<AArch64Subtarget>> SubtargetMap;
30
31 public:
32   AArch64TargetMachine(const Target &T, StringRef TT, StringRef CPU,
33                        StringRef FS, const TargetOptions &Options,
34                        Reloc::Model RM, CodeModel::Model CM,
35                        CodeGenOpt::Level OL, bool IsLittleEndian);
36
37   ~AArch64TargetMachine() override;
38
39   const DataLayout *getDataLayout() const override { return &DL; }
40   const AArch64Subtarget *getSubtargetImpl() const override {
41     return &Subtarget;
42   }
43   const AArch64Subtarget *getSubtargetImpl(const Function &F) const override;
44
45   // Pass Pipeline Configuration
46   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
47
48   /// \brief Get the TargetIRAnalysis for this target.
49   TargetIRAnalysis getTargetIRAnalysis() override;
50
51   TargetLoweringObjectFile* getObjFileLowering() const override {
52     return TLOF.get();
53   }
54
55 private:
56   bool isLittle;
57 };
58
59 // AArch64leTargetMachine - AArch64 little endian target machine.
60 //
61 class AArch64leTargetMachine : public AArch64TargetMachine {
62   virtual void anchor();
63 public:
64   AArch64leTargetMachine(const Target &T, StringRef TT, StringRef CPU,
65                          StringRef FS, const TargetOptions &Options,
66                          Reloc::Model RM, CodeModel::Model CM,
67                          CodeGenOpt::Level OL);
68 };
69
70 // AArch64beTargetMachine - AArch64 big endian target machine.
71 //
72 class AArch64beTargetMachine : public AArch64TargetMachine {
73   virtual void anchor();
74 public:
75   AArch64beTargetMachine(const Target &T, StringRef TT, StringRef CPU,
76                          StringRef FS, const TargetOptions &Options,
77                          Reloc::Model RM, CodeModel::Model CM,
78                          CodeGenOpt::Level OL);
79 };
80
81 } // end namespace llvm
82
83 #endif