]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/ARM/ARMTargetMachine.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305145, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / 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 "ARMSubtarget.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Analysis/TargetTransformInfo.h"
22 #include "llvm/Support/CodeGen.h"
23 #include "llvm/Target/TargetMachine.h"
24 #include <memory>
25
26 namespace llvm {
27
28 class ARMBaseTargetMachine : public LLVMTargetMachine {
29 public:
30   enum ARMABI {
31     ARM_ABI_UNKNOWN,
32     ARM_ABI_APCS,
33     ARM_ABI_AAPCS, // ARM EABI
34     ARM_ABI_AAPCS16
35   } TargetABI;
36
37 protected:
38   std::unique_ptr<TargetLoweringObjectFile> TLOF;
39   ARMSubtarget Subtarget;
40   bool isLittle;
41   mutable StringMap<std::unique_ptr<ARMSubtarget>> SubtargetMap;
42
43 public:
44   ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
45                        StringRef FS, const TargetOptions &Options,
46                        Optional<Reloc::Model> RM, CodeModel::Model CM,
47                        CodeGenOpt::Level OL, bool isLittle);
48   ~ARMBaseTargetMachine() override;
49
50   const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
51   const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
52   bool isLittleEndian() const { return isLittle; }
53
54   /// \brief Get the TargetIRAnalysis for this target.
55   TargetIRAnalysis getTargetIRAnalysis() override;
56
57   // Pass Pipeline Configuration
58   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
59
60   TargetLoweringObjectFile *getObjFileLowering() const override {
61     return TLOF.get();
62   }
63
64   bool isMachineVerifierClean() const override {
65     return false;
66   }
67 };
68
69 /// ARM/Thumb little endian target machine.
70 ///
71 class ARMLETargetMachine : public ARMBaseTargetMachine {
72 public:
73   ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
74                      StringRef FS, const TargetOptions &Options,
75                      Optional<Reloc::Model> RM, CodeModel::Model CM,
76                      CodeGenOpt::Level OL);
77 };
78
79 /// ARM/Thumb big endian target machine.
80 ///
81 class ARMBETargetMachine : public ARMBaseTargetMachine {
82 public:
83   ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU,
84                      StringRef FS, const TargetOptions &Options,
85                      Optional<Reloc::Model> RM, CodeModel::Model CM,
86                      CodeGenOpt::Level OL);
87 };
88
89 } // end namespace llvm
90
91 #endif // LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H