LLVM 23.0.0git
llvm::LegalizeRuleSet Class Reference

#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"

Public Member Functions

 LegalizeRuleSet ()=default
bool isAliasedByAnother ()
void setIsAliasedByAnother ()
void aliasTo (unsigned Opcode)
unsigned getAlias () const
unsigned immIdx (unsigned ImmIdx)
LegalizeRuleSetlegalIf (LegalityPredicate Predicate)
 The instruction is legal if predicate is true.
LegalizeRuleSetlegalFor (std::initializer_list< LLT > Types)
 The instruction is legal when type index 0 is any type in the given list.
LegalizeRuleSetlegalFor (bool Pred, std::initializer_list< LLT > Types)
LegalizeRuleSetlegalFor (std::initializer_list< std::pair< LLT, LLT > > Types)
 The instruction is legal when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetlegalFor (bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
LegalizeRuleSetlegalFor (bool Pred, std::initializer_list< std::tuple< LLT, LLT, LLT > > Types)
LegalizeRuleSetlegalForTypeWithAnyImm (std::initializer_list< LLT > Types)
 The instruction is legal when type index 0 is any type in the given list and imm index 0 is anything.
LegalizeRuleSetlegalForTypeWithAnyImm (std::initializer_list< std::pair< LLT, LLT > > Types)
LegalizeRuleSetlegalForTypesWithMemDesc (std::initializer_list< LegalityPredicates::TypePairAndMemDesc > TypesAndMemDesc)
 The instruction is legal when type indexes 0 and 1 along with the memory size and minimum alignment is any type and size tuple in the given list.
LegalizeRuleSetlegalForCartesianProduct (std::initializer_list< LLT > Types)
 The instruction is legal when type indexes 0 and 1 are both in the given list.
LegalizeRuleSetlegalForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
 The instruction is legal when type indexes 0 and 1 are both their respective lists.
LegalizeRuleSetlegalForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
 The instruction is legal when type indexes 0, 1, and 2 are both their respective lists.
LegalizeRuleSetalwaysLegal ()
LegalizeRuleSetbitcastIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 The specified type index is coerced if predicate is true.
LegalizeRuleSetlower ()
 The instruction is lowered.
LegalizeRuleSetlowerIf (LegalityPredicate Predicate)
 The instruction is lowered if predicate is true.
LegalizeRuleSetlowerIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 The instruction is lowered if predicate is true.
LegalizeRuleSetlowerFor (std::initializer_list< LLT > Types)
 The instruction is lowered when type index 0 is any type in the given list.
LegalizeRuleSetlowerFor (std::initializer_list< LLT > Types, LegalizeMutation Mutation)
 The instruction is lowered when type index 0 is any type in the given list.
LegalizeRuleSetlowerFor (std::initializer_list< std::pair< LLT, LLT > > Types)
 The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetlowerFor (bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
 The instruction is lowered when type indexes 0 and 1 is any type pair in the given list, provided Predicate pred is true.
LegalizeRuleSetlowerFor (std::initializer_list< std::pair< LLT, LLT > > Types, LegalizeMutation Mutation)
 The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetlowerForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
 The instruction is lowered when type indexes 0 and 1 are both in their respective lists.
LegalizeRuleSetlowerForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
 The instruction is lowered when type indexes 0, 1, and 2 are all in their respective lists.
LegalizeRuleSetlibcall ()
 The instruction is emitted as a library call.
LegalizeRuleSetlibcallIf (LegalityPredicate Predicate)
 Like legalIf, but for the Libcall action.
LegalizeRuleSetlibcallFor (std::initializer_list< LLT > Types)
LegalizeRuleSetlibcallFor (bool Pred, std::initializer_list< LLT > Types)
LegalizeRuleSetlibcallFor (std::initializer_list< std::pair< LLT, LLT > > Types)
LegalizeRuleSetlibcallFor (bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
LegalizeRuleSetlibcallForCartesianProduct (std::initializer_list< LLT > Types)
LegalizeRuleSetlibcallForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
LegalizeRuleSetwidenScalarIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 Widen the scalar to the one selected by the mutation if the predicate is true.
LegalizeRuleSetwidenScalarFor (std::initializer_list< std::pair< LLT, LLT > > Types, LegalizeMutation Mutation)
 Widen the scalar, specified in mutation, when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetnarrowScalarIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 Narrow the scalar to the one selected by the mutation if the predicate is true.
LegalizeRuleSetnarrowScalarFor (std::initializer_list< std::pair< LLT, LLT > > Types, LegalizeMutation Mutation)
 Narrow the scalar, specified in mutation, when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetmoreElementsIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 Add more elements to reach the type selected by the mutation if the predicate is true.
LegalizeRuleSetfewerElementsIf (LegalityPredicate Predicate, LegalizeMutation Mutation)
 Remove elements to reach the type selected by the mutation if the predicate is true.
LegalizeRuleSetunsupported ()
 The instruction is unsupported.
LegalizeRuleSetunsupportedIf (LegalityPredicate Predicate)
LegalizeRuleSetunsupportedFor (std::initializer_list< LLT > Types)
LegalizeRuleSetunsupportedIfMemSizeNotPow2 ()
LegalizeRuleSetlowerIfMemSizeNotPow2 ()
 Lower a memory operation if the memory size, rounded to bytes, is not a power of 2.
LegalizeRuleSetlowerIfMemSizeNotByteSizePow2 ()
 Lower a memory operation if the memory access size is not a round power of 2 byte size.
LegalizeRuleSetcustomIf (LegalityPredicate Predicate)
LegalizeRuleSetcustomFor (std::initializer_list< LLT > Types)
LegalizeRuleSetcustomFor (bool Pred, std::initializer_list< LLT > Types)
LegalizeRuleSetcustomFor (std::initializer_list< std::pair< LLT, LLT > > Types)
 The instruction is custom when type indexes 0 and 1 is any type pair in the given list.
LegalizeRuleSetcustomFor (bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
LegalizeRuleSetcustomForCartesianProduct (std::initializer_list< LLT > Types)
LegalizeRuleSetcustomForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
 The instruction is custom when type indexes 0 and 1 are both in their respective lists.
LegalizeRuleSetcustomForCartesianProduct (std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
 The instruction is custom when type indexes 0, 1, and 2 are all in their respective lists.
LegalizeRuleSetcustomForCartesianProduct (bool Pred, std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
 The instruction is custom when the predicate is true and type indexes 0 and 1 are all in their respective lists.
LegalizeRuleSetcustom ()
 Unconditionally custom lower.
LegalizeRuleSetwidenScalarToNextPow2 (unsigned TypeIdx, unsigned MinSize=0)
 Widen the scalar to the next power of two that is at least MinSize.
LegalizeRuleSetwidenScalarToNextMultipleOf (unsigned TypeIdx, unsigned Size)
 Widen the scalar to the next multiple of Size.
LegalizeRuleSetwidenScalarOrEltToNextPow2 (unsigned TypeIdx, unsigned MinSize=0)
 Widen the scalar or vector element type to the next power of two that is at least MinSize.
LegalizeRuleSetwidenScalarOrEltToNextPow2OrMinSize (unsigned TypeIdx, unsigned MinSize=0)
 Widen the scalar or vector element type to the next power of two that is at least MinSize.
LegalizeRuleSetnarrowScalar (unsigned TypeIdx, LegalizeMutation Mutation)
LegalizeRuleSetscalarize (unsigned TypeIdx)
LegalizeRuleSetscalarizeIf (LegalityPredicate Predicate, unsigned TypeIdx)
LegalizeRuleSetminScalarOrElt (unsigned TypeIdx, const LLT Ty)
 Ensure the scalar or element is at least as wide as Ty.
LegalizeRuleSetminScalarOrEltIf (LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
 Ensure the scalar or element is at least as wide as Ty.
LegalizeRuleSetwidenVectorEltsToVectorMinSize (unsigned TypeIdx, unsigned VectorSize)
 Ensure the vector size is at least as wide as VectorSize by promoting the element.
LegalizeRuleSetminScalar (unsigned TypeIdx, const LLT Ty)
 Ensure the scalar is at least as wide as Ty.
LegalizeRuleSetminScalar (bool Pred, unsigned TypeIdx, const LLT Ty)
LegalizeRuleSetminScalarIf (LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
 Ensure the scalar is at least as wide as Ty if condition is met.
LegalizeRuleSetmaxScalarOrElt (unsigned TypeIdx, const LLT Ty)
 Ensure the scalar is at most as wide as Ty.
LegalizeRuleSetmaxScalar (unsigned TypeIdx, const LLT Ty)
 Ensure the scalar is at most as wide as Ty.
LegalizeRuleSetmaxScalarIf (LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
 Conditionally limit the maximum size of the scalar.
LegalizeRuleSetclampScalar (unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
 Limit the range of scalar sizes to MinTy and MaxTy.
LegalizeRuleSetclampScalar (bool Pred, unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
LegalizeRuleSetclampScalarOrElt (unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
 Limit the range of scalar sizes to MinTy and MaxTy.
LegalizeRuleSetminScalarSameAs (unsigned TypeIdx, unsigned LargeTypeIdx)
 Widen the scalar to match the size of another.
LegalizeRuleSetmaxScalarSameAs (unsigned TypeIdx, unsigned NarrowTypeIdx)
 Narrow the scalar to match the size of another.
LegalizeRuleSetscalarSameSizeAs (unsigned TypeIdx, unsigned SameSizeIdx)
 Change the type TypeIdx to have the same scalar size as type SameSizeIdx.
LegalizeRuleSetminScalarEltSameAsIf (LegalityPredicate Predicate, unsigned TypeIdx, unsigned LargeTypeIdx)
 Conditionally widen the scalar or elt to match the size of another.
LegalizeRuleSetmaxScalarEltSameAsIf (LegalityPredicate Predicate, unsigned TypeIdx, unsigned SmallTypeIdx)
 Conditionally narrow the scalar or elt to match the size of another.
LegalizeRuleSetmoreElementsToNextPow2 (unsigned TypeIdx)
 Add more elements to the vector to reach the next power of two.
LegalizeRuleSetclampMinNumElements (unsigned TypeIdx, const LLT EltTy, unsigned MinElements)
 Limit the number of elements in EltTy vectors to at least MinElements.
LegalizeRuleSetalignNumElementsTo (unsigned TypeIdx, const LLT EltTy, unsigned NumElts)
 Set number of elements to nearest larger multiple of NumElts.
LegalizeRuleSetclampMaxNumElements (unsigned TypeIdx, const LLT EltTy, unsigned MaxElements)
 Limit the number of elements in EltTy vectors to at most MaxElements.
LegalizeRuleSetclampNumElements (unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
 Limit the number of elements for the given vectors to at least MinTy's number of elements and at most MaxTy's number of elements.
LegalizeRuleSetclampMaxNumElementsStrict (unsigned TypeIdx, const LLT EltTy, unsigned NumElts)
 Express EltTy vectors strictly using vectors with NumElts elements (or scalars when NumElts equals 1).
LegalizeRuleSetfallback ()
 Fallback on the previous implementation.
LLVM_ABI bool verifyTypeIdxsCoverage (unsigned NumTypeIdxs) const
 Check if there is no type index which is obviously not handled by the LegalizeRuleSet in any way at all.
LLVM_ABI bool verifyImmIdxsCoverage (unsigned NumImmIdxs) const
 Check if there is no imm index which is obviously not handled by the LegalizeRuleSet in any way at all.
LLVM_ABI LegalizeActionStep apply (const LegalityQuery &Query) const
 Apply the ruleset to the given LegalityQuery.

Detailed Description

Definition at line 457 of file LegalizerInfo.h.

Constructor & Destructor Documentation

◆ LegalizeRuleSet()

Member Function Documentation

◆ aliasTo()

void llvm::LegalizeRuleSet::aliasTo ( unsigned Opcode)
inline

Definition at line 615 of file LegalizerInfo.h.

References assert().

◆ alignNumElementsTo()

LegalizeRuleSet & llvm::LegalizeRuleSet::alignNumElementsTo ( unsigned TypeIdx,
const LLT EltTy,
unsigned NumElts )
inline

◆ alwaysLegal()

◆ apply()

LegalizeActionStep LegalizeRuleSet::apply ( const LegalityQuery & Query) const

◆ bitcastIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::bitcastIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

The specified type index is coerced if predicate is true.

Definition at line 715 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and llvm::PPCLegalizerInfo::PPCLegalizerInfo().

◆ clampMaxNumElements()

◆ clampMaxNumElementsStrict()

LegalizeRuleSet & llvm::LegalizeRuleSet::clampMaxNumElementsStrict ( unsigned TypeIdx,
const LLT EltTy,
unsigned NumElts )
inline

Express EltTy vectors strictly using vectors with NumElts elements (or scalars when NumElts equals 1).

First pad with undef elements to nearest larger multiple of NumElts. Then perform split with all sub-instructions having the same type. Using clampMaxNumElements (non-strict) can result in leftover instruction with different type (fewer elements then NumElts or scalar). No effect if the type is not a vector.

Definition at line 1336 of file LegalizerInfo.h.

References alignNumElementsTo(), clampMaxNumElements(), and LegalizeRuleSet().

Referenced by llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ clampMinNumElements()

LegalizeRuleSet & llvm::LegalizeRuleSet::clampMinNumElements ( unsigned TypeIdx,
const LLT EltTy,
unsigned MinElements )
inline

◆ clampNumElements()

LegalizeRuleSet & llvm::LegalizeRuleSet::clampNumElements ( unsigned TypeIdx,
const LLT MinTy,
const LLT MaxTy )
inline

Limit the number of elements for the given vectors to at least MinTy's number of elements and at most MaxTy's number of elements.

No effect if the type is not a vector or does not have the same element type as the constraints. The element type of MinTy and MaxTy must match.

Definition at line 1316 of file LegalizerInfo.h.

References assert(), clampMaxNumElements(), clampMinNumElements(), llvm::LLT::getElementType(), llvm::LLT::getNumElements(), llvm::LLT::isScalableVector(), and LegalizeRuleSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().

◆ clampScalar() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::clampScalar ( bool Pred,
unsigned TypeIdx,
const LLT MinTy,
const LLT MaxTy )
inline

Definition at line 1165 of file LegalizerInfo.h.

References clampScalar(), and LegalizeRuleSet().

◆ clampScalar() [2/2]

◆ clampScalarOrElt()

LegalizeRuleSet & llvm::LegalizeRuleSet::clampScalarOrElt ( unsigned TypeIdx,
const LLT MinTy,
const LLT MaxTy )
inline

Limit the range of scalar sizes to MinTy and MaxTy.

Definition at line 1173 of file LegalizerInfo.h.

References LegalizeRuleSet(), maxScalarOrElt(), and minScalarOrElt().

Referenced by llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ custom()

◆ customFor() [1/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customFor ( bool Pred,
std::initializer_list< LLT > Types )
inline

Definition at line 935 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ customFor() [2/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customFor ( bool Pred,
std::initializer_list< std::pair< LLT, LLT > > Types )
inline

Definition at line 946 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ customFor() [3/4]

◆ customFor() [4/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customFor ( std::initializer_list< std::pair< LLT, LLT > > Types)
inline

The instruction is custom when type indexes 0 and 1 is any type pair in the given list.

Definition at line 943 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ customForCartesianProduct() [1/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customForCartesianProduct ( bool Pred,
std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1 )
inline

The instruction is custom when the predicate is true and type indexes 0 and 1 are all in their respective lists.

Definition at line 976 of file LegalizerInfo.h.

◆ customForCartesianProduct() [2/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customForCartesianProduct ( std::initializer_list< LLT > Types)
inline

◆ customForCartesianProduct() [3/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1 )
inline

The instruction is custom when type indexes 0 and 1 are both in their respective lists.

Definition at line 959 of file LegalizerInfo.h.

◆ customForCartesianProduct() [4/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::customForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1,
std::initializer_list< LLT > Types2 )
inline

The instruction is custom when type indexes 0, 1, and 2 are all in their respective lists.

Definition at line 966 of file LegalizerInfo.h.

◆ customIf()

◆ fallback()

LegalizeRuleSet & llvm::LegalizeRuleSet::fallback ( )
inline

Fallback on the previous implementation.

This should only be used while porting a rule.

Definition at line 1344 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ fewerElementsIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::fewerElementsIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

Remove elements to reach the type selected by the mutation if the predicate is true.

Definition at line 884 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

Referenced by llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and llvm::SPIRVLegalizerInfo::SPIRVLegalizerInfo().

◆ getAlias()

unsigned llvm::LegalizeRuleSet::getAlias ( ) const
inline

Definition at line 621 of file LegalizerInfo.h.

◆ immIdx()

unsigned llvm::LegalizeRuleSet::immIdx ( unsigned ImmIdx)
inline

◆ isAliasedByAnother()

bool llvm::LegalizeRuleSet::isAliasedByAnother ( )
inline

Definition at line 613 of file LegalizerInfo.h.

◆ legalFor() [1/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalFor ( bool Pred,
std::initializer_list< LLT > Types )
inline

Definition at line 644 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalFor() [2/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalFor ( bool Pred,
std::initializer_list< std::pair< LLT, LLT > > Types )
inline

Definition at line 654 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalFor() [3/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalFor ( bool Pred,
std::initializer_list< std::tuple< LLT, LLT, LLT > > Types )
inline

Definition at line 661 of file LegalizerInfo.h.

◆ legalFor() [4/5]

◆ legalFor() [5/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalFor ( std::initializer_list< std::pair< LLT, LLT > > Types)
inline

The instruction is legal when type indexes 0 and 1 is any type pair in the given list.

Definition at line 651 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalForCartesianProduct() [1/3]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForCartesianProduct ( std::initializer_list< LLT > Types)
inline

◆ legalForCartesianProduct() [2/3]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1 )
inline

The instruction is legal when type indexes 0 and 1 are both their respective lists.

Definition at line 695 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalForCartesianProduct() [3/3]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1,
std::initializer_list< LLT > Types2 )
inline

The instruction is legal when type indexes 0, 1, and 2 are both their respective lists.

Definition at line 701 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalForTypesWithMemDesc()

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForTypesWithMemDesc ( std::initializer_list< LegalityPredicates::TypePairAndMemDesc > TypesAndMemDesc)
inline

The instruction is legal when type indexes 0 and 1 along with the memory size and minimum alignment is any type and size tuple in the given list.

Definition at line 681 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalityPredicates::typePairAndMemDescInSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and llvm::ARMLegalizerInfo::ARMLegalizerInfo().

◆ legalForTypeWithAnyImm() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForTypeWithAnyImm ( std::initializer_list< LLT > Types)
inline

The instruction is legal when type index 0 is any type in the given list and imm index 0 is anything.

Definition at line 668 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalForTypeWithAnyImm() [2/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::legalForTypeWithAnyImm ( std::initializer_list< std::pair< LLT, LLT > > Types)
inline

Definition at line 673 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ legalIf()

◆ libcall()

LegalizeRuleSet & llvm::LegalizeRuleSet::libcall ( )
inline

The instruction is emitted as a library call.

Definition at line 796 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::X86LegalizerInfo::X86LegalizerInfo().

◆ libcallFor() [1/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallFor ( bool Pred,
std::initializer_list< LLT > Types )
inline

Definition at line 814 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ libcallFor() [2/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallFor ( bool Pred,
std::initializer_list< std::pair< LLT, LLT > > Types )
inline

Definition at line 824 of file LegalizerInfo.h.

◆ libcallFor() [3/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallFor ( std::initializer_list< LLT > Types)
inline

◆ libcallFor() [4/4]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallFor ( std::initializer_list< std::pair< LLT, LLT > > Types)
inline

Definition at line 820 of file LegalizerInfo.h.

◆ libcallForCartesianProduct() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallForCartesianProduct ( std::initializer_list< LLT > Types)
inline

Definition at line 830 of file LegalizerInfo.h.

Referenced by llvm::MipsLegalizerInfo::MipsLegalizerInfo().

◆ libcallForCartesianProduct() [2/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1 )
inline

Definition at line 834 of file LegalizerInfo.h.

◆ libcallIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::libcallIf ( LegalityPredicate Predicate)
inline

Like legalIf, but for the Libcall action.

Definition at line 805 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ lower()

◆ lowerFor() [1/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerFor ( bool Pred,
std::initializer_list< std::pair< LLT, LLT > > Types )
inline

The instruction is lowered when type indexes 0 and 1 is any type pair in the given list, provided Predicate pred is true.

Definition at line 766 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ lowerFor() [2/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerFor ( std::initializer_list< LLT > Types)
inline

◆ lowerFor() [3/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerFor ( std::initializer_list< LLT > Types,
LegalizeMutation Mutation )
inline

The instruction is lowered when type index 0 is any type in the given list.

Definition at line 755 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

◆ lowerFor() [4/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerFor ( std::initializer_list< std::pair< LLT, LLT > > Types)
inline

The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.

Keep type index 0 as the same type.

Definition at line 761 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ lowerFor() [5/5]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerFor ( std::initializer_list< std::pair< LLT, LLT > > Types,
LegalizeMutation Mutation )
inline

The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.

Definition at line 774 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

◆ lowerForCartesianProduct() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1 )
inline

The instruction is lowered when type indexes 0 and 1 are both in their respective lists.

Definition at line 780 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ lowerForCartesianProduct() [2/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerForCartesianProduct ( std::initializer_list< LLT > Types0,
std::initializer_list< LLT > Types1,
std::initializer_list< LLT > Types2 )
inline

The instruction is lowered when type indexes 0, 1, and 2 are all in their respective lists.

Definition at line 787 of file LegalizerInfo.h.

References LegalizeRuleSet().

◆ lowerIf() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerIf ( LegalityPredicate Predicate)
inline

The instruction is lowered if predicate is true.

Keep type index 0 as the same type.

Definition at line 733 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and llvm::SPIRVLegalizerInfo::SPIRVLegalizerInfo().

◆ lowerIf() [2/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

The instruction is lowered if predicate is true.

Definition at line 741 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

◆ lowerIfMemSizeNotByteSizePow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerIfMemSizeNotByteSizePow2 ( )
inline

Lower a memory operation if the memory access size is not a round power of 2 byte size.

This is stricter than lowerIfMemSizeNotPow2, and more likely what you want (e.g. this will lower s1, s7 and s24).

Definition at line 921 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalityPredicates::memSizeNotByteSizePow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ lowerIfMemSizeNotPow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::lowerIfMemSizeNotPow2 ( )
inline

Lower a memory operation if the memory size, rounded to bytes, is not a power of 2.

For example, this will not trigger for s1 or s7, but will for s24.

Definition at line 913 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalityPredicates::memSizeInBytesNotPow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ maxScalar()

LegalizeRuleSet & llvm::LegalizeRuleSet::maxScalar ( unsigned TypeIdx,
const LLT Ty )
inline

◆ maxScalarEltSameAsIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::maxScalarEltSameAsIf ( LegalityPredicate Predicate,
unsigned TypeIdx,
unsigned SmallTypeIdx )
inline

Conditionally narrow the scalar or elt to match the size of another.

Definition at line 1227 of file LegalizerInfo.h.

References LegalizeRuleSet(), narrowScalarIf(), T, and llvm::LegalityQuery::Types.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ maxScalarIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::maxScalarIf ( LegalityPredicate Predicate,
unsigned TypeIdx,
const LLT Ty )
inline

Conditionally limit the maximum size of the scalar.

For example, when the maximum size of one type depends on the size of another such as extracting N bits from an M bit container.

Definition at line 1143 of file LegalizerInfo.h.

References llvm::LLT::getSizeInBits(), llvm::LLT::isScalar(), LegalizeRuleSet(), and llvm::LegalityQuery::Types.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ maxScalarOrElt()

LegalizeRuleSet & llvm::LegalizeRuleSet::maxScalarOrElt ( unsigned TypeIdx,
const LLT Ty )
inline

Ensure the scalar is at most as wide as Ty.

Definition at line 1123 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by clampScalarOrElt().

◆ maxScalarSameAs()

LegalizeRuleSet & llvm::LegalizeRuleSet::maxScalarSameAs ( unsigned TypeIdx,
unsigned NarrowTypeIdx )
inline

Narrow the scalar to match the size of another.

Definition at line 1191 of file LegalizerInfo.h.

References llvm::LegalizeMutations::changeElementSizeTo(), LegalizeRuleSet(), and llvm::LegalityQuery::Types.

Referenced by scalarSameSizeAs().

◆ minScalar() [1/2]

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalar ( bool Pred,
unsigned TypeIdx,
const LLT Ty )
inline

Definition at line 1100 of file LegalizerInfo.h.

References LegalizeRuleSet(), and minScalar().

◆ minScalar() [2/2]

◆ minScalarEltSameAsIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalarEltSameAsIf ( LegalityPredicate Predicate,
unsigned TypeIdx,
unsigned LargeTypeIdx )
inline

Conditionally widen the scalar or elt to match the size of another.

Definition at line 1210 of file LegalizerInfo.h.

References LegalizeRuleSet(), T, llvm::LegalityQuery::Types, and widenScalarIf().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ minScalarIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalarIf ( LegalityPredicate Predicate,
unsigned TypeIdx,
const LLT Ty )
inline

Ensure the scalar is at least as wide as Ty if condition is met.

Definition at line 1107 of file LegalizerInfo.h.

References llvm::LLT::getSizeInBits(), llvm::LLT::isScalar(), LegalizeRuleSet(), and llvm::LegalityQuery::Types.

◆ minScalarOrElt()

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalarOrElt ( unsigned TypeIdx,
const LLT Ty )
inline

Ensure the scalar or element is at least as wide as Ty.

Definition at line 1051 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and clampScalarOrElt().

◆ minScalarOrEltIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalarOrEltIf ( LegalityPredicate Predicate,
unsigned TypeIdx,
const LLT Ty )
inline

Ensure the scalar or element is at least as wide as Ty.

Definition at line 1060 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ minScalarSameAs()

LegalizeRuleSet & llvm::LegalizeRuleSet::minScalarSameAs ( unsigned TypeIdx,
unsigned LargeTypeIdx )
inline

Widen the scalar to match the size of another.

Definition at line 1179 of file LegalizerInfo.h.

References llvm::LegalizeMutations::changeElementSizeTo(), LegalizeRuleSet(), and llvm::LegalityQuery::Types.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and scalarSameSizeAs().

◆ moreElementsIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::moreElementsIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

Add more elements to reach the type selected by the mutation if the predicate is true.

Definition at line 875 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ moreElementsToNextPow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::moreElementsToNextPow2 ( unsigned TypeIdx)
inline

Add more elements to the vector to reach the next power of two.

No effect if the type is not a vector or the element count is a power of two.

Definition at line 1246 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalizeMutations::moreElementsToNextPow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::SPIRVLegalizerInfo::SPIRVLegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().

◆ narrowScalar()

LegalizeRuleSet & llvm::LegalizeRuleSet::narrowScalar ( unsigned TypeIdx,
LegalizeMutation Mutation )
inline

Definition at line 1031 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

◆ narrowScalarFor()

LegalizeRuleSet & llvm::LegalizeRuleSet::narrowScalarFor ( std::initializer_list< std::pair< LLT, LLT > > Types,
LegalizeMutation Mutation )
inline

Narrow the scalar, specified in mutation, when type indexes 0 and 1 is any type pair in the given list.

Definition at line 868 of file LegalizerInfo.h.

References Mutation.

◆ narrowScalarIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::narrowScalarIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

Narrow the scalar to the one selected by the mutation if the predicate is true.

Definition at line 858 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and maxScalarEltSameAsIf().

◆ scalarize()

◆ scalarizeIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::scalarizeIf ( LegalityPredicate Predicate,
unsigned TypeIdx )
inline

◆ scalarSameSizeAs()

LegalizeRuleSet & llvm::LegalizeRuleSet::scalarSameSizeAs ( unsigned TypeIdx,
unsigned SameSizeIdx )
inline

◆ setIsAliasedByAnother()

void llvm::LegalizeRuleSet::setIsAliasedByAnother ( )
inline

Definition at line 614 of file LegalizerInfo.h.

◆ unsupported()

LegalizeRuleSet & llvm::LegalizeRuleSet::unsupported ( )
inline

The instruction is unsupported.

Definition at line 893 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), and llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ unsupportedFor()

LegalizeRuleSet & llvm::LegalizeRuleSet::unsupportedFor ( std::initializer_list< LLT > Types)
inline

Definition at line 901 of file LegalizerInfo.h.

References LegalizeRuleSet().

Referenced by llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ unsupportedIf()

◆ unsupportedIfMemSizeNotPow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::unsupportedIfMemSizeNotPow2 ( )
inline

◆ verifyImmIdxsCoverage()

bool LegalizeRuleSet::verifyImmIdxsCoverage ( unsigned NumImmIdxs) const

Check if there is no imm index which is obviously not handled by the LegalizeRuleSet in any way at all.

Precondition
Type indices of the opcode form a dense [0, NumTypeIdxs) set.

Definition at line 248 of file LegalizerInfo.cpp.

References llvm::dbgs(), LLVM_DEBUG, and VerboseVerifyLegalizerInfo.

Referenced by llvm::LegalizerInfo::verify().

◆ verifyTypeIdxsCoverage()

bool LegalizeRuleSet::verifyTypeIdxsCoverage ( unsigned NumTypeIdxs) const

Check if there is no type index which is obviously not handled by the LegalizeRuleSet in any way at all.

Precondition
Type indices of the opcode form a dense [0, NumTypeIdxs) set.

Definition at line 217 of file LegalizerInfo.cpp.

References llvm::dbgs(), LLVM_DEBUG, and VerboseVerifyLegalizerInfo.

Referenced by llvm::LegalizerInfo::verify().

◆ widenScalarFor()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarFor ( std::initializer_list< std::pair< LLT, LLT > > Types,
LegalizeMutation Mutation )
inline

Widen the scalar, specified in mutation, when type indexes 0 and 1 is any type pair in the given list.

Definition at line 851 of file LegalizerInfo.h.

References Mutation.

◆ widenScalarIf()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarIf ( LegalityPredicate Predicate,
LegalizeMutation Mutation )
inline

Widen the scalar to the one selected by the mutation if the predicate is true.

Definition at line 841 of file LegalizerInfo.h.

References LegalizeRuleSet(), and Mutation.

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), and minScalarEltSameAsIf().

◆ widenScalarOrEltToNextPow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarOrEltToNextPow2 ( unsigned TypeIdx,
unsigned MinSize = 0 )
inline

Widen the scalar or vector element type to the next power of two that is at least MinSize.

No effect if the scalar size is a power of two.

Definition at line 1011 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalizeMutations::widenScalarOrEltToNextPow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ widenScalarOrEltToNextPow2OrMinSize()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarOrEltToNextPow2OrMinSize ( unsigned TypeIdx,
unsigned MinSize = 0 )
inline

Widen the scalar or vector element type to the next power of two that is at least MinSize.

No effect if the scalar size is a power of two.

Definition at line 1021 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalizeMutations::widenScalarOrEltToNextPow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo().

◆ widenScalarToNextMultipleOf()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarToNextMultipleOf ( unsigned TypeIdx,
unsigned Size )
inline

Widen the scalar to the next multiple of Size.

No effect if the type is not a scalar or is a multiple of Size.

Definition at line 1001 of file LegalizerInfo.h.

References LegalizeRuleSet(), Size, and llvm::LegalizeMutations::widenScalarOrEltToNextMultipleOf().

Referenced by llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo().

◆ widenScalarToNextPow2()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenScalarToNextPow2 ( unsigned TypeIdx,
unsigned MinSize = 0 )
inline

Widen the scalar to the next power of two that is at least MinSize.

No effect if the type is a power of two, except if the type is smaller than MinSize, or if the type is a vector type.

Definition at line 991 of file LegalizerInfo.h.

References LegalizeRuleSet(), and llvm::LegalizeMutations::widenScalarOrEltToNextPow2().

Referenced by llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(), llvm::AMDGPULegalizerInfo::AMDGPULegalizerInfo(), llvm::M68kLegalizerInfo::M68kLegalizerInfo(), llvm::RISCVLegalizerInfo::RISCVLegalizerInfo(), and llvm::X86LegalizerInfo::X86LegalizerInfo().

◆ widenVectorEltsToVectorMinSize()

LegalizeRuleSet & llvm::LegalizeRuleSet::widenVectorEltsToVectorMinSize ( unsigned TypeIdx,
unsigned VectorSize )
inline

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