2014-05-24 20:50:23 +08:00
|
|
|
//===--- AArch64Subtarget.h - Define Subtarget for the AArch64 -*- C++ -*--===//
|
2014-03-29 18:18:08 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2014-05-24 20:50:23 +08:00
|
|
|
// This file declares the AArch64 specific subclass of TargetSubtarget.
|
2014-03-29 18:18:08 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_AARCH64_AARCH64SUBTARGET_H
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2014-06-11 01:44:12 +08:00
|
|
|
#include "AArch64FrameLowering.h"
|
2014-06-11 07:26:45 +08:00
|
|
|
#include "AArch64ISelLowering.h"
|
2014-07-25 19:42:14 +08:00
|
|
|
#include "AArch64InstrInfo.h"
|
2014-05-24 20:50:23 +08:00
|
|
|
#include "AArch64RegisterInfo.h"
|
2014-06-11 02:21:53 +08:00
|
|
|
#include "AArch64SelectionDAGInfo.h"
|
2016-04-15 01:45:38 +08:00
|
|
|
#include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
|
2014-06-11 02:06:23 +08:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
2014-06-11 01:44:12 +08:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2014-03-29 18:18:08 +08:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2014-05-24 20:50:23 +08:00
|
|
|
#include "AArch64GenSubtargetInfo.inc"
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class GlobalValue;
|
|
|
|
class StringRef;
|
2015-06-10 20:11:26 +08:00
|
|
|
class Triple;
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2016-07-27 22:31:46 +08:00
|
|
|
class AArch64Subtarget final : public AArch64GenSubtargetInfo {
|
2016-06-03 02:03:53 +08:00
|
|
|
public:
|
|
|
|
enum ARMProcFamilyEnum : uint8_t {
|
2016-01-05 20:51:59 +08:00
|
|
|
Others,
|
|
|
|
CortexA35,
|
|
|
|
CortexA53,
|
|
|
|
CortexA57,
|
[AArch64] Restore codegen for AArch64 Cortex-A72/A73 after NFCI
Summary:
Code generation for Cortex-A72/Cortex-A73 was accidentally changed
by r271555, which was a NFCI. The isCortexA57() predicate was not true
for Cortex-A72/Cortex-A73 before r271555 (since it was checking the CPU
string). Because Cortex-A72/Cortex-A73 inherit all features from Cortex-A57,
all decisions previously guarded by isCortexA57() are now taken.
This change restores the behaviour before r271555 by adding separate
ProcA72/ProcA73, which have the required features to preserve code
generation.
Reviewers: kristof.beyls, aadg, mcrosier, rengolin
Subscribers: mcrosier, llvm-commits, aemerson, t.p.northover, MatzeB, rengolin
Differential Revision: http://reviews.llvm.org/D21182
llvm-svn: 273277
2016-06-21 23:53:54 +08:00
|
|
|
CortexA72,
|
|
|
|
CortexA73,
|
2016-01-05 20:51:59 +08:00
|
|
|
Cyclone,
|
2016-02-12 23:51:51 +08:00
|
|
|
ExynosM1,
|
2016-11-16 05:34:12 +08:00
|
|
|
Falkor,
|
2016-06-20 19:13:31 +08:00
|
|
|
Kryo,
|
2017-03-08 03:42:40 +08:00
|
|
|
ThunderX2T99,
|
2017-02-18 02:34:24 +08:00
|
|
|
ThunderX,
|
|
|
|
ThunderXT81,
|
|
|
|
ThunderXT83,
|
|
|
|
ThunderXT88
|
2016-01-05 20:51:59 +08:00
|
|
|
};
|
2014-04-15 01:38:00 +08:00
|
|
|
|
2016-06-03 02:03:53 +08:00
|
|
|
protected:
|
2014-04-15 01:38:00 +08:00
|
|
|
/// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
|
2016-05-28 06:14:09 +08:00
|
|
|
ARMProcFamilyEnum ARMProcFamily = Others;
|
2014-04-15 01:38:00 +08:00
|
|
|
|
2016-05-28 06:14:09 +08:00
|
|
|
bool HasV8_1aOps = false;
|
|
|
|
bool HasV8_2aOps = false;
|
2015-04-01 22:49:29 +08:00
|
|
|
|
2016-05-28 06:14:09 +08:00
|
|
|
bool HasFPARMv8 = false;
|
|
|
|
bool HasNEON = false;
|
|
|
|
bool HasCrypto = false;
|
|
|
|
bool HasCRC = false;
|
2016-12-01 06:25:24 +08:00
|
|
|
bool HasLSE = false;
|
2016-06-03 22:03:27 +08:00
|
|
|
bool HasRAS = false;
|
2017-01-17 00:28:43 +08:00
|
|
|
bool HasRDM = false;
|
2016-05-28 06:14:09 +08:00
|
|
|
bool HasPerfMon = false;
|
|
|
|
bool HasFullFP16 = false;
|
|
|
|
bool HasSPE = false;
|
2017-04-01 02:16:53 +08:00
|
|
|
bool HasLSLFast = false;
|
2014-04-15 01:38:00 +08:00
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
// HasZeroCycleRegMove - Has zero-cycle register mov instructions.
|
2016-05-28 06:14:09 +08:00
|
|
|
bool HasZeroCycleRegMove = false;
|
2014-03-29 18:18:08 +08:00
|
|
|
|
|
|
|
// HasZeroCycleZeroing - Has zero-cycle zeroing instructions.
|
2016-05-28 06:14:09 +08:00
|
|
|
bool HasZeroCycleZeroing = false;
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-07-29 22:17:26 +08:00
|
|
|
// StrictAlign - Disallow unaligned memory accesses.
|
2016-05-28 06:14:09 +08:00
|
|
|
bool StrictAlign = false;
|
2017-03-28 18:02:56 +08:00
|
|
|
|
|
|
|
// NegativeImmediates - transform instructions with negative immediates
|
|
|
|
bool NegativeImmediates = true;
|
|
|
|
|
2016-06-03 02:03:53 +08:00
|
|
|
bool UseAA = false;
|
|
|
|
bool PredictableSelectIsExpensive = false;
|
|
|
|
bool BalanceFPOps = false;
|
|
|
|
bool CustomAsCheapAsMove = false;
|
|
|
|
bool UsePostRAScheduler = false;
|
|
|
|
bool Misaligned128StoreIsSlow = false;
|
2017-01-25 01:34:31 +08:00
|
|
|
bool Paired128IsSlow = false;
|
2016-06-03 02:03:53 +08:00
|
|
|
bool UseAlternateSExtLoadCVTF32Pattern = false;
|
2016-10-05 03:28:21 +08:00
|
|
|
bool HasArithmeticBccFusion = false;
|
|
|
|
bool HasArithmeticCbzFusion = false;
|
2017-02-01 10:54:39 +08:00
|
|
|
bool HasFuseAES = false;
|
2017-02-01 10:54:42 +08:00
|
|
|
bool HasFuseLiterals = false;
|
2016-06-03 02:03:53 +08:00
|
|
|
bool DisableLatencySchedHeuristic = false;
|
2016-10-25 00:14:58 +08:00
|
|
|
bool UseRSqrt = false;
|
2016-06-03 02:03:53 +08:00
|
|
|
uint8_t MaxInterleaveFactor = 2;
|
|
|
|
uint8_t VectorInsertExtractBaseCost = 3;
|
|
|
|
uint16_t CacheLineSize = 0;
|
|
|
|
uint16_t PrefetchDistance = 0;
|
|
|
|
uint16_t MinPrefetchStride = 1;
|
|
|
|
unsigned MaxPrefetchIterationsAhead = UINT_MAX;
|
2016-06-11 00:00:18 +08:00
|
|
|
unsigned PrefFunctionAlignment = 0;
|
|
|
|
unsigned PrefLoopAlignment = 0;
|
2016-09-26 23:32:33 +08:00
|
|
|
unsigned MaxJumpTableSize = 0;
|
2015-07-29 22:17:26 +08:00
|
|
|
|
2015-07-25 08:18:31 +08:00
|
|
|
// ReserveX18 - X18 is not available as a general purpose register.
|
|
|
|
bool ReserveX18;
|
|
|
|
|
2015-01-27 03:03:15 +08:00
|
|
|
bool IsLittle;
|
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
/// TargetTriple - What processor and OS we're targeting.
|
|
|
|
Triple TargetTriple;
|
|
|
|
|
2014-06-11 01:44:12 +08:00
|
|
|
AArch64FrameLowering FrameLowering;
|
2014-06-11 06:57:25 +08:00
|
|
|
AArch64InstrInfo InstrInfo;
|
2014-06-11 02:21:53 +08:00
|
|
|
AArch64SelectionDAGInfo TSInfo;
|
2014-06-11 08:46:34 +08:00
|
|
|
AArch64TargetLowering TLInfo;
|
2016-04-07 01:26:03 +08:00
|
|
|
/// Gather the accessor points to GlobalISel-related APIs.
|
|
|
|
/// This is used to avoid ifndefs spreading around while GISel is
|
|
|
|
/// an optional library.
|
2016-04-15 01:45:38 +08:00
|
|
|
std::unique_ptr<GISelAccessor> GISel;
|
2016-02-17 03:26:02 +08:00
|
|
|
|
2014-06-11 08:46:34 +08:00
|
|
|
private:
|
|
|
|
/// initializeSubtargetDependencies - Initializes using CPUString and the
|
|
|
|
/// passed in feature string so that we can use initializer lists for
|
|
|
|
/// subtarget initialization.
|
2016-10-04 04:17:02 +08:00
|
|
|
AArch64Subtarget &initializeSubtargetDependencies(StringRef FS,
|
|
|
|
StringRef CPUString);
|
2014-06-11 01:44:12 +08:00
|
|
|
|
2016-06-03 02:03:53 +08:00
|
|
|
/// Initialize properties based on the selected processor family.
|
|
|
|
void initializeProperties();
|
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
public:
|
|
|
|
/// This constructor initializes the data members to match that
|
|
|
|
/// of the specified triple.
|
2015-06-10 20:11:26 +08:00
|
|
|
AArch64Subtarget(const Triple &TT, const std::string &CPU,
|
2015-03-19 04:37:30 +08:00
|
|
|
const std::string &FS, const TargetMachine &TM,
|
2014-10-03 08:42:41 +08:00
|
|
|
bool LittleEndian);
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2016-04-07 01:26:03 +08:00
|
|
|
/// This object will take onwership of \p GISelAccessor.
|
2016-04-15 01:45:38 +08:00
|
|
|
void setGISelAccessor(GISelAccessor &GISel) {
|
|
|
|
this->GISel.reset(&GISel);
|
2016-04-07 01:26:03 +08:00
|
|
|
}
|
|
|
|
|
2014-08-05 05:25:23 +08:00
|
|
|
const AArch64SelectionDAGInfo *getSelectionDAGInfo() const override {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
|
|
|
const AArch64FrameLowering *getFrameLowering() const override {
|
2014-06-11 01:44:12 +08:00
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2014-08-05 05:25:23 +08:00
|
|
|
const AArch64TargetLowering *getTargetLowering() const override {
|
2014-06-11 08:46:34 +08:00
|
|
|
return &TLInfo;
|
2014-06-11 07:26:45 +08:00
|
|
|
}
|
2014-08-05 05:25:23 +08:00
|
|
|
const AArch64InstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
2015-03-19 04:37:30 +08:00
|
|
|
const AArch64RegisterInfo *getRegisterInfo() const override {
|
|
|
|
return &getInstrInfo()->getRegisterInfo();
|
|
|
|
}
|
2016-02-17 03:26:02 +08:00
|
|
|
const CallLowering *getCallLowering() const override;
|
2016-07-27 22:31:55 +08:00
|
|
|
const InstructionSelector *getInstructionSelector() const override;
|
2016-10-15 06:18:18 +08:00
|
|
|
const LegalizerInfo *getLegalizerInfo() const override;
|
2016-04-07 01:26:03 +08:00
|
|
|
const RegisterBankInfo *getRegBankInfo() const override;
|
2015-03-12 10:04:46 +08:00
|
|
|
const Triple &getTargetTriple() const { return TargetTriple; }
|
2014-03-30 15:25:18 +08:00
|
|
|
bool enableMachineScheduler() const override { return true; }
|
2015-06-13 11:42:16 +08:00
|
|
|
bool enablePostRAScheduler() const override {
|
2016-06-03 02:03:53 +08:00
|
|
|
return UsePostRAScheduler;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns ARM processor family.
|
|
|
|
/// Avoid this function! CPU specifics should be kept local to this class
|
|
|
|
/// and preferably modeled with SubtargetFeatures or properties in
|
|
|
|
/// initializeProperties().
|
|
|
|
ARMProcFamilyEnum getProcFamily() const {
|
|
|
|
return ARMProcFamily;
|
2014-09-13 01:40:39 +08:00
|
|
|
}
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2015-04-01 22:49:29 +08:00
|
|
|
bool hasV8_1aOps() const { return HasV8_1aOps; }
|
2015-11-26 23:23:32 +08:00
|
|
|
bool hasV8_2aOps() const { return HasV8_2aOps; }
|
2015-04-01 22:49:29 +08:00
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
|
|
|
|
|
|
|
|
bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
|
|
|
|
|
2015-07-29 22:17:26 +08:00
|
|
|
bool requiresStrictAlign() const { return StrictAlign; }
|
|
|
|
|
2016-11-17 13:15:37 +08:00
|
|
|
bool isXRaySupported() const override { return true; }
|
|
|
|
|
2015-07-25 08:18:31 +08:00
|
|
|
bool isX18Reserved() const { return ReserveX18; }
|
2014-04-15 01:38:00 +08:00
|
|
|
bool hasFPARMv8() const { return HasFPARMv8; }
|
|
|
|
bool hasNEON() const { return HasNEON; }
|
|
|
|
bool hasCrypto() const { return HasCrypto; }
|
2014-04-25 17:25:42 +08:00
|
|
|
bool hasCRC() const { return HasCRC; }
|
2016-12-01 06:25:24 +08:00
|
|
|
bool hasLSE() const { return HasLSE; }
|
2016-06-03 22:03:27 +08:00
|
|
|
bool hasRAS() const { return HasRAS; }
|
2017-01-17 00:28:43 +08:00
|
|
|
bool hasRDM() const { return HasRDM; }
|
2016-06-03 02:03:53 +08:00
|
|
|
bool balanceFPOps() const { return BalanceFPOps; }
|
|
|
|
bool predictableSelectIsExpensive() const {
|
|
|
|
return PredictableSelectIsExpensive;
|
|
|
|
}
|
|
|
|
bool hasCustomCheapAsMoveHandling() const { return CustomAsCheapAsMove; }
|
|
|
|
bool isMisaligned128StoreSlow() const { return Misaligned128StoreIsSlow; }
|
2017-01-25 01:34:31 +08:00
|
|
|
bool isPaired128Slow() const { return Paired128IsSlow; }
|
2016-06-03 02:03:53 +08:00
|
|
|
bool useAlternateSExtLoadCVTF32Pattern() const {
|
|
|
|
return UseAlternateSExtLoadCVTF32Pattern;
|
|
|
|
}
|
2016-10-05 03:28:21 +08:00
|
|
|
bool hasArithmeticBccFusion() const { return HasArithmeticBccFusion; }
|
|
|
|
bool hasArithmeticCbzFusion() const { return HasArithmeticCbzFusion; }
|
2017-02-01 10:54:39 +08:00
|
|
|
bool hasFuseAES() const { return HasFuseAES; }
|
2017-02-01 10:54:42 +08:00
|
|
|
bool hasFuseLiterals() const { return HasFuseLiterals; }
|
2016-10-25 00:14:58 +08:00
|
|
|
bool useRSqrt() const { return UseRSqrt; }
|
2016-06-03 02:03:53 +08:00
|
|
|
unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
|
|
|
|
unsigned getVectorInsertExtractBaseCost() const {
|
|
|
|
return VectorInsertExtractBaseCost;
|
|
|
|
}
|
|
|
|
unsigned getCacheLineSize() const { return CacheLineSize; }
|
|
|
|
unsigned getPrefetchDistance() const { return PrefetchDistance; }
|
|
|
|
unsigned getMinPrefetchStride() const { return MinPrefetchStride; }
|
|
|
|
unsigned getMaxPrefetchIterationsAhead() const {
|
|
|
|
return MaxPrefetchIterationsAhead;
|
|
|
|
}
|
2016-06-11 00:00:18 +08:00
|
|
|
unsigned getPrefFunctionAlignment() const { return PrefFunctionAlignment; }
|
|
|
|
unsigned getPrefLoopAlignment() const { return PrefLoopAlignment; }
|
2016-06-03 02:03:53 +08:00
|
|
|
|
2016-09-26 23:32:33 +08:00
|
|
|
unsigned getMaximumJumpTableSize() const { return MaxJumpTableSize; }
|
|
|
|
|
2015-11-10 08:44:23 +08:00
|
|
|
/// CPU has TBI (top byte of addresses is ignored during HW address
|
|
|
|
/// translation) and OS enables it.
|
|
|
|
bool supportsAddressTopByteIgnored() const;
|
|
|
|
|
2015-09-02 00:23:45 +08:00
|
|
|
bool hasPerfMon() const { return HasPerfMon; }
|
2015-11-26 23:23:32 +08:00
|
|
|
bool hasFullFP16() const { return HasFullFP16; }
|
2015-12-01 18:48:51 +08:00
|
|
|
bool hasSPE() const { return HasSPE; }
|
2017-04-01 02:16:53 +08:00
|
|
|
bool hasLSLFast() const { return HasLSLFast; }
|
2014-04-15 01:38:00 +08:00
|
|
|
|
2015-01-27 03:03:15 +08:00
|
|
|
bool isLittleEndian() const { return IsLittle; }
|
2014-04-23 18:26:40 +08:00
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
|
2014-08-07 00:56:58 +08:00
|
|
|
bool isTargetIOS() const { return TargetTriple.isiOS(); }
|
|
|
|
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
|
|
|
bool isTargetWindows() const { return TargetTriple.isOSWindows(); }
|
2015-10-09 05:21:24 +08:00
|
|
|
bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
|
2017-02-24 11:10:10 +08:00
|
|
|
bool isTargetFuchsia() const { return TargetTriple.isOSFuchsia(); }
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2014-08-07 00:56:58 +08:00
|
|
|
bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
|
2014-03-29 18:18:08 +08:00
|
|
|
bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
|
|
|
|
bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
|
|
|
|
|
2016-06-03 02:03:53 +08:00
|
|
|
bool useAA() const override { return UseAA; }
|
2014-09-08 22:31:49 +08:00
|
|
|
|
2014-03-29 18:18:08 +08:00
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
|
|
|
|
|
|
|
/// ClassifyGlobalReference - Find the target operand flags that describe
|
|
|
|
/// how a global value should be referenced for the current subtarget.
|
|
|
|
unsigned char ClassifyGlobalReference(const GlobalValue *GV,
|
|
|
|
const TargetMachine &TM) const;
|
|
|
|
|
|
|
|
/// This function returns the name of a function which has an interface
|
|
|
|
/// like the non-standard bzero function, if such a function exists on
|
|
|
|
/// the current subtarget and it is considered prefereable over
|
|
|
|
/// memset with zero passed as the second argument. Otherwise it
|
|
|
|
/// returns null.
|
|
|
|
const char *getBZeroEntry() const;
|
|
|
|
|
2016-07-01 08:23:27 +08:00
|
|
|
void overrideSchedPolicy(MachineSchedPolicy &Policy,
|
2014-04-29 15:58:25 +08:00
|
|
|
unsigned NumRegionInstrs) const override;
|
2014-05-22 07:40:26 +08:00
|
|
|
|
|
|
|
bool enableEarlyIfConversion() const override;
|
2014-10-10 02:20:51 +08:00
|
|
|
|
|
|
|
std::unique_ptr<PBQPRAConstraint> getCustomPBQPConstraints() const override;
|
2014-03-29 18:18:08 +08:00
|
|
|
};
|
2015-06-23 17:49:53 +08:00
|
|
|
} // End llvm namespace
|
2014-03-29 18:18:08 +08:00
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|