/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/ARM/ARMTargetMachine.h
Line | Count | Source |
1 | | //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file declares the ARM specific subclass of TargetMachine. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H |
14 | | #define LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H |
15 | | |
16 | | #include "ARMSubtarget.h" |
17 | | #include "llvm/ADT/Optional.h" |
18 | | #include "llvm/ADT/StringMap.h" |
19 | | #include "llvm/ADT/StringRef.h" |
20 | | #include "llvm/Analysis/TargetTransformInfo.h" |
21 | | #include "llvm/Support/CodeGen.h" |
22 | | #include "llvm/Target/TargetMachine.h" |
23 | | #include <memory> |
24 | | |
25 | | namespace llvm { |
26 | | |
27 | | class ARMBaseTargetMachine : public LLVMTargetMachine { |
28 | | public: |
29 | | enum ARMABI { |
30 | | ARM_ABI_UNKNOWN, |
31 | | ARM_ABI_APCS, |
32 | | ARM_ABI_AAPCS, // ARM EABI |
33 | | ARM_ABI_AAPCS16 |
34 | | } TargetABI; |
35 | | |
36 | | protected: |
37 | | std::unique_ptr<TargetLoweringObjectFile> TLOF; |
38 | | bool isLittle; |
39 | | mutable StringMap<std::unique_ptr<ARMSubtarget>> SubtargetMap; |
40 | | |
41 | | public: |
42 | | ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
43 | | StringRef FS, const TargetOptions &Options, |
44 | | Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, |
45 | | CodeGenOpt::Level OL, bool isLittle); |
46 | | ~ARMBaseTargetMachine() override; |
47 | | |
48 | | const ARMSubtarget *getSubtargetImpl(const Function &F) const override; |
49 | | // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget, |
50 | | // subtargets are per-function entities based on the target-specific |
51 | | // attributes of each function. |
52 | | const ARMSubtarget *getSubtargetImpl() const = delete; |
53 | 2.24k | bool isLittleEndian() const { return isLittle; } |
54 | | |
55 | | TargetTransformInfo getTargetTransformInfo(const Function &F) override; |
56 | | |
57 | | // Pass Pipeline Configuration |
58 | | TargetPassConfig *createPassConfig(PassManagerBase &PM) override; |
59 | | |
60 | 350k | TargetLoweringObjectFile *getObjFileLowering() const override { |
61 | 350k | return TLOF.get(); |
62 | 350k | } |
63 | | |
64 | 4.73k | bool isTargetHardFloat() const { |
65 | 4.73k | return TargetTriple.getEnvironment() == Triple::GNUEABIHF || |
66 | 4.73k | TargetTriple.getEnvironment() == Triple::MuslEABIHF4.59k || |
67 | 4.73k | TargetTriple.getEnvironment() == Triple::EABIHF4.59k || |
68 | 4.73k | (4.40k TargetTriple.isOSBinFormatMachO()4.40k && |
69 | 4.40k | TargetTriple.getSubArch() == Triple::ARMSubArch_v7em953 ) || |
70 | 4.73k | TargetTriple.isOSWindows()4.39k || |
71 | 4.73k | TargetABI == ARMBaseTargetMachine::ARM_ABI_AAPCS164.26k ; |
72 | 4.73k | } |
73 | | }; |
74 | | |
75 | | /// ARM/Thumb little endian target machine. |
76 | | /// |
77 | | class ARMLETargetMachine : public ARMBaseTargetMachine { |
78 | | public: |
79 | | ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
80 | | StringRef FS, const TargetOptions &Options, |
81 | | Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, |
82 | | CodeGenOpt::Level OL, bool JIT); |
83 | | }; |
84 | | |
85 | | /// ARM/Thumb big endian target machine. |
86 | | /// |
87 | | class ARMBETargetMachine : public ARMBaseTargetMachine { |
88 | | public: |
89 | | ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU, |
90 | | StringRef FS, const TargetOptions &Options, |
91 | | Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, |
92 | | CodeGenOpt::Level OL, bool JIT); |
93 | | }; |
94 | | |
95 | | } // end namespace llvm |
96 | | |
97 | | #endif // LLVM_LIB_TARGET_ARM_ARMTARGETMACHINE_H |