9#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUREGBANKLEGALIZERULES_H
10#define LLVM_LIB_TARGET_AMDGPU_AMDGPUREGBANKLEGALIZERULES_H
19class MachineRegisterInfo;
23template <
typename T>
class GenericUniformityInfo;
24template <
typename T>
class GenericSSAContext;
31bool isAnyPtr(LLT Ty,
unsigned Width);
238 std::initializer_list<RegBankLLTMappingApplyID> DstOpMappingList,
239 std::initializer_list<RegBankLLTMappingApplyID> SrcOpMappingList,
247 std::initializer_list<UniformityLLTOpPredicateID> OpList,
269#define InvMapping RegBankLLTMapping({InvalidMapping}, {InvalidMapping})
277 const RegBankLLTMapping &
281 void addRule(RegBankLegalizeRule Rule);
284 RegBankLLTMapping RuleApplyIDs);
286 RegBankLLTMapping RuleApplyIDs);
305 class RuleSetInitializer {
311 template <
class AliasMap,
class RulesMap>
312 RuleSetInitializer(std::initializer_list<unsigned> OpcList,
313 AliasMap &RulesAlias, RulesMap &Rules,
315 unsigned KeyOpcode = *OpcList.begin();
316 for (
unsigned Opc : OpcList) {
317 [[maybe_unused]]
auto [
_, NewInput] =
318 RulesAlias.try_emplace(
Opc, KeyOpcode);
319 assert(NewInput &&
"Can't redefine existing Rules");
322 auto [DenseMapIter, NewInput] = Rules.try_emplace(KeyOpcode, FastTypes);
323 assert(NewInput &&
"Can't redefine existing Rules");
325 RuleSet = &DenseMapIter->second;
328 RuleSetInitializer(
const RuleSetInitializer &) =
delete;
329 RuleSetInitializer &operator=(
const RuleSetInitializer &) =
delete;
330 RuleSetInitializer(RuleSetInitializer &&) =
delete;
331 RuleSetInitializer &operator=(RuleSetInitializer &&) =
delete;
332 ~RuleSetInitializer() =
default;
336 bool STPred =
true) {
344 bool STPred =
true) {
357 RuleSetInitializer addRulesForGOpcs(std::initializer_list<unsigned> OpcList,
360 RuleSetInitializer addRulesForIOpcs(std::initializer_list<unsigned> OpcList,
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
This file defines the SmallVector class.
const SetOfRulesForOpcode & getRulesForOpc(MachineInstr &MI) const
void refreshRefs(const GCNSubtarget &_ST, MachineRegisterInfo &_MRI)
void addRule(RegBankLegalizeRule Rule)
const RegBankLLTMapping & findMappingForMI(const MachineInstr &MI, const MachineRegisterInfo &MRI, const MachineUniformityInfo &MUI) const
void addFastRuleDivergent(UniformityLLTOpPredicateID Ty, RegBankLLTMapping RuleApplyIDs)
void addFastRuleUniform(UniformityLLTOpPredicateID Ty, RegBankLLTMapping RuleApplyIDs)
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
bool isAnyPtr(LLT Ty, unsigned Width)
UniformityLLTOpPredicateID
This is an optimization pass for GlobalISel generic memory operations.
GenericSSAContext< MachineFunction > MachineSSAContext
GenericUniformityInfo< MachineSSAContext > MachineUniformityInfo
SmallVector< UniformityLLTOpPredicateID, 4 > OpUniformityAndTypes
bool match(const MachineInstr &MI, const MachineUniformityInfo &MUI, const MachineRegisterInfo &MRI) const
std::function< bool(const MachineInstr &)> TestFunc
LoweringMethodID LoweringMethod
SmallVector< RegBankLLTMappingApplyID, 2 > DstOpMapping
SmallVector< RegBankLLTMappingApplyID, 4 > SrcOpMapping
PredicateMapping Predicate
RegBankLLTMapping OperandMapping