TargetInstrInfo ‐ Interface to description of machine instruction set

Synopsis

Declared in <llvm/CodeGen/TargetInstrInfo.h>

class TargetInstrInfo
    : public MCInstrInfo

Base Classes

Name

Description

MCInstrInfo

Interface to description of machine instruction set.

Types

Name

Description

MachineBranchPredicate

Represents a predicate at the MachineFunction level. The control flow a MachineBranchPredicate represents is:

PipelinerLoopInfo

Target‐specific loop attributes for software pipelining.

RegSubRegPair

Pair of a register and a sub‐register index.

RegSubRegPairAndIdx

Reg:SubReg pair plus an additional sub‐register index.

Type Aliases

Name

Description

ComplexDeprecationPredicate

Function pointer type for complex instruction deprecation checks.

Enums

Name

Description

InstSizeVerifyMode

How getInstSizeInBytes results should be verified.

Member Functions

Name

Description

TargetInstrInfo [constructor] [deleted]

TargetInstrInfo is not copyable.

~TargetInstrInfo [destructor] [virtual]

Destroy the target instruction info object.

operator= [deleted]

TargetInstrInfo is not copyable.

ClobbersPredicate [virtual]

Return true if MI defines predicate/condition‐code registers.

CreateTargetHazardRecognizer [virtual]

Allocate and return a hazard recognizer to use for this target when scheduling the machine instructions before register allocation.

CreateTargetMIHazardRecognizer [virtual]

Allocate and return a hazard recognizer to use for this target when scheduling the machine instructions before register allocation.

CreateTargetPostRAHazardRecognizer

CreateTargetPostRAHazardRecognizer overloads

CreateTargetScheduleState [virtual]

Create machine specific model for scheduling.

InitMCInstrInfo

Initialize MCInstrInfo, called by TableGen auto‐generated routines. DO NOT USE.

PredicateInstruction [virtual]

Convert the instruction into a predicated instruction. It returns true if the operation was successful.

ReplaceTailWithBranchTo [virtual]

Delete the instruction OldInst and everything after it, replacing it with an unconditional branch to NewDest. This is used by the tail merging pass.

SubsumesPredicate [virtual]

Returns true if the first specified predicate subsumes the second, e.g. GE subsumes GT.

accumulateInstrSeqToRootLatency [virtual]

When calculate the latency of the root instruction, accumulate the latency of the sequence to the root latency.

analyzeBranch [virtual]

Analyze branching at the end of MBB into TBB, FBB, and Cond.

analyzeBranchPredicate [virtual]

Analyze the branching code at the end of MBB and parse it into the MachineBranchPredicate structure if possible. Returns false on success and true on failure.

analyzeCompare [virtual]

Analyze comparison MI into source registers, mask, and value.

analyzeLoop [virtual]

Analyze loop L for induction variable and compare instruction.

analyzeLoopForPipelining [virtual]

Analyze loop L, which must be a single‐basic‐block loop, and if the conditions can be understood enough produce a PipelinerLoopInfo object.

areLoadsFromSameBasePtr [virtual]

Return true if Load1 and Load2 share a base pointer with different offsets.

areMemAccessesTriviallyDisjoint [virtual]

Return true if MIa and MIb access disjoint memory without alias info.

areOpcodesEqualOrInverse

Return true when P Opcode1 or its inversion is equal to P Opcode2.

breakPartialRegDependency [virtual]

Insert a dependency‐breaking instruction before MI to eliminate an unwanted dependency on OpNum.

buildClearRegister [virtual]

Insert a target‐specific instruction that clears Reg.

buildOutlinedFrame [virtual]

Insert a custom frame for outlined functions.

canCopyGluedNodeDuringSchedule [virtual]

Return true if the given SDNode can be copied during scheduling even if it has glue.

canFoldIntoAddrMode [virtual]

Return true if AddrI can be folded into MemI's addressing mode.

canInsertSelect [virtual]

Return true if it is possible to insert a select instruction that chooses between TrueReg and FalseReg based on the condition code in Cond.

canMakeTailCallConditional [virtual]

Returns true if the tail call can be made conditional on BranchCond.

canPredicatePredicatedInstr [virtual]

Assumes the instruction is already predicated and returns true if the instruction can be predicated again.

