LLVM 17.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::GenericUniformityAnalysisImpl< ContextT > Class Template Reference

Analysis that identifies uniform values in a data-parallel execution. More...

#include "llvm/ADT/GenericUniformityImpl.h"

Collaboration diagram for llvm::GenericUniformityAnalysisImpl< ContextT >:
Collaboration graph
[legend]

Classes

struct  PhiInput
 Value/block pair representing a single phi input. More...
 

Public Types

using BlockT = typename ContextT::BlockT
 
using FunctionT = typename ContextT::FunctionT
 
using ValueRefT = typename ContextT::ValueRefT
 
using ConstValueRefT = typename ContextT::ConstValueRefT
 
using UseT = typename ContextT::UseT
 
using InstructionT = typename ContextT::InstructionT
 
using DominatorTreeT = typename ContextT::DominatorTreeT
 
using CycleInfoT = GenericCycleInfo< ContextT >
 
using CycleT = typename CycleInfoT::CycleT
 
using SyncDependenceAnalysisT = GenericSyncDependenceAnalysis< ContextT >
 
using DivergenceDescriptorT = typename SyncDependenceAnalysisT::DivergenceDescriptor
 
using BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap
 

Public Member Functions

 GenericUniformityAnalysisImpl (const FunctionT &F, const DominatorTreeT &DT, const CycleInfoT &CI, const TargetTransformInfo *TTI)
 
void initialize ()
 
const FunctionTgetFunction () const
 
void addUniformOverride (const InstructionT &Instr)
 Mark UniVal as a value that is always uniform.
 
bool markDivergent (const InstructionT &I)
 Mark DivVal as a value that is always divergent.
 
bool markDivergent (ConstValueRefT DivVal)
 
bool markDefsDivergent (const InstructionT &Instr, bool AllDefsDivergent=true)
 
void compute ()
 Propagate divergence to all instructions in the region.
 
bool hasDivergence () const
 Whether any value was marked or analyzed to be divergent.
 
bool isAlwaysUniform (const InstructionT &Instr) const
 Whether Val will always return a uniform value regardless of its operands.
 
bool hasDivergentDefs (const InstructionT &I) const
 
bool isDivergent (const InstructionT &I) const
 
bool isDivergent (ConstValueRefT V) const
 Whether Val is divergent at its definition.
 
bool isDivergentUse (const UseT &U) const
 
bool hasDivergentTerminator (const BlockT &B) const
 
void print (raw_ostream &out) const
 
bool hasDivergentDefs (const Instruction &I) const
 
bool markDefsDivergent (const Instruction &Instr, bool AllDefsDivergent)
 
void initialize ()
 
bool isDivergentUse (const Use &U) const
 
bool hasDivergentDefs (const MachineInstr &I) const
 
bool markDefsDivergent (const MachineInstr &Instr, bool AllDefsDivergent)
 
void initialize ()
 
bool isDivergentUse (const MachineOperand &U) const
 

Protected Member Functions

void analyzeControlDivergence (const InstructionT &Term)
 Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.
 

Protected Attributes

const ContextT & Context
 
const FunctionTF
 
const CycleInfoTCI
 
const TargetTransformInfoTTI = nullptr
 
std::set< ConstValueRefTDivergentValues
 
SmallPtrSet< const BlockT *, 32 > DivergentTermBlocks
 
std::vector< const InstructionT * > Worklist
 

Detailed Description

template<typename ContextT>
class llvm::GenericUniformityAnalysisImpl< ContextT >

Analysis that identifies uniform values in a data-parallel execution.

This analysis propagates divergence in a data-parallel context from sources of divergence to all users. It can be instantiated for an IR that provides a suitable SSAContext.

Definition at line 327 of file GenericUniformityImpl.h.

Member Typedef Documentation

◆ BlockLabelMapT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockLabelMapT = typename SyncDependenceAnalysisT::BlockLabelMap

Definition at line 343 of file GenericUniformityImpl.h.

