LLVM  3.7.0
AArch64Subtarget.h
Go to the documentation of this file.
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 LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
16 
17 #include "AArch64FrameLowering.h"
18 #include "AArch64ISelLowering.h"
19 #include "AArch64InstrInfo.h"
20 #include "AArch64RegisterInfo.h"
22 #include "llvm/IR/DataLayout.h"
24 #include <string>
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "AArch64GenSubtargetInfo.inc"
28 
29 namespace llvm {
30 class GlobalValue;
31 class StringRef;
32 class Triple;
33 
35 protected:
37 
38  /// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
40 
42 
43  bool HasFPARMv8;
44  bool HasNEON;
45  bool HasCrypto;
46  bool HasCRC;
47 
48  // HasZeroCycleRegMove - Has zero-cycle register mov instructions.
50 
51  // HasZeroCycleZeroing - Has zero-cycle zeroing instructions.
53 
54  bool IsLittle;
55 
56  /// CPUString - String name of used CPU.
57  std::string CPUString;
58 
59  /// TargetTriple - What processor and OS we're targeting.
61 
66 private:
67  /// initializeSubtargetDependencies - Initializes using CPUString and the
68  /// passed in feature string so that we can use initializer lists for
69  /// subtarget initialization.
70  AArch64Subtarget &initializeSubtargetDependencies(StringRef FS);
71 
72 public:
73  /// This constructor initializes the data members to match that
74  /// of the specified triple.
75  AArch64Subtarget(const Triple &TT, const std::string &CPU,
76  const std::string &FS, const TargetMachine &TM,
77  bool LittleEndian);
78 
79  const AArch64SelectionDAGInfo *getSelectionDAGInfo() const override {
80  return &TSInfo;
81  }
82  const AArch64FrameLowering *getFrameLowering() const override {
83  return &FrameLowering;
84  }
85  const AArch64TargetLowering *getTargetLowering() const override {
86  return &TLInfo;
87  }
88  const AArch64InstrInfo *getInstrInfo() const override { return &InstrInfo; }
89  const AArch64RegisterInfo *getRegisterInfo() const override {
90  return &getInstrInfo()->getRegisterInfo();
91  }
92  const Triple &getTargetTriple() const { return TargetTriple; }
93  bool enableMachineScheduler() const override { return true; }
94  bool enablePostRAScheduler() const override {
95  return isCortexA53() || isCortexA57();
96  }
97 
98  bool hasV8_1aOps() const { return HasV8_1aOps; }
99 
100  bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
101 
102  bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
103 
104  bool hasFPARMv8() const { return HasFPARMv8; }
105  bool hasNEON() const { return HasNEON; }
106  bool hasCrypto() const { return HasCrypto; }
107  bool hasCRC() const { return HasCRC; }
108 
109  bool isLittleEndian() const { return IsLittle; }
110 
111  bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
112  bool isTargetIOS() const { return TargetTriple.isiOS(); }
113  bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
114  bool isTargetWindows() const { return TargetTriple.isOSWindows(); }
115 
116  bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
117  bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
118  bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
119 
120  bool isCyclone() const { return CPUString == "cyclone"; }
121  bool isCortexA57() const { return CPUString == "cortex-a57"; }
122  bool isCortexA53() const { return CPUString == "cortex-a53"; }
123 
124  bool useAA() const override { return isCortexA53(); }
125 
126  /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
127  /// that still makes it profitable to inline the call.
128  unsigned getMaxInlineSizeThreshold() const { return 64; }
129 
130  /// ParseSubtargetFeatures - Parses features string setting specified
131  /// subtarget options. Definition of function is auto generated by tblgen.
133 
134  /// ClassifyGlobalReference - Find the target operand flags that describe
135  /// how a global value should be referenced for the current subtarget.
136  unsigned char ClassifyGlobalReference(const GlobalValue *GV,
137  const TargetMachine &TM) const;
138 
139  /// This function returns the name of a function which has an interface
140  /// like the non-standard bzero function, if such a function exists on
141  /// the current subtarget and it is considered prefereable over
142  /// memset with zero passed as the second argument. Otherwise it
143  /// returns null.
144  const char *getBZeroEntry() const;
145 
147  MachineInstr *end,
148  unsigned NumRegionInstrs) const override;
149 
150  bool enableEarlyIfConversion() const override;
151 
152  std::unique_ptr<PBQPRAConstraint> getCustomPBQPConstraints() const override;
153 };
154 } // End llvm namespace
155 
156 #endif
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:240
const AArch64RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Definition: Triple.h:489
bool hasZeroCycleRegMove() const
bool hasZeroCycleZeroing() const
AArch64SelectionDAGInfo TSInfo
const_iterator begin(StringRef path)
Get begin iterator over path.
Definition: Path.cpp:232
const AArch64FrameLowering * getFrameLowering() const override
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:464
bool isOSLinux() const
Tests whether the OS is Linux.
Definition: Triple.h:474
const AArch64RegisterInfo * getRegisterInfo() const override
unsigned getMaxInlineSizeThreshold() const
getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size that still makes it profitable t...
bool useAA() const override
bool enableMachineScheduler() const override
const Triple & getTargetTriple() const
bool enableEarlyIfConversion() const override
bool isiOS() const
Is this an iOS triple.
Definition: Triple.h:399
const AArch64TargetLowering * getTargetLowering() const override
bool isLittleEndian() const
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
Definition: Triple.h:484
unsigned char ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const
ClassifyGlobalReference - Find the target operand flags that describe how a global value should be re...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
Definition: Triple.h:404
const AArch64SelectionDAGInfo * getSelectionDAGInfo() const override
AArch64InstrInfo InstrInfo
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
std::string CPUString
CPUString - String name of used CPU.
const char * getBZeroEntry() const
This function returns the name of a function which has an interface like the non-standard bzero funct...
bool enablePostRAScheduler() const override
bool isTargetDarwin() const
void overrideSchedPolicy(MachineSchedPolicy &Policy, MachineInstr *begin, MachineInstr *end, unsigned NumRegionInstrs) const override
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
Representation of each machine instruction.
Definition: MachineInstr.h:51
std::unique_ptr< PBQPRAConstraint > getCustomPBQPConstraints() const override
AArch64Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM, bool LittleEndian)
This constructor initializes the data members to match that of the specified triple.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:479
bool isTargetWindows() const
AArch64FrameLowering FrameLowering
Triple TargetTriple
TargetTriple - What processor and OS we're targeting.
ARMProcFamilyEnum ARMProcFamily
ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
const AArch64InstrInfo * getInstrInfo() const override
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
AArch64TargetLowering TLInfo