commuteInstruction

This method commutes the operands of the given machine instruction MI.

convertToThreeAddress [virtual]

Convert a two‐address MI into true three‐address instructions if possible.

copyPhysReg [virtual]

Emit instructions to copy a pair of physical registers.

createMIROperandComment [virtual]

Return a MIR printer comment string for operand Op of MI.

createPHIDestinationCopy [virtual]

During PHI eleimination lets target to make necessary checks and insert the copy to the PHI destination register in a target specific manner.

createPHISourceCopy [virtual]

During PHI eleimination lets target to make necessary checks and insert the copy to the PHI destination register in a target specific manner.

decomposeMachineOperandsTargetFlags [virtual]

Decompose the machine operand's target flags into two values ‐ the direct target flag value and any of bit flags that are applied.

defaultDefLatency

Return the default expected latency for a def based on its opcode.

describeLoadedValue [virtual]

Describe the value MI loads into physical register Reg.

duplicate [virtual]

Clones instruction or the whole instruction bundle Orig and insert into MBB before InsertBefore. The target may update operands that are required to be unique.

emitLdStWithAddr [virtual]

Emit a load/store like MemI using addressing mode AM.

expandPostRAPseudo [virtual]

Expand post‐RA pseudo instruction MI into real instructions.

extraSizeToPredicateInstructions [virtual]

Return the increase in code size needed to predicate a contiguous run of NumInsts instructions.

finalizeInsInstrs [virtual]

Fix up the placeholder we may add in genAlternativeCodeSequence().

findCommutedOpIndices [virtual]

Find two commutable operand indices in MI.

foldImmediate [virtual]

Try to fold an immediate defined by DefMI into use UseMI.

foldMemoryOperand

Fold a load/store into MI for the given operands.

genAlternativeCodeSequence [virtual]

Generate alternative instructions for a machine‐combiner pattern.

get

Return the machine instruction descriptor that corresponds to the specified instruction opcode.

getAccumulationStartOpcode [virtual]

Returns an opcode which defines the accumulator used by P Opcode.

getAccumulatorChain

Find the chain of accumulator instructions in P MBB and return them in P Chain.

getAccumulatorReassociationPatterns

Find chains of accumulations that can be rewritten as a tree for increased ILP.

getAddrModeFromMemoryOp [virtual]

Extract an ExtAddrMode description from memory instruction MemI.

getBaseAndOffsetPosition [virtual]

Return true if MI has base/offset operands, setting their positions.

getBranchDestBlock [virtual]

Return the basic block that branch instruction MI jumps to.

getCallFrameDestroyOpcode

Return the opcode of the call‐frame destroy instruction, or ‐1.

getCallFrameSetupOpcode

Return the opcode of the call‐frame setup instruction, or ‐1.

getCallFrameSizeAt

Return the call frame size immediately before MI.

getCalleeOperand [virtual]

Returns the callee operand from the given MI.

getCatchReturnOpcode

Return the catch‐return opcode used by this target.

getCombinerObjective [virtual]

Return the objective of a combiner pattern.

getConstValDefinedInReg [virtual]

Return true if MI defines Reg to a constant recorded in ImmVal.

getDeprecatedInfo

Returns true if a certain instruction is deprecated and if so returns the reason in Info.

getExecutionDomain [virtual]

Return the current execution domain and bit mask of possible domains for instruction.

getExtendResourceLenLimit [virtual]

The limit on resource length extension we accept in MachineCombiner Pass.

getExtractSubregInputs

Build EXTRACT_SUBREG‐equivalent inputs for MI at DefIdx.

getFrameIndexOperands [virtual]

Fill Ops with machine operands that refer to frame index FI.

getFrameSize

Return the frame size associated with the given frame instruction.

getFrameTotalSize

Return the total frame size including space set up before the frame pair.

getIncrementValue [virtual]

If the instruction is an increment of a constant value, return the amount.

getInlineAsmLength [virtual]

Measure the specified inline asm to determine an approximation of its length.

getInsertSubregInputs

Build INSERT_SUBREG‐equivalent inputs for MI at DefIdx.

getInstBundleSize

Sum getInstSizeInBytes over instructions inside a BUNDLE.

getInstSizeInBytes [virtual]

For BUNDLE instructions, target implementations are responsible for accounting for the size of all bundled instructions.