◆ BlockT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::BlockT = typename ContextT::BlockT

Definition at line 329 of file GenericUniformityImpl.h.

◆ ConstValueRefT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::ConstValueRefT = typename ContextT::ConstValueRefT

Definition at line 332 of file GenericUniformityImpl.h.

◆ CycleInfoT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleInfoT = GenericCycleInfo<ContextT>

Definition at line 337 of file GenericUniformityImpl.h.

◆ CycleT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::CycleT = typename CycleInfoT::CycleT

Definition at line 338 of file GenericUniformityImpl.h.

◆ DivergenceDescriptorT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::DivergenceDescriptorT = typename SyncDependenceAnalysisT::DivergenceDescriptor

Definition at line 341 of file GenericUniformityImpl.h.

◆ DominatorTreeT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::DominatorTreeT = typename ContextT::DominatorTreeT

Definition at line 335 of file GenericUniformityImpl.h.

◆ FunctionT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::FunctionT = typename ContextT::FunctionT

Definition at line 330 of file GenericUniformityImpl.h.

◆ InstructionT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::InstructionT = typename ContextT::InstructionT

Definition at line 334 of file GenericUniformityImpl.h.

◆ SyncDependenceAnalysisT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::SyncDependenceAnalysisT = GenericSyncDependenceAnalysis<ContextT>

Definition at line 340 of file GenericUniformityImpl.h.

◆ UseT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::UseT = typename ContextT::UseT

Definition at line 333 of file GenericUniformityImpl.h.

◆ ValueRefT

template<typename ContextT >
using llvm::GenericUniformityAnalysisImpl< ContextT >::ValueRefT = typename ContextT::ValueRefT

Definition at line 331 of file GenericUniformityImpl.h.

Constructor & Destructor Documentation

◆ GenericUniformityAnalysisImpl()

template<typename ContextT >
llvm::GenericUniformityAnalysisImpl< ContextT >::GenericUniformityAnalysisImpl ( const FunctionT F,
const DominatorTreeT DT,
const CycleInfoT CI,
const TargetTransformInfo TTI 
)
inline

Definition at line 345 of file GenericUniformityImpl.h.

Member Function Documentation

◆ addUniformOverride()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::addUniformOverride ( const InstructionT Instr)

Mark UniVal as a value that is always uniform.

Definition at line 807 of file GenericUniformityImpl.h.

◆ analyzeControlDivergence()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::analyzeControlDivergence ( const InstructionT Term)
protected

Mark Term as divergent and push all Instructions that become divergent as a result on the worklist.

Definition at line 1112 of file GenericUniformityImpl.h.

References A, assert(), B, llvm::CallingConv::C, Context, llvm::dbgs(), llvm::getOutermostDivergentCycle(), llvm::insertIfNotContained(), LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::sort().

◆ compute()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::compute

Propagate divergence to all instructions in the region.

Divergence is seeded by calls to markDivergent.

Definition at line 1168 of file GenericUniformityImpl.h.

References assert(), Context, llvm::dbgs(), I, and LLVM_DEBUG.

◆ getFunction()

template<typename ContextT >
const FunctionT & llvm::GenericUniformityAnalysisImpl< ContextT >::getFunction ( ) const
inline

◆ hasDivergence()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergence ( ) const
inline

Whether any value was marked or analyzed to be divergent.

Definition at line 370 of file GenericUniformityImpl.h.

References llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues.

◆ hasDivergentDefs() [1/3]

Definition at line 22 of file UniformityAnalysis.cpp.

References I.

◆ hasDivergentDefs() [2/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentDefs ( const InstructionT I) const

◆ hasDivergentDefs() [3/3]

Definition at line 21 of file MachineUniformityAnalysis.cpp.

References I, and op.

◆ hasDivergentTerminator()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::hasDivergentTerminator ( const BlockT B) const
inline

◆ initialize() [1/3]

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::initialize ( )

◆ initialize() [2/3]

◆ initialize() [3/3]

Definition at line 55 of file MachineUniformityAnalysis.cpp.

References block, F, instr, InstrInfo, and uniformity.

◆ isAlwaysUniform()

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isAlwaysUniform ( const InstructionT Instr) const

Whether Val will always return a uniform value regardless of its operands.

Definition at line 1196 of file GenericUniformityImpl.h.

◆ isDivergent() [1/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( const InstructionT I) const
inline

◆ isDivergent() [2/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergent ( ConstValueRefT  V) const
inline

Whether Val is divergent at its definition.

Definition at line 386 of file GenericUniformityImpl.h.

References llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues.

◆ isDivergentUse() [1/3]

Definition at line 117 of file MachineUniformityAnalysis.cpp.

References F.

◆ isDivergentUse() [2/3]

bool llvm::GenericUniformityAnalysisImpl< SSAContext >::isDivergentUse ( const Use U) const

Definition at line 82 of file UniformityAnalysis.cpp.

◆ isDivergentUse() [3/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::isDivergentUse ( const UseT U) const

◆ markDefsDivergent() [1/3]

bool llvm::GenericUniformityAnalysisImpl< SSAContext >::markDefsDivergent ( const Instruction Instr,
bool  AllDefsDivergent 
)

Definition at line 28 of file UniformityAnalysis.cpp.

◆ markDefsDivergent() [2/3]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDefsDivergent ( const InstructionT Instr,
bool  AllDefsDivergent = true 
)

◆ markDefsDivergent() [3/3]

bool llvm::GenericUniformityAnalysisImpl< MachineSSAContext >::markDefsDivergent ( const MachineInstr Instr,
bool  AllDefsDivergent 
)

Definition at line 33 of file MachineUniformityAnalysis.cpp.

References assert(), F, MRI, op, llvm::MachineInstr::operands(), and TRI.

◆ markDivergent() [1/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( const InstructionT I)

Mark DivVal as a value that is always divergent.

Returns
Whether the tracked divergence state of DivVal changed.

Definition at line 779 of file GenericUniformityImpl.h.

References Context, llvm::dbgs(), I, and LLVM_DEBUG.

◆ markDivergent() [2/2]

template<typename ContextT >
bool llvm::GenericUniformityAnalysisImpl< ContextT >::markDivergent ( ConstValueRefT  DivVal)

Definition at line 797 of file GenericUniformityImpl.h.

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

◆ print()

template<typename ContextT >
void llvm::GenericUniformityAnalysisImpl< ContextT >::print ( raw_ostream out) const

Definition at line 1212 of file GenericUniformityImpl.h.

References assert(), block, Context, entry, F, OS, and value.

Member Data Documentation

◆ CI

template<typename ContextT >
const CycleInfoT& llvm::GenericUniformityAnalysisImpl< ContextT >::CI
protected

Definition at line 408 of file GenericUniformityImpl.h.

◆ Context

template<typename ContextT >
const ContextT& llvm::GenericUniformityAnalysisImpl< ContextT >::Context
protected

Definition at line 406 of file GenericUniformityImpl.h.

◆ DivergentTermBlocks

template<typename ContextT >
SmallPtrSet<const BlockT *, 32> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentTermBlocks
protected

◆ DivergentValues

template<typename ContextT >
std::set<ConstValueRefT> llvm::GenericUniformityAnalysisImpl< ContextT >::DivergentValues
protected

◆ F

template<typename ContextT >
const FunctionT& llvm::GenericUniformityAnalysisImpl< ContextT >::F
protected

◆ TTI

template<typename ContextT >
const TargetTransformInfo* llvm::GenericUniformityAnalysisImpl< ContextT >::TTI = nullptr
protected

Definition at line 409 of file GenericUniformityImpl.h.

◆ Worklist

template<typename ContextT >
std::vector<const InstructionT *> llvm::GenericUniformityAnalysisImpl< ContextT >::Worklist
protected

Definition at line 416 of file GenericUniformityImpl.h.


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