33#define DEBUG_TYPE "aarch64-subtarget"
35#define GET_SUBTARGETINFO_CTOR
36#define GET_SUBTARGETINFO_TARGET_DESC
37#include "AArch64GenSubtargetInfo.inc"
39#define OPTIONS_STRUCT_DEFS
40#include "AArch64Options.inc"
47 "registers, so they can't be used by register allocator. "
48 "Should only be used for testing register allocator."),
60 if (CPUString.
empty())
61 CPUString =
"generic";
63 if (TuneCPUString.
empty())
64 TuneCPUString = CPUString;
67 initializeProperties(HasMinSize);
72void AArch64Subtarget::initializeProperties(
bool HasMinSize) {
81 if (hasV8_4aOps() && !hasV8_8aOps())
291 if (CLOpts.min_jump_table_entries || !HasMinSize)
293 if (CLOpts.sve_vscale_for_tuning)
300 unsigned MinSVEVectorSizeInBitsOverride,
301 unsigned MaxSVEVectorSizeInBitsOverride,
323 CLOpts.enable_subreg_liveness_tracking),
325 InstrInfo(initializeSubtargetDependencies(FS, CPU, TuneCPU, HasMinSize)),
346 for (
unsigned i = 0; i < 29; ++i) {
347 if (ReservedRegNames.
count(
TRI->getName(AArch64::X0 + i)))
351 if (ReservedRegNames.
count(
"X30") || ReservedRegNames.
count(
"LR"))
354 if (ReservedRegNames.
count(
"X29") || ReservedRegNames.
count(
"FP"))
473 !Def->isInstr() || !
Use->isInstr() ||
474 (Def->getInstr()->getOpcode() != TargetOpcode::BUNDLE &&
475 Use->getInstr()->getOpcode() != TargetOpcode::BUNDLE))
481 if (
DefMI->getOpcode() == TargetOpcode::BUNDLE) {
484 if (
Op.isReg() &&
Op.isDef() &&
Op.getReg() == Reg) {
486 DefOpIdx =
Op.getOperandNo();
493 if (
UseMI->getOpcode() == TargetOpcode::BUNDLE) {
496 if (
Op.isReg() &&
Op.isUse() &&
Op.getReg() == Reg) {
498 UseOpIdx =
Op.getOperandNo();
509 return CLOpts.early_ifcvt;
525std::unique_ptr<PBQPRAConstraint>
527 return balanceFPOps() ? std::make_unique<A57ChainingConstraint>() :
nullptr;
545 return valueOr(CLOpts.sve_use_scalar_inc_vl, hasSVE2() || hasSME());
570 return CLOpts.authenticated_lr_check_method.value_or(
574std::optional<uint16_t>
592 return getSchedModel().hasInstrSchedModel();
597 unsigned Opc =
MI.getOpcode();
598 if (
Opc != AArch64::MOVKWi &&
Opc != AArch64::MOVKXi)
600 return MI.getOperand(3).getImm();
605 unsigned FirstOpc,
unsigned FirstShift,
606 unsigned SecondOpc,
unsigned SecondShift) {
607 assert(ST.hasFuseLiterals() &&
"the subtarget doesn't fuse move immediate");
610 if ((!HasFirst || FirstOpc == AArch64::MOVZWi) &&
611 SecondOpc == AArch64::MOVKWi && SecondShift == 16)
615 if ((!HasFirst || FirstOpc == AArch64::MOVZXi) &&
616 SecondOpc == AArch64::MOVKXi && SecondShift == 16)
620 if ((!HasFirst || (FirstOpc == AArch64::MOVKXi && FirstShift == 32)) &&
621 SecondOpc == AArch64::MOVKXi && SecondShift == 48)
629 unsigned SecondShift)
const {
631 SecondOpc, SecondShift);
This file describes how to lower LLVM calls to machine code calls.
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
This file declares the targeting of the Machinelegalizer class for AArch64.
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares the targeting of the RegisterBankInfo class for AArch64.
static bool fusesMOVImmPairImpl(const AArch64Subtarget &ST, bool HasFirst, unsigned FirstOpc, unsigned FirstShift, unsigned SecondOpc, unsigned SecondShift)
HasFirst is false when the 1st instruction is a wildcard.
static unsigned getMOVKShiftImm(const MachineInstr &MI)
Returns a MOVK's shifter operand, or 0 otherwise.
static cl::list< std::string > ReservedRegsForRA("reserve-regs-for-regalloc", cl::desc("Reserve physical " "registers, so they can't be used by register allocator. " "Should only be used for testing register allocator."), cl::CommaSeparated, cl::Hidden)
static cl::opt< unsigned > EpilogueVectorizationMinVF("epilogue-vectorization-minimum-VF", cl::Hidden, cl::desc("Only loops with vectorization factor equal to or larger than " "the specified value are considered for epilogue vectorization."))
Register const TargetRegisterInfo * TRI
This class provides the information for the target register banks.
BitVector ReserveXRegisterForRA
BitVector ReserveXRegister
const CallLowering * getCallLowering() const override
const AArch64RegisterInfo * getRegisterInfo() const override
TailFoldingOpts DefaultSVETFOpts
BitVector CustomCallSavedXRegs
bool IsStreamingCompatible
std::unique_ptr< InstructionSelector > InstSelector
ARMProcFamilyEnum ARMProcFamily
ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
std::unique_ptr< RegisterBankInfo > RegBankInfo
bool useSmallAddressing() const
bool isTargetDarwin() const
bool enableEarlyIfConversion() const override
const InlineAsmLowering * getInlineAsmLowering() const override
const AArch64Options & getCLOpts() const
unsigned MaxPrefetchIterationsAhead
unsigned getVectorInsertExtractBaseCost() const
bool enableMachinePipeliner() const override
std::unique_ptr< CallLowering > CallLoweringInfo
GlobalISel related APIs.
std::optional< uint16_t > getPtrAuthBlockAddressDiscriminatorIfEnabled(const Function &ParentFn) const
Compute the integer discriminator for a given BlockAddress constant, if blockaddress signing is enabl...
unsigned classifyGlobalFunctionReference(const GlobalValue *GV, const TargetMachine &TM) const
bool useAA() const override
bool fusesMOVImmPair(unsigned FirstOpc, unsigned FirstShift, unsigned SecondOpc, unsigned SecondShift) const
Return true if the subtarget fuses this pair of move immediate instructions.
uint8_t VectorInsertExtractBaseCost
const AArch64TargetLowering * getTargetLowering() const override
bool isTargetMachO() const
uint16_t PrefetchDistance
bool supportsAddressTopByteIgnored() const
CPU has TBI (top byte of addresses is ignored during HW address translation) and OS enables it.
void overrideSchedPolicy(MachineSchedPolicy &Policy, const SchedRegion &Region) const override
Align PrefFunctionAlignment
const Triple & getTargetTriple() const
unsigned MinVectorRegisterBitWidth
void adjustSchedDependency(SUnit *Def, int DefOpIdx, SUnit *Use, int UseOpIdx, SDep &Dep, const TargetSchedModel *SchedModel) const override
void mirFileLoaded(MachineFunction &MF) const override
Triple TargetTriple
TargetTriple - What processor and OS we're targeting.
InstructionSelector * getInstructionSelector() const override
uint16_t MinPrefetchStride
unsigned ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const
ClassifyGlobalReference - Find the target operand flags that describe how a global value should be re...
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
unsigned MaxJumpTableSize
bool isWindowsArm64EC() const
unsigned MinSVEVectorSizeInBits
bool isX16X17Safer() const
Returns whether the operating system makes it safer to store sensitive values in x16 and x17 as oppos...
bool useScalarIncVL() const
Returns true to use the addvl/inc/dec instructions, as opposed to separate add + cnt instructions.
unsigned MinimumJumpTableEntries
const LegalizerInfo * getLegalizerInfo() const override
bool EnableSRLTSubregToRegMitigation
unsigned MaxSVEVectorSizeInBits
AArch64Subtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, const TargetMachine &TM, bool LittleEndian, unsigned MinSVEVectorSizeInBitsOverride=0, unsigned MaxSVEVectorSizeInBitsOverride=0, bool IsStreaming=false, bool IsStreamingCompatible=false, bool HasMinSize=false, bool EnableSRLTSubregToRegMitigation=false)
This constructor initializes the data members to match that of the specified triple.
bool EnableSubregLiveness
std::unique_ptr< PBQPRAConstraint > getCustomPBQPConstraints() const override
AArch64PAuth::AuthCheckMethod getAuthenticatedLRCheckMethod(const MachineFunction &MF) const
Choose a method of checking LR before performing a tail call.
AArch64InstrInfo InstrInfo
AArch64TargetLowering TLInfo
const RegisterBankInfo * getRegBankInfo() const override
std::unique_ptr< LegalizerInfo > Legalizer
unsigned MaxBytesForLoopAlignment
std::unique_ptr< InlineAsmLowering > InlineAsmLoweringInfo
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool hasExternalLinkage() const
bool hasExternalWeakLinkage() const
bool hasDLLImportStorageClass() const
bool hasInternalLinkage() const
Type * getValueType() const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
LLVM_ABI void computeMaxCallFrameSize(MachineFunction &MF, std::vector< MachineBasicBlock::iterator > *FrameSDOps=nullptr)
Computes the maximum size of a callframe.
bool isMaxCallFrameSizeComputed() const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Holds all the information related to register banks.
Wrapper class representing virtual and physical registers.
Kind getKind() const
Returns an enum value representing the kind of the dependence.
@ Data
Regular data dependence (aka true-dependence).
void setLatency(unsigned Lat)
Sets the latency for this edge.
Register getReg() const
Returns the register associated with this edge.
Scheduling unit. This is a node in the scheduling DAG.
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
StringSet - A wrapper for StringMap that provides set-like functionality.
Primary interface to the complete machine description for the target machine.
bool shouldAssumeDSOLocal(const GlobalValue *GV) const
CodeModel::Model getCodeModel() const
Returns the code model.
Provide an instruction scheduling machine model to CodeGen passes.
LLVM_ABI unsigned computeOperandLatency(const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
Compute operand latency based on the available machine model.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isFunctionTy() const
True if this is an instance of FunctionType.
A Use represents the edge between a Value definition and its users.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Represents a version number in the form major[.minor[.subminor[.build]]].
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand, this represents that the reference to the symbol is for an import...
@ MO_NC
MO_NC - Indicates whether the linker is expected to check the symbol reference for overflow.
@ MO_GOT
MO_GOT - This flag indicates that a symbol operand represents the address of the GOT entry for the sy...
@ MO_ARM64EC_CALLMANGLE
MO_ARM64EC_CALLMANGLE - Operand refers to the Arm64EC-mangled version of a symbol,...
@ MO_TAGGED
MO_TAGGED - With MO_PAGE, indicates that the page includes a memory tag in bits 56-63.
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
AuthCheckMethod
Variants of check performed on an authenticated pointer.
@ HighBitsNoTBI
Check by comparing bits 62 and 61 of the authenticated address.
@ None
Do not check the value at all.
LLVM_ABI bool isX18ReservedByDefault(const Triple &TT)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
constexpr from_range_t from_range
InstructionSelector * createAArch64InstructionSelector(const AArch64TargetMachine &, const AArch64Subtarget &, const AArch64RegisterBankInfo &)
iterator_range< ConstMIBundleOperands > const_mi_bundle_ops(const MachineInstr &MI)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI uint16_t getPointerAuthStableSipHash(StringRef S)
Compute a stable non-zero 16-bit hash of the given string.
DWARFExpression::Operation Op
constexpr bool valueOr(BoolOrDefault X, bool Default)
This struct is a compact representation of a valid (non-zero power of two) alignment.
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
bool DisableLatencyHeuristic
A region of an MBB for scheduling.