getInstSizeVerifyMode [virtual]

Determine whether/how the instruction size returned by getInstSizeInBytes() should be verified.

getInstrLatency

getInstrLatency overloads

getInverseOpcode [virtual]

Return the inverse operation opcode if it exists for P Opcode (e.g. add for sub and vice versa).

getJumpTableIndex [virtual]

Return an index for MachineJumpTableInfo if insn is an indirect jump using a jump table, otherwise ‐1.

getLiveRangeSplitOpcode [virtual]

Allows targets to use appropriate copy instruction while spilitting live range of a register in register allocation.

getMIRFormatter [virtual]

Return MIR formatter to format/parse MIR operands. Target can override this virtual function and return target specific MIR formatter.

getMachineCSELookAheadLimit [virtual]

Return the value to use for the MachineCSE's LookAheadLimit, which is a heuristic used for CSE'ing phys reg defs.

getMachineCombinerPatterns [virtual]

Collect machine‐combiner patterns ending at Root.

getMachineCombinerTraceStrategy [virtual]

Return a strategy that MachineCombiner must use when creating traces.

getMemOperandAACheckLimit [virtual]

Return the max product of memory operands checked for aliasing.

getMemOperandWithOffset

Get a single base operand and byte offset for memory instruction MI.

getMemOperandsWithOffsetWidth [virtual]

Get base operands, offset, and access width for memory instruction MI.

getName

Returns the name for the instructions with the given opcode.

getNop [virtual]

Return the noop instruction to use for a noop.

getNumMicroOps [virtual]

Return how many micro‐ops MI decodes to on the target CPU.

getNumOpcodes

Return the number of instruction opcodes described by this info.

getOpRegClassID

getOpRegClassID overloads

getOpcodeAfterMemoryUnfold [virtual]

Return the opcode after unfolding load/store from Opc, or zero.

getOperandLatency

Compute use‐operand latency between a def and a use.

getOutlinableRanges [virtual]

Optional target hook which partitions MBB into outlinable ranges for instruction mapping purposes. Each range is defined by two iterators: [start, end).]

getOutliningCandidateInfo [virtual]

Return outlining info for RepeatedSequenceLocs, or nullopt if unsuitable.

getOutliningType

Returns how or if MIT should be outlined. Flags is the target‐specific information returned by isMBBSafeToOutlineFrom.

getPartialRegUpdateClearance [virtual]

Returns the preferred minimum clearance before an instruction with an unwanted partial register update.

getPatchpointUnfoldableRange [virtual]

Return the operand range that cannot be folded for patchpoint‐like MI.

getPredicationCost [virtual]

Return the extra cost of predicating MI.

getReassociateOperandIndices [virtual]

Fill OperandIndices with reassociation operand positions for Pattern.

getReassociationOpcodes

Return new root/prev opcodes required to reassociate Pattern.

getReduceOpcodeForAccumulator [virtual]

Returns the opcode that should be use to reduce accumulation registers.

getRegClass [virtual]

Given a machine instruction descriptor, returns the register class constraint for OpNum, or NULL.

getRegClassByHwModeTable

Return the register‐class lookup row for the given hardware mode.

getRegSequenceInputs

Build REG_SEQUENCE‐equivalent inputs for MI at DefIdx.

getRegisterInfo

Return the target register info associated with this instruction info.

getReturnOpcode

Return the return opcode used by this target.

getSPAdjust [virtual]

Return the stack‐pointer adjustment made by MI as part of a call sequence.

getSerializableBitmaskMachineOperandTargetFlags [virtual]

Return an array that contains the bitmask target flag values and their names.

getSerializableDirectMachineOperandTargetFlags [virtual]

Return an array that contains the direct target flag values and their names.

getSerializableMachineMemOperandTargetFlags [virtual]

Return an array that contains the MMO target flag values and their names.

getSerializableTargetIndices [virtual]

Return an array that contains the ids of the target indices (used for the TargetIndex machine operand) and their names.

getStackSlotRange [virtual]

Compute the size in bytes and offset within a stack slot of a spilled register or subregister.

getTailDuplicateSize [virtual]

Returns the target‐specific default value for tail duplication. This value will be used if the tail‐dup‐placement‐threshold argument is not provided.

