LLVM: llvm::LegacyLegalizerInfo Class Reference (original) (raw)

#include "[llvm/CodeGen/GlobalISel/LegacyLegalizerInfo.h](LegacyLegalizerInfo%5F8h%5Fsource.html)"

Public Types
using SizeAndAction
using SizeAndActionsVec = std::vector<SizeAndAction>
using SizeChangeStrategy
Public Member Functions
LLVM_ABI LegacyLegalizerInfo ()
LLVM_ABI void computeTables ()
Compute any ancillary tables needed to quickly decide how an operation should be handled.
void setAction (const InstrAspect &Aspect, LegacyLegalizeActions::LegacyLegalizeAction Action)
More friendly way to set an action for common types that have an LLT representation.
void setLegalizeScalarToDifferentSizeStrategy (const unsigned Opcode, const unsigned TypeIdx, SizeChangeStrategy S)
The setAction calls record the non-size-changing legalization actions to take on specificly-sized types.
void setLegalizeVectorElementToDifferentSizeStrategy (const unsigned Opcode, const unsigned TypeIdx, SizeChangeStrategy S)
See also setLegalizeScalarToDifferentSizeStrategy.
LLVM_ABI LegacyLegalizeActionStep getAction (const LegalityQuery &Query) const
LLVM_ABI unsigned getOpcodeIdxForOpcode (unsigned Opcode) const
Static Public Member Functions
static bool needsLegalizingToDifferentSize (const LegacyLegalizeActions::LegacyLegalizeAction Action)
static SizeAndActionsVec unsupportedForDifferentSizes (const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular operation consists of only supporting a specific set of type sizes.
static SizeAndActionsVec widenToLargerTypesAndNarrowToLargest (const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular operation consists of widening the type to a large legal type, unless there is no such type and then instead it should be narrowed to the largest legal type.
static SizeAndActionsVec widenToLargerTypesUnsupportedOtherwise (const SizeAndActionsVec &v)
static SizeAndActionsVec narrowToSmallerAndUnsupportedIfTooSmall (const SizeAndActionsVec &v)
static SizeAndActionsVec moreToWiderTypesAndLessToWidest (const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular vector operation consists of having more elements in the vector, to a type that is legal.
static LLVM_ABI SizeAndActionsVec increaseToLargerTypesAndDecreaseToLargest (const SizeAndActionsVec &v, LegacyLegalizeActions::LegacyLegalizeAction IncreaseAction, LegacyLegalizeActions::LegacyLegalizeAction DecreaseAction)
Helper function to implement many typical SizeChangeStrategy functions.
static LLVM_ABI SizeAndActionsVec decreaseToSmallerTypesAndIncreaseToSmallest (const SizeAndActionsVec &v, LegacyLegalizeActions::LegacyLegalizeAction DecreaseAction, LegacyLegalizeActions::LegacyLegalizeAction IncreaseAction)
Helper function to implement many typical SizeChangeStrategy functions.

Definition at line 121 of file LegacyLegalizerInfo.h.

SizeAndAction

Initial value:

std::pair<uint16_t, LegacyLegalizeActions::LegacyLegalizeAction>

Definition at line 123 of file LegacyLegalizerInfo.h.

SizeAndActionsVec

SizeChangeStrategy

Initial value:

std::function<SizeAndActionsVec(const SizeAndActionsVec &v)>

std::vector< SizeAndAction > SizeAndActionsVec

Definition at line 126 of file LegacyLegalizerInfo.h.

LegacyLegalizerInfo::LegacyLegalizerInfo ( )

computeTables()

void LegacyLegalizerInfo::computeTables ( )

Compute any ancillary tables needed to quickly decide how an operation should be handled.

This must be called after all "set*Action"methods but before any query is made or incorrect results may be returned.

Definition at line 105 of file LegacyLegalizerInfo.cpp.

References assert(), llvm::IRSimilarity::Legal, moreToWiderTypesAndLessToWidest(), llvm::size(), llvm::sort(), and unsupportedForDifferentSizes().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), llvm::BPFLegalizerInfo::BPFLegalizerInfo(), llvm::M68kLegalizerInfo::M68kLegalizerInfo(), llvm::MipsLegalizerInfo::MipsLegalizerInfo(), llvm::PPCLegalizerInfo::PPCLegalizerInfo(), llvm::SPIRVLegalizerInfo::SPIRVLegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().

decreaseToSmallerTypesAndIncreaseToSmallest()

getAction()

getOpcodeIdxForOpcode()

increaseToLargerTypesAndDecreaseToLargest()

moreToWiderTypesAndLessToWidest()

SizeAndActionsVec llvm::LegacyLegalizerInfo::moreToWiderTypesAndLessToWidest ( const SizeAndActionsVec & v) inlinestatic

A SizeChangeStrategy for the common case where legalization for a particular vector operation consists of having more elements in the vector, to a type that is legal.

Unless there is no such type and then instead it should be legalized towards the widest vector that's still legal. E.g. setAction({G_ADD, LLT::vector(8, 8)}, Legal); setAction({G_ADD, LLT::vector(16, 8)}, Legal); setAction({G_ADD, LLT::vector(2, 32)}, Legal); setAction({G_ADD, LLT::vector(4, 32)}, Legal); setLegalizeVectorElementToDifferentSizeStrategy( G_ADD, 0, moreToWiderTypesAndLessToWidest); will result in the following getAction results:

Definition at line 264 of file LegacyLegalizerInfo.h.

References increaseToLargerTypesAndDecreaseToLargest().

Referenced by computeTables().

narrowToSmallerAndUnsupportedIfTooSmall()

SizeAndActionsVec llvm::LegacyLegalizerInfo::narrowToSmallerAndUnsupportedIfTooSmall ( const SizeAndActionsVec & v) inlinestatic

needsLegalizingToDifferentSize()

setAction()

setLegalizeScalarToDifferentSizeStrategy()

The setAction calls record the non-size-changing legalization actions to take on specificly-sized types.

The SizeChangeStrategy defines what to do when the size of the type needs to be changed to reach a legally sized type (i.e., one that was defined through a setAction call). e.g. setAction ({G_ADD, 0, LLT::scalar(32)}, Legal); setLegalizeScalarToDifferentSizeStrategy( G_ADD, 0, widenToLargerTypesAndNarrowToLargest); will end up defining getAction({G_ADD, 0, T}) to return the following actions for different scalar types T: LLT::scalar(1)..LLT::scalar(31): {WidenScalar, 0, LLT::scalar(32)} LLT::scalar(32): {Legal, 0, LLT::scalar(32)} LLT::scalar(33)..: {NarrowScalar, 0, LLT::scalar(32)}

If no SizeChangeAction gets defined, through this function, the default is unsupportedForDifferentSizes.

Definition at line 181 of file LegacyLegalizerInfo.h.

References llvm::size().

Referenced by LegacyLegalizerInfo().

setLegalizeVectorElementToDifferentSizeStrategy()

void llvm::LegacyLegalizerInfo::setLegalizeVectorElementToDifferentSizeStrategy ( const unsigned Opcode, const unsigned TypeIdx, SizeChangeStrategy S ) inline

unsupportedForDifferentSizes()

SizeAndActionsVec llvm::LegacyLegalizerInfo::unsupportedForDifferentSizes ( const SizeAndActionsVec & v) inlinestatic

A SizeChangeStrategy for the common case where legalization for a particular operation consists of only supporting a specific set of type sizes.

E.g. setAction ({G_DIV, 0, LLT::scalar(32)}, Legal); setAction ({G_DIV, 0, LLT::scalar(64)}, Legal); setLegalizeScalarToDifferentSizeStrategy( G_DIV, 0, unsupportedForDifferentSizes); will result in getAction({G_DIV, 0, T}) to return Legal for s32 and s64, and Unsupported for all other scalar types T.

Definition at line 211 of file LegacyLegalizerInfo.h.

References increaseToLargerTypesAndDecreaseToLargest().

Referenced by computeTables().

widenToLargerTypesAndNarrowToLargest()

SizeAndActionsVec llvm::LegacyLegalizerInfo::widenToLargerTypesAndNarrowToLargest ( const SizeAndActionsVec & v) inlinestatic

widenToLargerTypesUnsupportedOtherwise()

SizeAndActionsVec llvm::LegacyLegalizerInfo::widenToLargerTypesUnsupportedOtherwise ( const SizeAndActionsVec & v) inlinestatic

The documentation for this class was generated from the following files: