blob: e94a044c09cc100dbcfbae6f907d85f331943eb3 [file] [log] [blame]
Tim Northover3b0846e2014-05-24 12:50:23 +00001//===--- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000014#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
15#define LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
Tim Northover3b0846e2014-05-24 12:50:23 +000016
Eric Christopher29aab7b2014-06-10 17:44:12 +000017#include "AArch64FrameLowering.h"
Eric Christopher841da852014-06-10 23:26:45 +000018#include "AArch64ISelLowering.h"
Benjamin Kramer1f8930e2014-07-25 11:42:14 +000019#include "AArch64InstrInfo.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000020#include "AArch64RegisterInfo.h"
Eric Christopherfcb06ca2014-06-10 18:21:53 +000021#include "AArch64SelectionDAGInfo.h"
Quentin Colombet61d71a12017-08-15 22:31:51 +000022#include "llvm/CodeGen/GlobalISel/CallLowering.h"
23#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
24#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
25#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
David Blaikieb3bde2e2017-11-17 01:07:10 +000026#include "llvm/CodeGen/TargetSubtargetInfo.h"
Eric Christopher6f2a2032014-06-10 18:06:23 +000027#include "llvm/IR/DataLayout.h"
Tim Northover3b0846e2014-05-24 12:50:23 +000028#include <string>
29
30#define GET_SUBTARGETINFO_HEADER
31#include "AArch64GenSubtargetInfo.inc"
32
33namespace llvm {
34class GlobalValue;
35class StringRef;
Daniel Sandersa73f1fd2015-06-10 12:11:26 +000036class Triple;
Tim Northover3b0846e2014-05-24 12:50:23 +000037
Ahmed Bougacha5e402ee2016-07-27 14:31:46 +000038class AArch64Subtarget final : public AArch64GenSubtargetInfo {
Matthias Braun651cff42016-06-02 18:03:53 +000039public:
40 enum ARMProcFamilyEnum : uint8_t {
MinSeong Kima7385eb2016-01-05 12:51:59 +000041 Others,
42 CortexA35,
43 CortexA53,
Sam Parkerb252ffd2017-08-21 08:43:06 +000044 CortexA55,
MinSeong Kima7385eb2016-01-05 12:51:59 +000045 CortexA57,
Silviu Barangaaee40fc2016-06-21 15:53:54 +000046 CortexA72,
47 CortexA73,
Sam Parkerb252ffd2017-08-21 08:43:06 +000048 CortexA75,
MinSeong Kima7385eb2016-01-05 12:51:59 +000049 Cyclone,
Chad Rosiercd2be7f2016-02-12 15:51:51 +000050 ExynosM1,
Evandro Menezes9f9daa12018-01-30 15:40:16 +000051 ExynosM3,
Chad Rosier201fc1e2016-11-15 21:34:12 +000052 Falkor,
Pankaj Gode0aab2e32016-06-20 11:13:31 +000053 Kryo,
Chad Rosier71070852017-09-25 14:05:00 +000054 Saphira,
Joel Jones28520882017-03-07 19:42:40 +000055 ThunderX2T99,
Joel Jonesab0f3b42017-02-17 18:34:24 +000056 ThunderX,
57 ThunderXT81,
58 ThunderXT83,
Bryan Chan12355392018-11-09 19:32:08 +000059 ThunderXT88,
60 TSV110
MinSeong Kima7385eb2016-01-05 12:51:59 +000061 };
Tim Northover3b0846e2014-05-24 12:50:23 +000062
Matthias Braun651cff42016-06-02 18:03:53 +000063protected:
Tim Northover3b0846e2014-05-24 12:50:23 +000064 /// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
Matthias Braun27b66922016-05-27 22:14:09 +000065 ARMProcFamilyEnum ARMProcFamily = Others;
Tim Northover3b0846e2014-05-24 12:50:23 +000066
Matthias Braun27b66922016-05-27 22:14:09 +000067 bool HasV8_1aOps = false;
68 bool HasV8_2aOps = false;
Sam Parker9d957642017-08-10 09:41:00 +000069 bool HasV8_3aOps = false;
Sjoerd Meijer195e9042018-06-29 08:43:19 +000070 bool HasV8_4aOps = false;
Oliver Stannard7c3c4ba2018-09-26 12:48:21 +000071 bool HasV8_5aOps = false;
Vladimir Sukharev439328e2015-04-01 14:49:29 +000072
Matthias Braun27b66922016-05-27 22:14:09 +000073 bool HasFPARMv8 = false;
74 bool HasNEON = false;
75 bool HasCrypto = false;
Sjoerd Meijer79876332017-08-09 14:59:54 +000076 bool HasDotProd = false;
Matthias Braun27b66922016-05-27 22:14:09 +000077 bool HasCRC = false;
Joel Jones75818bc2016-11-30 22:25:24 +000078 bool HasLSE = false;
Sjoerd Meijerd906bf12016-06-03 14:03:27 +000079 bool HasRAS = false;
Chad Rosier58fb5f52017-01-16 16:28:43 +000080 bool HasRDM = false;
Matthias Braun27b66922016-05-27 22:14:09 +000081 bool HasPerfMon = false;
82 bool HasFullFP16 = false;
Bernard Ogdenb828bb22018-08-17 11:29:49 +000083 bool HasFP16FML = false;
Matthias Braun27b66922016-05-27 22:14:09 +000084 bool HasSPE = false;
Sjoerd Meijer195e9042018-06-29 08:43:19 +000085
Diogo N. Sampaio9c906732018-12-06 15:39:17 +000086 // ARMv8.1 extensions
87 bool HasVH = false;
88 bool HasPAN = false;
89 bool HasLOR = false;
90
91 // ARMv8.2 extensions
92 bool HasPsUAO = false;
93 bool HasPAN_RWV = false;
94 bool HasCCPP = false;
95
96 // ARMv8.3 extensions
97 bool HasPA = false;
98 bool HasJS = false;
99 bool HasCCIDX = false;
100 bool HasComplxNum = false;
101
102 // ARMv8.4 extensions
103 bool HasNV = false;
104 bool HasRASv8_4 = false;
105 bool HasMPAM = false;
106 bool HasDIT = false;
107 bool HasTRACEV8_4 = false;
108 bool HasAM = false;
109 bool HasSEL2 = false;
110 bool HasTLB_RMI = false;
111 bool HasFMI = false;
112 bool HasRCPC_IMMO = false;
Sjoerd Meijer195e9042018-06-29 08:43:19 +0000113 // ARMv8.4 Crypto extensions
114 bool HasSM4 = true;
115 bool HasSHA3 = true;
116
117 bool HasSHA2 = true;
118 bool HasAES = true;
119
Balaram Makam2aba753e2017-03-31 18:16:53 +0000120 bool HasLSLFast = false;
Amara Emerson9f3a2452017-07-13 15:19:56 +0000121 bool HasSVE = false;
Sam Parker71a474d2017-08-10 09:52:55 +0000122 bool HasRCPC = false;
Joel Jones07150922018-01-25 21:55:39 +0000123 bool HasAggressiveFMA = false;
Tim Northover3b0846e2014-05-24 12:50:23 +0000124
Oliver Stannard31af1782018-09-27 09:11:27 +0000125 // Armv8.5-A Extensions
126 bool HasAlternativeNZCV = false;
Oliver Stannardddb7d462018-09-27 13:32:06 +0000127 bool HasFRInt3264 = false;
Oliver Stannard8459d342018-09-27 14:05:46 +0000128 bool HasSpecRestrict = false;
Pablo Barrioa17f8552018-12-03 14:00:47 +0000129 bool HasSSBS = false;
Diogo N. Sampaio9123f822018-12-28 17:14:58 +0000130 bool HasSB = false;
Oliver Stannard224428c2018-09-27 13:47:40 +0000131 bool HasPredCtrl = false;
Oliver Stannard6930b122018-09-27 13:53:35 +0000132 bool HasCCDP = false;
Oliver Stannarda9a5eee2018-09-27 14:54:33 +0000133 bool HasBTI = false;
Oliver Stannarddc837e32018-09-27 14:01:40 +0000134 bool HasRandGen = false;
Oliver Stannard85de5402018-10-02 09:36:28 +0000135 bool HasMTE = false;
Oliver Stannard31af1782018-09-27 09:11:27 +0000136
Tim Northover3b0846e2014-05-24 12:50:23 +0000137 // HasZeroCycleRegMove - Has zero-cycle register mov instructions.
Matthias Braun27b66922016-05-27 22:14:09 +0000138 bool HasZeroCycleRegMove = false;
Tim Northover3b0846e2014-05-24 12:50:23 +0000139
140 // HasZeroCycleZeroing - Has zero-cycle zeroing instructions.
Matthias Braun27b66922016-05-27 22:14:09 +0000141 bool HasZeroCycleZeroing = false;
Evandro Menezesfc1852f2018-09-28 19:05:09 +0000142 bool HasZeroCycleZeroingGP = false;
143 bool HasZeroCycleZeroingFP = false;
Tim Northover9097a072017-12-18 10:36:00 +0000144 bool HasZeroCycleZeroingFPWorkaround = false;
Tim Northover3b0846e2014-05-24 12:50:23 +0000145
Akira Hatanakaf53b0402015-07-29 14:17:26 +0000146 // StrictAlign - Disallow unaligned memory accesses.
Matthias Braun27b66922016-05-27 22:14:09 +0000147 bool StrictAlign = false;
Sanne Woudad4658ee2017-03-28 10:02:56 +0000148
149 // NegativeImmediates - transform instructions with negative immediates
150 bool NegativeImmediates = true;
151
Adam Nemete29686e2017-05-15 21:15:01 +0000152 // Enable 64-bit vectorization in SLP.
153 unsigned MinVectorRegisterBitWidth = 64;
154
Matthias Braun651cff42016-06-02 18:03:53 +0000155 bool UseAA = false;
156 bool PredictableSelectIsExpensive = false;
157 bool BalanceFPOps = false;
158 bool CustomAsCheapAsMove = false;
Evandro Menezes07c78ee2018-01-30 15:40:22 +0000159 bool ExynosAsCheapAsMove = false;
Matthias Braun651cff42016-06-02 18:03:53 +0000160 bool UsePostRAScheduler = false;
161 bool Misaligned128StoreIsSlow = false;
Evandro Menezes7784cac2017-01-24 17:34:31 +0000162 bool Paired128IsSlow = false;
Geoff Berry40cdc0e2017-08-28 20:48:43 +0000163 bool STRQroIsSlow = false;
Matthias Braun651cff42016-06-02 18:03:53 +0000164 bool UseAlternateSExtLoadCVTF32Pattern = false;
Matthias Braun46a52382016-10-04 19:28:21 +0000165 bool HasArithmeticBccFusion = false;
166 bool HasArithmeticCbzFusion = false;
Evandro Menezesf1d01642018-01-30 16:28:01 +0000167 bool HasFuseAddress = false;
Evandro Menezesb21fb292017-02-01 02:54:39 +0000168 bool HasFuseAES = false;
Matthias Braun28d6a4a2018-09-19 20:50:51 +0000169 bool HasFuseCryptoEOR = false;
Evandro Menezes1afffac2018-02-23 19:27:43 +0000170 bool HasFuseCCSelect = false;
Evandro Menezes455382e2017-02-01 02:54:42 +0000171 bool HasFuseLiterals = false;
Matthias Braun651cff42016-06-02 18:03:53 +0000172 bool DisableLatencySchedHeuristic = false;
Evandro Menezeseff2bd92016-10-24 16:14:58 +0000173 bool UseRSqrt = false;
Tim Northover1c353412018-10-24 20:19:09 +0000174 bool Force32BitJumpTables = false;
Matthias Braun651cff42016-06-02 18:03:53 +0000175 uint8_t MaxInterleaveFactor = 2;
176 uint8_t VectorInsertExtractBaseCost = 3;
177 uint16_t CacheLineSize = 0;
178 uint16_t PrefetchDistance = 0;
179 uint16_t MinPrefetchStride = 1;
180 unsigned MaxPrefetchIterationsAhead = UINT_MAX;
Evandro Menezesa3a0a602016-06-10 16:00:18 +0000181 unsigned PrefFunctionAlignment = 0;
182 unsigned PrefLoopAlignment = 0;
Evandro Menezese45de8a2016-09-26 15:32:33 +0000183 unsigned MaxJumpTableSize = 0;
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000184 unsigned WideningBaseCost = 0;
Akira Hatanakaf53b0402015-07-29 14:17:26 +0000185
Nick Desaulniers287a3be2018-09-07 20:58:57 +0000186 // ReserveXRegister[i] - X#i is not available as a general purpose register.
187 BitVector ReserveXRegister;
Petr Hosek72509082018-06-12 20:00:50 +0000188
Tri Vo6c47c622018-09-22 22:17:50 +0000189 // CustomCallUsedXRegister[i] - X#i call saved.
190 BitVector CustomCallSavedXRegs;
191
Eric Christopher8b770652015-01-26 19:03:15 +0000192 bool IsLittle;
193
Tim Northover3b0846e2014-05-24 12:50:23 +0000194 /// TargetTriple - What processor and OS we're targeting.
195 Triple TargetTriple;
196
Eric Christopher29aab7b2014-06-10 17:44:12 +0000197 AArch64FrameLowering FrameLowering;
Eric Christopherf63bc642014-06-10 22:57:25 +0000198 AArch64InstrInfo InstrInfo;
Eric Christopherfcb06ca2014-06-10 18:21:53 +0000199 AArch64SelectionDAGInfo TSInfo;
Eric Christopher7c9d4e02014-06-11 00:46:34 +0000200 AArch64TargetLowering TLInfo;
Quentin Colombet61d71a12017-08-15 22:31:51 +0000201
202 /// GlobalISel related APIs.
203 std::unique_ptr<CallLowering> CallLoweringInfo;
204 std::unique_ptr<InstructionSelector> InstSelector;
205 std::unique_ptr<LegalizerInfo> Legalizer;
206 std::unique_ptr<RegisterBankInfo> RegBankInfo;
Quentin Colombetba2a0162016-02-16 19:26:02 +0000207
Eric Christopher7c9d4e02014-06-11 00:46:34 +0000208private:
209 /// initializeSubtargetDependencies - Initializes using CPUString and the
210 /// passed in feature string so that we can use initializer lists for
211 /// subtarget initialization.
Matthias Brauna827ed82016-10-03 20:17:02 +0000212 AArch64Subtarget &initializeSubtargetDependencies(StringRef FS,
213 StringRef CPUString);
Eric Christopher29aab7b2014-06-10 17:44:12 +0000214
Matthias Braun651cff42016-06-02 18:03:53 +0000215 /// Initialize properties based on the selected processor family.
216 void initializeProperties();
217
Tim Northover3b0846e2014-05-24 12:50:23 +0000218public:
219 /// This constructor initializes the data members to match that
220 /// of the specified triple.
Daniel Sandersa73f1fd2015-06-10 12:11:26 +0000221 AArch64Subtarget(const Triple &TT, const std::string &CPU,
Eric Christophera0de2532015-03-18 20:37:30 +0000222 const std::string &FS, const TargetMachine &TM,
Daniel Sandersa1b2db792017-05-19 11:08:33 +0000223 bool LittleEndian);
Tim Northover3b0846e2014-05-24 12:50:23 +0000224
Eric Christopherd9134482014-08-04 21:25:23 +0000225 const AArch64SelectionDAGInfo *getSelectionDAGInfo() const override {
226 return &TSInfo;
227 }
228 const AArch64FrameLowering *getFrameLowering() const override {
Eric Christopher29aab7b2014-06-10 17:44:12 +0000229 return &FrameLowering;
230 }
Eric Christopherd9134482014-08-04 21:25:23 +0000231 const AArch64TargetLowering *getTargetLowering() const override {
Eric Christopher7c9d4e02014-06-11 00:46:34 +0000232 return &TLInfo;
Eric Christopher841da852014-06-10 23:26:45 +0000233 }
Eric Christopherd9134482014-08-04 21:25:23 +0000234 const AArch64InstrInfo *getInstrInfo() const override { return &InstrInfo; }
Eric Christophera0de2532015-03-18 20:37:30 +0000235 const AArch64RegisterInfo *getRegisterInfo() const override {
236 return &getInstrInfo()->getRegisterInfo();
237 }
Quentin Colombetba2a0162016-02-16 19:26:02 +0000238 const CallLowering *getCallLowering() const override;
Ahmed Bougacha6756a2c2016-07-27 14:31:55 +0000239 const InstructionSelector *getInstructionSelector() const override;
Tim Northover69fa84a2016-10-14 22:18:18 +0000240 const LegalizerInfo *getLegalizerInfo() const override;
Quentin Colombetc17f7442016-04-06 17:26:03 +0000241 const RegisterBankInfo *getRegBankInfo() const override;
Eric Christopher09696d32015-03-12 02:04:46 +0000242 const Triple &getTargetTriple() const { return TargetTriple; }
Tim Northover3b0846e2014-05-24 12:50:23 +0000243 bool enableMachineScheduler() const override { return true; }
Matthias Braun39a2afc2015-06-13 03:42:16 +0000244 bool enablePostRAScheduler() const override {
Matthias Braun651cff42016-06-02 18:03:53 +0000245 return UsePostRAScheduler;
246 }
247
248 /// Returns ARM processor family.
249 /// Avoid this function! CPU specifics should be kept local to this class
250 /// and preferably modeled with SubtargetFeatures or properties in
251 /// initializeProperties().
252 ARMProcFamilyEnum getProcFamily() const {
253 return ARMProcFamily;
Chad Rosier486e0872014-09-12 17:40:39 +0000254 }
Tim Northover3b0846e2014-05-24 12:50:23 +0000255
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000256 bool hasV8_1aOps() const { return HasV8_1aOps; }
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000257 bool hasV8_2aOps() const { return HasV8_2aOps; }
Sam Parker9d957642017-08-10 09:41:00 +0000258 bool hasV8_3aOps() const { return HasV8_3aOps; }
Sjoerd Meijer195e9042018-06-29 08:43:19 +0000259 bool hasV8_4aOps() const { return HasV8_4aOps; }
Oliver Stannard7c3c4ba2018-09-26 12:48:21 +0000260 bool hasV8_5aOps() const { return HasV8_5aOps; }
Vladimir Sukharev439328e2015-04-01 14:49:29 +0000261
Tim Northover3b0846e2014-05-24 12:50:23 +0000262 bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
263
Evandro Menezesfc1852f2018-09-28 19:05:09 +0000264 bool hasZeroCycleZeroingGP() const { return HasZeroCycleZeroingGP; }
265
266 bool hasZeroCycleZeroingFP() const { return HasZeroCycleZeroingFP; }
Tim Northover3b0846e2014-05-24 12:50:23 +0000267
Tim Northover9097a072017-12-18 10:36:00 +0000268 bool hasZeroCycleZeroingFPWorkaround() const {
269 return HasZeroCycleZeroingFPWorkaround;
270 }
271
Akira Hatanakaf53b0402015-07-29 14:17:26 +0000272 bool requiresStrictAlign() const { return StrictAlign; }
273
Dean Michael Berris3234d3a2016-11-17 05:15:37 +0000274 bool isXRaySupported() const override { return true; }
275
Adam Nemete29686e2017-05-15 21:15:01 +0000276 unsigned getMinVectorRegisterBitWidth() const {
277 return MinVectorRegisterBitWidth;
278 }
279
Nick Desaulniers287a3be2018-09-07 20:58:57 +0000280 bool isXRegisterReserved(size_t i) const { return ReserveXRegister[i]; }
281 unsigned getNumXRegisterReserved() const { return ReserveXRegister.count(); }
Tri Vo6c47c622018-09-22 22:17:50 +0000282 bool isXRegCustomCalleeSaved(size_t i) const {
283 return CustomCallSavedXRegs[i];
284 }
285 bool hasCustomCallingConv() const { return CustomCallSavedXRegs.any(); }
Tim Northover3b0846e2014-05-24 12:50:23 +0000286 bool hasFPARMv8() const { return HasFPARMv8; }
287 bool hasNEON() const { return HasNEON; }
288 bool hasCrypto() const { return HasCrypto; }
Sjoerd Meijer79876332017-08-09 14:59:54 +0000289 bool hasDotProd() const { return HasDotProd; }
Tim Northover3b0846e2014-05-24 12:50:23 +0000290 bool hasCRC() const { return HasCRC; }
Joel Jones75818bc2016-11-30 22:25:24 +0000291 bool hasLSE() const { return HasLSE; }
Sjoerd Meijerd906bf12016-06-03 14:03:27 +0000292 bool hasRAS() const { return HasRAS; }
Chad Rosier58fb5f52017-01-16 16:28:43 +0000293 bool hasRDM() const { return HasRDM; }
Sjoerd Meijer195e9042018-06-29 08:43:19 +0000294 bool hasSM4() const { return HasSM4; }
295 bool hasSHA3() const { return HasSHA3; }
296 bool hasSHA2() const { return HasSHA2; }
297 bool hasAES() const { return HasAES; }
Matthias Braun651cff42016-06-02 18:03:53 +0000298 bool balanceFPOps() const { return BalanceFPOps; }
299 bool predictableSelectIsExpensive() const {
300 return PredictableSelectIsExpensive;
301 }
302 bool hasCustomCheapAsMoveHandling() const { return CustomAsCheapAsMove; }
Evandro Menezes07c78ee2018-01-30 15:40:22 +0000303 bool hasExynosCheapAsMoveHandling() const { return ExynosAsCheapAsMove; }
Matthias Braun651cff42016-06-02 18:03:53 +0000304 bool isMisaligned128StoreSlow() const { return Misaligned128StoreIsSlow; }
Evandro Menezes7784cac2017-01-24 17:34:31 +0000305 bool isPaired128Slow() const { return Paired128IsSlow; }
Geoff Berry40cdc0e2017-08-28 20:48:43 +0000306 bool isSTRQroSlow() const { return STRQroIsSlow; }
Matthias Braun651cff42016-06-02 18:03:53 +0000307 bool useAlternateSExtLoadCVTF32Pattern() const {
308 return UseAlternateSExtLoadCVTF32Pattern;
309 }
Matthias Braun46a52382016-10-04 19:28:21 +0000310 bool hasArithmeticBccFusion() const { return HasArithmeticBccFusion; }
311 bool hasArithmeticCbzFusion() const { return HasArithmeticCbzFusion; }
Evandro Menezesf1d01642018-01-30 16:28:01 +0000312 bool hasFuseAddress() const { return HasFuseAddress; }
Evandro Menezesb21fb292017-02-01 02:54:39 +0000313 bool hasFuseAES() const { return HasFuseAES; }
Matthias Braun28d6a4a2018-09-19 20:50:51 +0000314 bool hasFuseCryptoEOR() const { return HasFuseCryptoEOR; }
Evandro Menezes1afffac2018-02-23 19:27:43 +0000315 bool hasFuseCCSelect() const { return HasFuseCCSelect; }
Evandro Menezes455382e2017-02-01 02:54:42 +0000316 bool hasFuseLiterals() const { return HasFuseLiterals; }
Florian Hahnf934add2017-07-12 20:53:22 +0000317
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000318 /// Return true if the CPU supports any kind of instruction fusion.
Florian Hahnf934add2017-07-12 20:53:22 +0000319 bool hasFusion() const {
320 return hasArithmeticBccFusion() || hasArithmeticCbzFusion() ||
Evandro Menezes1afffac2018-02-23 19:27:43 +0000321 hasFuseAES() || hasFuseCCSelect() || hasFuseLiterals();
Florian Hahnf934add2017-07-12 20:53:22 +0000322 }
323
Evandro Menezeseff2bd92016-10-24 16:14:58 +0000324 bool useRSqrt() const { return UseRSqrt; }
Tim Northover1c353412018-10-24 20:19:09 +0000325 bool force32BitJumpTables() const { return Force32BitJumpTables; }
Matthias Braun651cff42016-06-02 18:03:53 +0000326 unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
327 unsigned getVectorInsertExtractBaseCost() const {
328 return VectorInsertExtractBaseCost;
329 }
330 unsigned getCacheLineSize() const { return CacheLineSize; }
331 unsigned getPrefetchDistance() const { return PrefetchDistance; }
332 unsigned getMinPrefetchStride() const { return MinPrefetchStride; }
333 unsigned getMaxPrefetchIterationsAhead() const {
334 return MaxPrefetchIterationsAhead;
335 }
Evandro Menezesa3a0a602016-06-10 16:00:18 +0000336 unsigned getPrefFunctionAlignment() const { return PrefFunctionAlignment; }
337 unsigned getPrefLoopAlignment() const { return PrefLoopAlignment; }
Matthias Braun651cff42016-06-02 18:03:53 +0000338
Evandro Menezese45de8a2016-09-26 15:32:33 +0000339 unsigned getMaximumJumpTableSize() const { return MaxJumpTableSize; }
340
Matthew Simpson78fd46b2017-05-09 20:18:12 +0000341 unsigned getWideningBaseCost() const { return WideningBaseCost; }
342
Tim Northover339c83e2015-11-10 00:44:23 +0000343 /// CPU has TBI (top byte of addresses is ignored during HW address
344 /// translation) and OS enables it.
345 bool supportsAddressTopByteIgnored() const;
346
Ahmed Bougachab0ff6432015-09-01 16:23:45 +0000347 bool hasPerfMon() const { return HasPerfMon; }
Oliver Stannard7cc0c4e2015-11-26 15:23:32 +0000348 bool hasFullFP16() const { return HasFullFP16; }
Bernard Ogdenb828bb22018-08-17 11:29:49 +0000349 bool hasFP16FML() const { return HasFP16FML; }
Oliver Stannarda34e4702015-12-01 10:48:51 +0000350 bool hasSPE() const { return HasSPE; }
Balaram Makam2aba753e2017-03-31 18:16:53 +0000351 bool hasLSLFast() const { return HasLSLFast; }
Amara Emerson9f3a2452017-07-13 15:19:56 +0000352 bool hasSVE() const { return HasSVE; }
Sam Parker71a474d2017-08-10 09:52:55 +0000353 bool hasRCPC() const { return HasRCPC; }
Joel Jones07150922018-01-25 21:55:39 +0000354 bool hasAggressiveFMA() const { return HasAggressiveFMA; }
Oliver Stannard31af1782018-09-27 09:11:27 +0000355 bool hasAlternativeNZCV() const { return HasAlternativeNZCV; }
Oliver Stannardddb7d462018-09-27 13:32:06 +0000356 bool hasFRInt3264() const { return HasFRInt3264; }
Oliver Stannardc4190282018-10-02 10:04:39 +0000357 bool hasSpecRestrict() const { return HasSpecRestrict; }
Pablo Barrioa17f8552018-12-03 14:00:47 +0000358 bool hasSSBS() const { return HasSSBS; }
Diogo N. Sampaio9123f822018-12-28 17:14:58 +0000359 bool hasSB() const { return HasSB; }
Oliver Stannardc4190282018-10-02 10:04:39 +0000360 bool hasPredCtrl() const { return HasPredCtrl; }
361 bool hasCCDP() const { return HasCCDP; }
362 bool hasBTI() const { return HasBTI; }
363 bool hasRandGen() const { return HasRandGen; }
364 bool hasMTE() const { return HasMTE; }
Tim Northover3b0846e2014-05-24 12:50:23 +0000365
Eric Christopher8b770652015-01-26 19:03:15 +0000366 bool isLittleEndian() const { return IsLittle; }
Tim Northover3b0846e2014-05-24 12:50:23 +0000367
368 bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
Chad Rosierb481bdf2014-08-06 16:56:58 +0000369 bool isTargetIOS() const { return TargetTriple.isiOS(); }
370 bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
371 bool isTargetWindows() const { return TargetTriple.isOSWindows(); }
Evgeniy Stepanov5fe279e2015-10-08 21:21:24 +0000372 bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
Petr Hoseka7d59162017-02-24 03:10:10 +0000373 bool isTargetFuchsia() const { return TargetTriple.isOSFuchsia(); }
Tim Northover3b0846e2014-05-24 12:50:23 +0000374
Chad Rosierb481bdf2014-08-06 16:56:58 +0000375 bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
Tim Northover3b0846e2014-05-24 12:50:23 +0000376 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
Tim Northover3b0846e2014-05-24 12:50:23 +0000377 bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
378
Matthias Braun651cff42016-06-02 18:03:53 +0000379 bool useAA() const override { return UseAA; }
Chad Rosierc9f94772014-09-08 14:31:49 +0000380
Diogo N. Sampaio9c906732018-12-06 15:39:17 +0000381 bool hasVH() const { return HasVH; }
382 bool hasPAN() const { return HasPAN; }
383 bool hasLOR() const { return HasLOR; }
384
385 bool hasPsUAO() const { return HasPsUAO; }
386 bool hasPAN_RWV() const { return HasPAN_RWV; }
387 bool hasCCPP() const { return HasCCPP; }
388
389 bool hasPA() const { return HasPA; }
390 bool hasJS() const { return HasJS; }
391 bool hasCCIDX() const { return HasCCIDX; }
392 bool hasComplxNum() const { return HasComplxNum; }
393
394 bool hasNV() const { return HasNV; }
395 bool hasRASv8_4() const { return HasRASv8_4; }
396 bool hasMPAM() const { return HasMPAM; }
397 bool hasDIT() const { return HasDIT; }
398 bool hasTRACEV8_4() const { return HasTRACEV8_4; }
399 bool hasAM() const { return HasAM; }
400 bool hasSEL2() const { return HasSEL2; }
401 bool hasTLB_RMI() const { return HasTLB_RMI; }
402 bool hasFMI() const { return HasFMI; }
403 bool hasRCPC_IMMO() const { return HasRCPC_IMMO; }
404
Petr Hosek9eb0a1e2017-04-04 19:51:53 +0000405 bool useSmallAddressing() const {
406 switch (TLInfo.getTargetMachine().getCodeModel()) {
407 case CodeModel::Kernel:
408 // Kernel is currently allowed only for Fuchsia targets,
409 // where it is the same as Small for almost all purposes.
410 case CodeModel::Small:
411 return true;
412 default:
413 return false;
414 }
415 }
416
Tim Northover3b0846e2014-05-24 12:50:23 +0000417 /// ParseSubtargetFeatures - Parses features string setting specified
418 /// subtarget options. Definition of function is auto generated by tblgen.
419 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
420
421 /// ClassifyGlobalReference - Find the target operand flags that describe
422 /// how a global value should be referenced for the current subtarget.
423 unsigned char ClassifyGlobalReference(const GlobalValue *GV,
424 const TargetMachine &TM) const;
425
Tim Northover879a0b22017-04-17 17:27:56 +0000426 unsigned char classifyGlobalFunctionReference(const GlobalValue *GV,
427 const TargetMachine &TM) const;
428
Duncan P. N. Exon Smith63298722016-07-01 00:23:27 +0000429 void overrideSchedPolicy(MachineSchedPolicy &Policy,
Tim Northover3b0846e2014-05-24 12:50:23 +0000430 unsigned NumRegionInstrs) const override;
431
432 bool enableEarlyIfConversion() const override;
Lang Hames8f31f442014-10-09 18:20:51 +0000433
434 std::unique_ptr<PBQPRAConstraint> getCustomPBQPConstraints() const override;
Martin Storsjo2f24e932017-07-17 20:05:19 +0000435
436 bool isCallingConvWin64(CallingConv::ID CC) const {
437 switch (CC) {
438 case CallingConv::C:
Saleem Abdulrasoolefd2cb82018-12-05 07:09:20 +0000439 case CallingConv::Fast:
440 case CallingConv::Swift:
Martin Storsjo2f24e932017-07-17 20:05:19 +0000441 return isTargetWindows();
442 case CallingConv::Win64:
443 return true;
444 default:
445 return false;
446 }
447 }
Matthias Braun5c290dc2018-01-19 03:16:36 +0000448
449 void mirFileLoaded(MachineFunction &MF) const override;
Tim Northover3b0846e2014-05-24 12:50:23 +0000450};
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000451} // End llvm namespace
Tim Northover3b0846e2014-05-24 12:50:23 +0000452
Benjamin Kramera7c40ef2014-08-13 16:26:38 +0000453#endif