getTailMergeSize [virtual]

Returns the target‐specific default value for tail merging. This value will be used if the tail‐merge‐size argument is not provided.

getUndefRegClearance [virtual]

Return the minimum clearance before an instruction that reads an unused register.

getValueUniformity [virtual]

Return the uniformity behavior of the given value.

hasCommutePreference [virtual]

Return true if the target prefers a specific operand order for MI.

hasHighOperandLatency [virtual]

Return true if the def‐use operand latency is considered high.

hasLoadFromStackSlot [virtual]

Return true if MI loads from a stack slot, collecting mem operands.

hasLowDefLatency [virtual]

Compute operand latency of a def of 'Reg'. Return true if the target considered it 'low'.

hasReassociableOperands [virtual]

Return true when P Inst has reassociable operands in the same P MBB.

hasReassociableSibling [virtual]

Return true when P Inst has reassociable sibling.

hasStoreToStackSlot [virtual]

Return true if MI stores to a stack slot, collecting mem operands.

insertBranch [virtual]

Insert branch code at the end of MBB for TBB/FBB/Cond.

insertCodePrefetchInstr [virtual]

Insert a code prefetch instruction targeting GV before InsertBefore in MBB.

insertIndirectBranch [virtual]

Insert an unconditional indirect branch from MBB to NewDestBB.

insertNoop [virtual]

Insert a noop into the instruction stream at the specified point.

insertNoops [virtual]

Insert noops into the instruction stream at the specified point.

insertOutlinedCall [virtual]

Insert a call to an outlined function into the program. Returns an iterator to the spot where we inserted the call. This must be implemented by the target.

insertSelect [virtual]

Insert a select instruction into MBB before I that will copy TrueReg to DstReg when Cond is true, and FalseReg to DstReg when Cond is false.

insertUnconditionalBranch

Insert an unconditional branch from MBB to DestBB.

isAccumulationOpcode [virtual]

Return true when P OpCode is an instruction which performs accumulation into one of its operand registers.

isAddImmediate [virtual]

Return source register and immediate if MI defines Reg as Reg+Imm.

isAsCheapAsAMove [virtual]

Return true if the instruction is as cheap as a move instruction.

isAssociativeAndCommutative [virtual]

Return true when P Inst is both associative and commutative. If P Invert is true, then the inverse of P Inst operation must be tested.

isBasicBlockPrologue [virtual]

Return true if MI must remain at the top of its basic block.

isBranchOffsetInRange [virtual]

Return true if BranchOpc can reach a displacement of BrOffset bytes.

isCoalescableExtInstr [virtual]

Return true if MI is a coalescable extension instruction.

isCopyInstr

Return destination and source operands if MI is a copy.

isCopyLikeInstr

Return destination and source operands if MI is copy‐like.

isExplicitTargetIndexDef [virtual]

Return true if MI defines a trackable TargetIndex operand.

isExtendLikelyToBeFolded [virtual]

Given the generic extension instruction ExtMI, returns true if this extension is a likely candidate for being folded into an another instruction.

isFrameInstr

Returns true if the argument is a frame pseudo instruction.

isFrameSetup

Returns true if the argument is a frame setup pseudo instruction.

isFullCopyInstr

Return true if MI is a full‐register copy with no subregs.

isFunctionSafeToOutlineFrom [virtual]

Return true if MF can safely be outlined from.

isFunctionSafeToSplit [virtual]

Return true if the function is a viable candidate for machine function splitting. The criteria for if a function can be split may vary by target.

isGlobalMemoryObject [virtual]

Returns true if MI is an instruction we are unable to reason about (like a call or something with unmodeled side effects).

isHighLatencyDef [virtual]

Return true if this opcode has high latency to its result.

isIgnorableUse [virtual]

Given MO is a PhysReg use return if it can be ignored for the purpose of instruction rematerialization or sinking.

isLegalToSplitMBBAt [virtual]

Return true if it's legal to split the given basic block at the specified instruction (i.e. instruction would be the start of a new basic block).

isLoadFromStackSlot

Return the destination register if MI loads directly from a stack slot.

isLoadFromStackSlotPostFE [virtual]

Check for post‐frame ptr elimination stack locations as well. This uses a heuristic so it isn't reliable for correctness.

