15 #ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H 16 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H 31 #include <unordered_map> 39 class MachineIRBuilder;
40 class MachineRegisterInfo;
42 class GISelChangeObserver;
109 : Opcode(Opcode), Idx(Idx), Type(Type) {}
112 return Opcode == RHS.
Opcode && Idx == RHS.
Idx && Type == RHS.
Type;
135 : Opcode(Opcode), Types(Types), MMODescrs(MMODescrs) {}
137 : LegalityQuery(Opcode, Types, {}) {}
155 : Action(Action), TypeIdx(TypeIdx), NewType(NewType) {}
158 return std::tie(Action, TypeIdx, NewType) ==
174 return Type0 == Other.
Type0 && Type1 == Other.
Type1 &&
180 template<
typename Predicate>
189 return all(
all(P0, P1), args...);
195 std::initializer_list<LLT> TypesInit);
200 std::initializer_list<std::pair<LLT, LLT>> TypesInit);
204 unsigned TypeIdx0,
unsigned TypeIdx1,
unsigned MMOIdx,
205 std::initializer_list<TypePairAndMemSize> TypesAndMemSizeInit);
228 namespace LegalizeMutations {
252 : Predicate(Predicate), Action(Action), Mutation(Mutation) {}
265 return std::make_pair(0,
LLT{});
273 bool IsAliasedByAnother;
288 unsigned typeIdx(
unsigned TypeIdx) {
291 "Type Index is out of bounds");
293 TypeIdxsCovered.set(TypeIdx);
297 void markAllTypeIdxsAsCovered() {
299 TypeIdxsCovered.set();
305 "RuleSet is aliased, change the representative opcode instead");
328 std::initializer_list<LLT> Types) {
330 return actionIf(Action,
typeInSet(typeIdx(0), Types));
335 std::initializer_list<LLT> Types,
338 return actionIf(Action,
typeInSet(typeIdx(0), Types), Mutation);
344 std::initializer_list<std::pair<LLT, LLT>> Types) {
346 return actionIf(Action,
typePairInSet(typeIdx(0), typeIdx(1), Types));
352 std::initializer_list<std::pair<LLT, LLT>> Types,
355 return actionIf(Action,
typePairInSet(typeIdx(0), typeIdx(1), Types),
362 std::initializer_list<LLT> Types) {
364 return actionIf(Action,
all(
typeInSet(typeIdx(0), Types),
373 std::initializer_list<LLT> Types0,
374 std::initializer_list<LLT> Types1) {
376 return actionIf(Action,
all(
typeInSet(typeIdx(0), Types0),
385 std::initializer_list<LLT> Types1, std::initializer_list<LLT> Types2) {
387 return actionIf(Action,
all(
typeInSet(typeIdx(0), Types0),
398 assert((AliasOf == 0 || AliasOf == Opcode) &&
399 "Opcode is already aliased to another opcode");
400 assert(Rules.
empty() &&
"Aliasing will discard rules");
409 markAllTypeIdxsAsCovered();
424 std::initializer_list<LegalityPredicates::TypePairAndMemSize>
428 typeIdx(0), typeIdx(1), 0, TypesAndMemSize));
438 std::initializer_list<LLT> Types1) {
444 using namespace LegalizeMutations;
447 markAllTypeIdxsAsCovered();
453 using namespace LegalizeMutations;
456 markAllTypeIdxsAsCovered();
464 markAllTypeIdxsAsCovered();
494 std::initializer_list<LLT> Types1) {
501 std::initializer_list<LLT> Types1,
502 std::initializer_list<LLT> Types2) {
512 markAllTypeIdxsAsCovered();
519 libcallFor(std::initializer_list<std::pair<LLT, LLT>> Types) {
528 std::initializer_list<LLT> Types1) {
538 markAllTypeIdxsAsCovered();
547 markAllTypeIdxsAsCovered();
557 markAllTypeIdxsAsCovered();
566 markAllTypeIdxsAsCovered();
585 markAllTypeIdxsAsCovered();
596 std::initializer_list<LLT> Types1) {
603 unsigned MinSize = 0) {
618 using namespace LegalizeMutations;
627 using namespace LegalizeMutations;
639 using namespace LegalizeMutations;
652 return minScalar(TypeIdx, MinTy).maxScalar(TypeIdx, MaxTy);
658 return widenScalarIf(
660 return Query.
Types[LargeTypeIdx].getScalarSizeInBits() >
661 Query.
Types[TypeIdx].getSizeInBits();
664 return std::make_pair(TypeIdx,
665 Query.
Types[LargeTypeIdx].getElementType());
681 unsigned MinElements) {
693 return std::make_pair(
699 unsigned MaxElements) {
711 if (MaxElements == 1)
713 return std::make_pair(
726 "Expected element types to agree");
729 return clampMinNumElements(TypeIdx, EltTy, MinTy.
getNumElements())
743 bool verifyTypeIdxsCoverage(
unsigned NumTypeIdxs)
const;
754 unsigned getOpcodeIdxForOpcode(
unsigned Opcode)
const;
755 unsigned getActionDefinitionsIdx(
unsigned Opcode)
const;
760 void computeTables();
783 std::function<SizeAndActionsVec(const SizeAndActionsVec &v)>;
790 assert(!needsLegalizingToDifferentSize(Action));
791 TablesInitialized =
false;
792 const unsigned OpcodeIdx = Aspect.
Opcode - FirstOp;
793 if (SpecifiedActions[OpcodeIdx].
size() <= Aspect.
Idx)
794 SpecifiedActions[OpcodeIdx].resize(Aspect.
Idx + 1);
795 SpecifiedActions[OpcodeIdx][Aspect.
Idx][Aspect.
Type] = Action;
815 const unsigned TypeIdx,
817 const unsigned OpcodeIdx = Opcode - FirstOp;
818 if (ScalarSizeChangeStrategies[OpcodeIdx].
size() <= TypeIdx)
819 ScalarSizeChangeStrategies[OpcodeIdx].resize(TypeIdx + 1);
820 ScalarSizeChangeStrategies[OpcodeIdx][TypeIdx] = S;
826 const unsigned TypeIdx,
828 const unsigned OpcodeIdx = Opcode - FirstOp;
829 if (VectorElementSizeChangeStrategies[OpcodeIdx].
size() <= TypeIdx)
830 VectorElementSizeChangeStrategies[OpcodeIdx].resize(TypeIdx + 1);
831 VectorElementSizeChangeStrategies[OpcodeIdx][TypeIdx] = S;
846 return increaseToLargerTypesAndDecreaseToLargest(v,
Unsupported,
858 "At least one size that can be legalized towards is needed" 859 " for this SizeChangeStrategy");
860 return increaseToLargerTypesAndDecreaseToLargest(v,
WidenScalar,
867 return increaseToLargerTypesAndDecreaseToLargest(v,
WidenScalar,
874 return decreaseToSmallerTypesAndIncreaseToSmallest(v,
NarrowScalar,
882 "At least one size that can be legalized towards is needed" 883 " for this SizeChangeStrategy");
884 return decreaseToSmallerTypesAndIncreaseToSmallest(v,
NarrowScalar,
909 return increaseToLargerTypesAndDecreaseToLargest(v,
MoreElements,
949 getActionDefinitionsBuilder(std::initializer_list<unsigned> Opcodes);
950 void aliasActionDefinitions(
unsigned OpcodeTo,
unsigned OpcodeFrom);
978 std::pair<LegalizeAction, LLT>
998 void setScalarAction(
const unsigned Opcode,
const unsigned TypeIndex,
1000 const unsigned OpcodeIdx = Opcode - FirstOp;
1002 setActions(TypeIndex, Actions, SizeAndActions);
1004 void setPointerAction(
const unsigned Opcode,
const unsigned TypeIndex,
1007 const unsigned OpcodeIdx = Opcode - FirstOp;
1008 if (AddrSpace2PointerActions[OpcodeIdx].
find(AddressSpace) ==
1009 AddrSpace2PointerActions[OpcodeIdx].
end())
1010 AddrSpace2PointerActions[OpcodeIdx][
AddressSpace] = {{}};
1012 AddrSpace2PointerActions[OpcodeIdx].find(AddressSpace)->second;
1013 setActions(TypeIndex, Actions, SizeAndActions);
1021 void setScalarInVectorAction(
const unsigned Opcode,
const unsigned TypeIndex,
1023 unsigned OpcodeIdx = Opcode - FirstOp;
1025 ScalarInVectorActions[OpcodeIdx];
1026 setActions(TypeIndex, Actions, SizeAndActions);
1032 void setVectorNumElementAction(
const unsigned Opcode,
1033 const unsigned TypeIndex,
1034 const unsigned ElementSize,
1036 const unsigned OpcodeIdx = Opcode - FirstOp;
1037 if (NumElements2Actions[OpcodeIdx].
find(ElementSize) ==
1038 NumElements2Actions[OpcodeIdx].
end())
1039 NumElements2Actions[OpcodeIdx][ElementSize] = {{}};
1041 NumElements2Actions[OpcodeIdx].find(ElementSize)->second;
1042 setActions(TypeIndex, Actions, SizeAndActions);
1061 int SmallestNarrowIdx = -1;
1062 int LargestWidenIdx = -1;
1063 int SmallestLegalizableToSameSizeIdx = -1;
1064 int LargestLegalizableToSameSizeIdx = -1;
1065 for(
size_t i=0; i<v.size(); ++i) {
1069 if (SmallestNarrowIdx == -1)
1070 SmallestNarrowIdx = i;
1074 LargestWidenIdx = i;
1079 if (SmallestLegalizableToSameSizeIdx == -1)
1080 SmallestLegalizableToSameSizeIdx = i;
1081 LargestLegalizableToSameSizeIdx = i;
1084 if (SmallestNarrowIdx != -1) {
1085 assert(SmallestLegalizableToSameSizeIdx != -1);
1086 assert(SmallestNarrowIdx > SmallestLegalizableToSameSizeIdx);
1088 if (LargestWidenIdx != -1)
1089 assert(LargestWidenIdx < LargestLegalizableToSameSizeIdx);
1100 checkPartialSizeAndActionsVector(v);
1106 void setActions(
unsigned TypeIndex,
1109 checkFullSizeAndActionsVector(SizeAndActions);
1110 if (Actions.
size() <= TypeIndex)
1111 Actions.
resize(TypeIndex + 1);
1112 Actions[TypeIndex] = SizeAndActions;
1129 std::pair<LegalizeAction, LLT>
1130 findScalarLegalAction(
const InstrAspect &Aspect)
const;
1133 std::pair<LegalizeAction, LLT>
1134 findVectorLegalAction(
const InstrAspect &Aspect)
const;
1136 static const int FirstOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_START;
1137 static const int LastOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END;
1143 ScalarSizeChangeStrategies[LastOp - FirstOp + 1];
1145 VectorElementSizeChangeStrategies[LastOp - FirstOp + 1];
1146 bool TablesInitialized;
1151 std::unordered_map<uint16_t, SmallVector<SizeAndActionsVec, 1>>
1152 AddrSpace2PointerActions[LastOp - FirstOp + 1];
1153 std::unordered_map<uint16_t, SmallVector<SizeAndActionsVec, 1>>
1154 NumElements2Actions[LastOp - FirstOp + 1];
1167 #endif // LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H InstrAspect(unsigned Opcode, unsigned Idx, LLT Type)
constexpr LegalityQuery(unsigned Opcode, const ArrayRef< LLT > Types)
const_iterator end(StringRef path)
Get end iterator over path.
unsigned TypeIdx
If describing an action, the type index to change. Otherwise zero.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
This class represents lattice values for constants.
bool isAliasedByAnother()
unsigned getScalarSizeInBits() const
The operation should be implemented in terms of a wider scalar base-type.
LegalizeMutation widenScalarToNextPow2(unsigned TypeIdx, unsigned Min=0)
Widen the type for the given type index to the next power of 2.
Predicate all(Predicate P0, Predicate P1, Args... args)
True iff all given predicates are true.
std::function< SizeAndActionsVec(const SizeAndActionsVec &v)> SizeChangeStrategy
LegalityPredicate typePairInSet(unsigned TypeIdx0, unsigned TypeIdx1, std::initializer_list< std::pair< LLT, LLT >> TypesInit)
True iff the given types for the given pair of type indexes is one of the specified type pairs...
void push_back(const T &Elt)
The LegalityQuery object bundles together all the information that's needed to decide whether a given...
std::vector< SizeAndAction > SizeAndActionsVec
The (vector) operation should be implemented by splitting it into sub-vectors where the operation is ...
static SizeAndActionsVec narrowToSmallerAndUnsupportedIfTooSmall(const SizeAndActionsVec &v)
unsigned getAlias() const
LegalityPredicate typeIs(unsigned TypeIdx, LLT TypesInit)
True iff the given type index is the specified types.
LegalizeRuleSet & libcallForCartesianProduct(std::initializer_list< LLT > Types)
LLT NewType
If describing an action, the new type for TypeIdx. Otherwise LLT{}.
LegalizeRuleSet & legalForCartesianProduct(std::initializer_list< LLT > Types)
The instruction is legal when type indexes 0 and 1 are both in the given list.
constexpr LegalityQuery(unsigned Opcode, const ArrayRef< LLT > Types, const ArrayRef< MemDesc > MMODescrs)
static SizeAndActionsVec unsupportedForDifferentSizes(const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular operation consists of on...
The operation should be synthesized from multiple instructions acting on a narrower scalar base-type...
static SizeAndActionsVec widenToLargerTypesUnsupportedOtherwise(const SizeAndActionsVec &v)
LegalizeRuleSet & lowerIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
The instruction is lowered if predicate is true.
LegalizeRuleSet & narrowScalar(unsigned TypeIdx, LegalizeMutation Mutation)
bool match(const LegalityQuery &Query) const
Test whether the LegalityQuery matches.
LegalizeAction getAction() const
LegalizeRuleSet & widenScalarToNextPow2(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar to the next power of two that is at least MinSize.
LegalizeMutation changeTo(unsigned TypeIdx, LLT Ty)
Select this specific type for the given type index.
void apply(Opt *O, const Mod &M, const Mods &... Ms)
LegalityPredicate atomicOrderingAtLeastOrStrongerThan(unsigned MMOIdx, AtomicOrdering Ordering)
True iff the specified MMO index has at an atomic ordering of at Ordering or stronger.
This operation is completely unsupported on the target.
LLT getElementType() const
Returns the vector's element type. Only valid for vector types.
AtomicOrdering
Atomic ordering for LLVM's memory model.
LegalityPredicate typePairAndMemSizeInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx, std::initializer_list< TypePairAndMemSize > TypesAndMemSizeInit)
True iff the given types for the given pair of type indexes is one of the specified type pairs...
LegalizeRuleSet & customForCartesianProduct(std::initializer_list< LLT > Types)
LegalizeRuleSet & customForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
LegalizeRuleSet & libcallIf(LegalityPredicate Predicate)
Like legalIf, but for the Libcall action.
LegalizeRuleSet & legalFor(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.
InstrAspect(unsigned Opcode, LLT Type)
The (vector) operation should be implemented by widening the input vector and ignoring the lanes adde...
LegalityPredicate numElementsNotPow2(unsigned TypeIdx)
True iff the specified type index is a vector whose element count is not a power of 2...
LegalizeRuleSet & clampMaxNumElements(unsigned TypeIdx, const LLT &EltTy, unsigned MaxElements)
Limit the number of elements in EltTy vectors to at most MaxElements.
LegalizeRuleSet & clampMinNumElements(unsigned TypeIdx, const LLT &EltTy, unsigned MinElements)
Limit the number of elements in EltTy vectors to at least MinElements.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LegalizeRuleSet & libcallForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
bool operator==(const LegalizeActionStep &RHS) const
LegalizeRuleSet & legalForTypesWithMemSize(std::initializer_list< LegalityPredicates::TypePairAndMemSize > TypesAndMemSize)
The instruction is legal when type indexes 0 and 1 along with the memory size is any type and size tu...
The operation itself must be expressed in terms of simpler actions on this target.
LegalizeRuleSet & legalIf(LegalityPredicate Predicate)
The instruction is legal if predicate is true.
LegalizeRuleSet & lowerIf(LegalityPredicate Predicate)
The instruction is lowered if predicate is true.
LegalizeRuleSet & lowerForCartesianProduct(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...
Abstract class that contains various methods for clients to notify about changes. ...
unsigned const MachineRegisterInfo * MRI
Sentinel value for when no action was found in the specified table.
LegalityPredicate narrowerThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar that's narrower than the given size.
LegalizeRuleSet & legalForCartesianProduct(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.
LegalizeRuleSet & lowerFor(std::initializer_list< LLT > Types)
The instruction is lowered when type index 0 is any type in the given list.
LegalizeRuleSet & libcallFor(std::initializer_list< LLT > Types)
Helper class to build MachineInstr.
Interface to description of machine instruction set.
LegalizeRuleSet & clampNumElements(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...
LegalityPredicate memSizeInBytesNotPow2(unsigned MMOIdx)
True iff the specified MMO index has a size that is not a power of 2.
LegalizeRuleSet & unsupportedIf(LegalityPredicate Predicate)
LegalizeRuleSet & maxScalar(unsigned TypeIdx, const LLT &Ty)
Ensure the scalar is at most as wide as Ty.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
LegalizeRuleSet & clampScalar(unsigned TypeIdx, const LLT &MinTy, const LLT &MaxTy)
Limit the range of scalar sizes to MinTy and MaxTy.
LegalizeRuleSet & customIf(LegalityPredicate Predicate)
std::function< std::pair< unsigned, LLT >(const LegalityQuery &)> LegalizeMutation
Legalization is decided based on an instruction's opcode, which type slot we're considering, and what the existing type is.
LegalizeActionStep(LegalizeAction Action, unsigned TypeIdx, const LLT &NewType)
LegalizeRuleSet & minScalar(unsigned TypeIdx, const LLT &Ty)
Ensure the scalar is at least as wide as Ty.
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
cl::opt< bool > DisableGISelLegalityCheck
LegalizeRuleSet & unsupportedIfMemSizeNotPow2()
bool verify(const TargetRegisterInfo &TRI) const
Check that information hold by this instance make sense for the given TRI.
LegalizeRuleSet & customFor(std::initializer_list< LLT > Types)
static SizeAndActionsVec narrowToSmallerAndWidenToSmallest(const SizeAndActionsVec &v)
const MachineInstr * machineFunctionIsIllegal(const MachineFunction &MF)
Checks that MIR is fully legal, returns an illegal instruction if it's not, nullptr otherwise...
void setLegalizeVectorElementToDifferentSizeStrategy(const unsigned Opcode, const unsigned TypeIdx, SizeChangeStrategy S)
See also setLegalizeScalarToDifferentSizeStrategy.
LegalizeMutation changeTo(unsigned TypeIdx, unsigned FromTypeIdx)
Keep the same type as the given type index.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
LegalizeRuleSet & libcallFor(std::initializer_list< std::pair< LLT, LLT >> Types)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
LegalizeRuleSet & minScalarSameAs(unsigned TypeIdx, unsigned LargeTypeIdx)
Widen the scalar to match the size of another.
Predicate
Predicate - These are "(BI << 5) | BO" for various predicates.
The operation should be implemented as a call to some kind of runtime support library.
unsigned getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
LegalizeRuleSet & unsupported()
The instruction is unsupported.
The target wants to do something special with this combination of operand and type.
LegalityPredicate isScalar(unsigned TypeIdx)
True iff the specified type index is a scalar.
LegalizeRuleSet & lowerFor(std::initializer_list< LLT > Types, LegalizeMutation Mutation)
The instruction is lowered when type index 0 is any type in the given list.
LegalizeRuleSet & lowerFor(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...
LegalizeRule(LegalityPredicate Predicate, LegalizeAction Action, LegalizeMutation Mutation=nullptr)
LegalizeRuleSet & moreElementsIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Add more elements to reach the type selected by the mutation if the predicate is true.
A single rule in a legalizer info ruleset.
bool operator==(const TypePairAndMemSize &Other) const
LegalizeRuleSet & fewerElementsIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Remove elements to reach the type selected by the mutation if the predicate is true.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
LegalizeRuleSet & legalFor(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list.
Representation of each machine instruction.
LegalizeAction Action
The action to take or the final answer.
static bool needsLegalizingToDifferentSize(const LegalizeAction Action)
Fall back onto the old rules.
LegalizeRuleSet & fallback()
Fallback on the previous implementation.
static SizeAndActionsVec widenToLargerTypesAndNarrowToLargest(const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular operation consists of wi...
static SizeAndActionsVec moreToWiderTypesAndLessToWidest(const SizeAndActionsVec &v)
A SizeChangeStrategy for the common case where legalization for a particular vector operation consist...
LegalizeRuleSet & lowerFor(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...
LegalizeRuleSet & lower()
The instruction is lowered.
LLVM_NODISCARD bool empty() const
void aliasTo(unsigned Opcode)
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 typ...
LegalityPredicate typeInSet(unsigned TypeIdx, std::initializer_list< LLT > TypesInit)
True iff the given type index is one of the specified types.
static void Query(const MachineInstr &MI, AliasAnalysis &AA, bool &Read, bool &Write, bool &Effects, bool &StackPointer)
LegalizeMutation moreElementsToNextPow2(unsigned TypeIdx, unsigned Min=0)
Add more elements to the type for the given type index to the next power of.
LegalizeRuleSet & widenScalarIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Widen the scalar to the one selected by the mutation if the predicate is true.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LegalizeRuleSet & maxScalarIf(LegalityPredicate Predicate, unsigned TypeIdx, const LLT &Ty)
Conditionally limit the maximum size of the scalar.
LegalizeRuleSet & moreElementsToNextPow2(unsigned TypeIdx)
Add more elements to the vector to reach the next power of two.
uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
bool operator==(const InstrAspect &RHS) const
This class implements an extremely fast bulk output stream that can only output to a stream...
std::function< bool(const LegalityQuery &)> LegalityPredicate
void setIsAliasedByAnother()
static LLT vector(uint16_t NumElements, unsigned ScalarSizeInBits)
Get a low-level vector of some number of elements and element width.
ArrayRef< MemDesc > MMODescrs
Operations which require memory can use this to place requirements on the memory type for each MMO...
std::pair< unsigned, LLT > determineMutation(const LegalityQuery &Query) const
Determine the change to make.
void setAction(const InstrAspect &Aspect, LegalizeAction Action)
More friendly way to set an action for common types that have an LLT representation.
The operation is expected to be selectable directly by the target, and no transformation is necessary...
LegalityPredicate sizeNotPow2(unsigned TypeIdx)
True iff the specified type index is a scalar whose size is not a power of.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
std::pair< uint16_t, LegalizeAction > SizeAndAction
LegalizeRuleSet & lowerForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
The instruction is lowered when when type indexes 0, 1, and 2 are all in their respective lists...
LegalizeRuleSet & narrowScalarIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Narrow the scalar to the one selected by the mutation if the predicate is true.
LegalityPredicate widerThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar that's wider than the given size.