Remove the cached little endian variable. We can get it easily off
[oota-llvm.git] / lib / Target / AArch64 / AArch64Subtarget.h
1 //===--- AArch64Subtarget.h - Define Subtarget for the 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 TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef AArch64SUBTARGET_H
15 #define AArch64SUBTARGET_H
16
17 #include "AArch64FrameLowering.h"
18 #include "AArch64RegisterInfo.h"
19 #include "llvm/IR/DataLayout.h"
20 #include "llvm/Target/TargetSubtargetInfo.h"
21 #include <string>
22
23 #define GET_SUBTARGETINFO_HEADER
24 #include "AArch64GenSubtargetInfo.inc"
25
26 namespace llvm {
27 class GlobalValue;
28 class StringRef;
29
30 class AArch64Subtarget : public AArch64GenSubtargetInfo {
31 protected:
32   enum ARMProcFamilyEnum {Others, CortexA53, CortexA57, Cyclone};
33
34   /// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
35   ARMProcFamilyEnum ARMProcFamily;
36
37   bool HasFPARMv8;
38   bool HasNEON;
39   bool HasCrypto;
40   bool HasCRC;
41
42   // HasZeroCycleRegMove - Has zero-cycle register mov instructions.
43   bool HasZeroCycleRegMove;
44
45   // HasZeroCycleZeroing - Has zero-cycle zeroing instructions.
46   bool HasZeroCycleZeroing;
47
48   /// CPUString - String name of used CPU.
49   std::string CPUString;
50
51   /// TargetTriple - What processor and OS we're targeting.
52   Triple TargetTriple;
53
54   const DataLayout DL;
55   AArch64FrameLowering FrameLowering;
56
57 public:
58   /// This constructor initializes the data members to match that
59   /// of the specified triple.
60   AArch64Subtarget(const std::string &TT, const std::string &CPU,
61                  const std::string &FS, bool LittleEndian);
62
63   const AArch64FrameLowering *getFrameLowering() const {
64     return &FrameLowering;
65   }
66   const DataLayout *getDataLayout() const { return &DL; }
67   bool enableMachineScheduler() const override { return true; }
68
69   bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
70
71   bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
72
73   bool hasFPARMv8() const { return HasFPARMv8; }
74   bool hasNEON() const { return HasNEON; }
75   bool hasCrypto() const { return HasCrypto; }
76   bool hasCRC() const { return HasCRC; }
77
78   bool isLittleEndian() const { return DL.isLittleEndian(); }
79
80   bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
81
82   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
83
84   bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
85
86   bool isCyclone() const { return CPUString == "cyclone"; }
87
88   /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
89   /// that still makes it profitable to inline the call.
90   unsigned getMaxInlineSizeThreshold() const { return 64; }
91
92   /// ParseSubtargetFeatures - Parses features string setting specified
93   /// subtarget options.  Definition of function is auto generated by tblgen.
94   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
95
96   /// ClassifyGlobalReference - Find the target operand flags that describe
97   /// how a global value should be referenced for the current subtarget.
98   unsigned char ClassifyGlobalReference(const GlobalValue *GV,
99                                         const TargetMachine &TM) const;
100
101   /// This function returns the name of a function which has an interface
102   /// like the non-standard bzero function, if such a function exists on
103   /// the current subtarget and it is considered prefereable over
104   /// memset with zero passed as the second argument. Otherwise it
105   /// returns null.
106   const char *getBZeroEntry() const;
107
108   void overrideSchedPolicy(MachineSchedPolicy &Policy, MachineInstr *begin,
109                            MachineInstr *end,
110                            unsigned NumRegionInstrs) const override;
111
112   bool enableEarlyIfConversion() const override;
113 };
114 } // End llvm namespace
115
116 #endif // AArch64SUBTARGET_H