isMBBSafeToOutlineFrom [virtual]

Optional target hook that returns true if MBB is safe to outline from, and returns any target‐specific information in Flags.

isMBBSafeToSplitToCold [virtual]

Return true if MBB can safely be split to the cold section.

isPCRelRegisterOperandLegal [virtual]

Return true if MO may participate in PC‐relative addressing.

isPostIncrement [virtual]

Return true for post‐incremented instructions.

isPredicable [virtual]

Return true if the specified instruction can be predicated. By default, this returns true for every instruction with a PredicateOperand.

isPredicated [virtual]

Returns true if the instruction is already predicated.

isProfitableToDupForIfCvt [virtual]

Return true if duplicating MBB instructions for if‐conversion is profitable.

isProfitableToIfCvt

Return true if predicating the block(s) for if‐conversion is profitable.

isProfitableToUnpredicate [virtual]

Return true if unpredicating one side of a diamond is profitable.

isReMaterializable

Return true if MI would be rematerializable where its uses are live.

isReassociationCandidate

Return true if Inst is part of a reassociable dependent chain.

isSafeToMove [virtual]

Return true if it is safe to move MI.

isSafeToMoveRegClassDefs [virtual]

Return true if it's safe to move a machine instruction that defines the specified register class.

isSafeToSink [virtual]

Return true if MI is safe to sink into SuccToSinkTo.

isSchedulingBoundary [virtual]

Test if the given instruction should be considered a scheduling boundary. This primarily includes labels and terminators.

isStackSlotCopy [virtual]

Return true if the specified machine instruction is a copy of one stack slot to another and has no other effect. Provide the identity of the two frame indices.

isStoreToStackSlot

Return the source register if MI stores directly to a stack slot.

isStoreToStackSlotPostFE [virtual]

Check for post‐frame ptr elimination stack locations as well. This uses a heuristic, so it isn't reliable for correctness.

isSubregFoldable [virtual]

Return true if the target can fold loads/stores through subreg operands.

isTailCall [virtual]

Return true if Inst is a tail call instruction.

isThroughputPattern [virtual]

Return true when a code sequence can improve throughput. It should be called only for instructions in loops.

isTriviallyReMaterializable

Return true if MI is trivially rematerializable.

isUnconditionalTailCall [virtual]

Returns true if MI is an unconditional tail call.

isUnpredicatedTerminator

Returns true if the instruction is a terminator instruction that has not been predicated.

isUnspillableTerminator

Return true if the given instruction is terminator that is unspillable, according to isUnspillableTerminatorImpl.

isZeroCost

Return true if Opcode is a pseudo that consumes no machine resources.

loadRegFromStackSlot [virtual]

Load DestReg of class RC from stack frame FrameIndex before MI.

lowerCopy

This function defines the logic to lower COPY instruction to target specific instruction(s).

mergeOutliningCandidateAttributes [virtual]

Optional target hook to create the LLVM IR attributes for the outlined function. If overridden, the overriding function must call the default implementation.

optimizeCompareInstr [virtual]

Try to optimize comparison CmpInstr into a more efficient form.

optimizeCondBranch [virtual]

Try to optimize conditional branch MI.

optimizeLoadInstr [virtual]

Try to fold a load into a register operand of use MI.

optimizeSelect [virtual]

Given an instruction marked as isSelect = true, attempt to optimize MI by merging it with one of its operands. Returns nullptr on failure.

predictBranchSizeForIfCvt [virtual]

Return an estimate for the code size reduction (in bytes) which will be caused by removing the given branch instruction during if‐conversion.

preservesZeroValueInReg [virtual]

Return true if MI preserves a zero value in NullValueReg.

produceSameValue [virtual]

Return true if MI0 and MI1 would produce identical values.

reMaterialize [virtual]

Re‐issue Orig at MI targeting DestReg:SubIdx.

reassociateOps

Attempt to reassociate P Root and P Prev according to P Pattern to reduce critical path length.

reduceAccumulatorTree

Reduces branches of the accumulator tree into a single register.

reduceLoopCount [virtual]

Generate code that reduces the loop count and tests completion.

removeBranch [virtual]

Remove branching instructions at the end of MBB.

replaceBranchWithTailCall [virtual]

Replace the conditional branch in MBB with a conditional tail call.

reverseBranchCondition [virtual]

Reverses the branch condition of the specified condition list, returning false on success and true if it cannot be reversed.

setExecutionDomain [virtual]

Change the opcode of MI to execute in Domain.

setSpecialOperandAttr [virtual]

This is an architecture‐specific helper function of reassociateOps. Set special operand attributes for new instructions after reassociation.

shouldBreakCriticalEdgeToSink [virtual]

For a "cheap" instruction which doesn't enable additional sinking, should MachineSink break a critical edge to sink it anyways?

shouldClusterMemOps [virtual]

Return true if the two memory operations should be scheduled adjacent.

shouldHoist [virtual]

Return false if the instruction should not be hoisted by MachineLICM.

shouldOutlineFromFunctionByDefault [virtual]

Return true if the function should be outlined from by default.

shouldPostRASink [virtual]

Return true if MI should be sunk by PostRAMachineSink.

shouldReduceRegisterPressure [virtual]

Return true if target supports reassociation of instructions in machine combiner pass to reduce register pressure for a given BB.

shouldScheduleLoadsNear [virtual]

Return true if nearby loads should be scheduled together.

shouldSink [virtual]

Return true if the instruction should be sunk by MachineSink.

simplifyInstruction [virtual]

If possible, converts the instruction to a simplified/canonical form. Returns true if the instruction was modified.

storeRegToStackSlot [virtual]

Store SrcReg of class RC to stack frame FrameIndex before MI.

unfoldMemoryOperand

Unfold a folded load/store into separate instructions or nodes.

useMachineCombiner [virtual]

Return true when a target supports MachineCombiner.

usePreRAHazardRecognizer

Provide a global flag for disabling the PreRA hazard recognizer that targets may choose to honor.

verifyInstruction [virtual]

Perform target‐specific instruction verification.

Static Member Functions

Name

Description

isGenericAtomicRMWOpcode

Return true if Opc is a generic atomic RMW TargetOpcode.

isGenericOpcode

Return true if Opc is a generic TargetOpcode value.

Static Data Members

Name

Description

CommuteAnyOperandIndex

Sentinel meaning findCommutedOpIndices may pick any operand index.

Protected Member Functions

Name

Description

TargetInstrInfo [constructor]

Construct target instruction info for the given register info and opcodes.

commuteInstructionImpl [virtual]

This method commutes the operands of the given machine instruction MI. The operands to be commuted are specified by their indices OpIdx1 and OpIdx2.

foldMemoryOperandImpl

Target‐specific implementation of foldMemoryOperand.

getExtractSubregLikeInputs [virtual]

Target‐dependent implementation of getExtractSubregInputs.

getInsertSubregLikeInputs [virtual]

Target‐dependent implementation of getInsertSubregInputs.

getOutliningTypeImpl [virtual]

Target‐dependent implementation for getOutliningTypeImpl.

getRegSequenceLikeInputs [virtual]

Target‐dependent implementation of getRegSequenceInputs.

isCopyInstrImpl [virtual]

Target‐specific implementation of isCopyInstr.

isCopyLikeInstrImpl [virtual]

Target‐specific implementation of isCopyLikeInstr.

isReMaterializableImpl [virtual]

Return true if a rematerializable‐flagged MI is actually rematerializable.

isUnspillableTerminatorImpl [virtual]

Return true if terminator MI should not spill.

Protected Static Member Functions

Name

Description

fixCommutedOpIndices

Assign a pair of commutable operand indices into ResultIdx1/ResultIdx2.

Protected Data Members

Name

Description

NumRegClassByHwModes

Number of register‐class entries per hardware mode in the lookup tables.

RegClassByHwMode

Subtarget‐specific RegClassByHwMode table for the active HwMode.

RegClassByHwModeTables

Flattened [NumHwModes][NumRegClassByHwModes]register‐class lookup tables.

TRI

Target register info for the subtarget that owns this instruction info.

Non-Member Functions

Name

Description

createCopyConstrainDAGMutation

Create a DAG mutation that constrains copies near their uses/defs.

createLoadClusterDAGMutation

Create a DAG mutation that clusters loads for better memory locality.

createStoreClusterDAGMutation

Create a DAG mutation that clusters stores for better memory locality.

Created with MrDocs