LLVM 22.0.0git
Public Member Functions | Public Attributes | List of all members
RecurrenceInfo Struct Reference

A structure that can hold either a Simple Recurrence or a Conditional Recurrence. More...

Public Member Functions

 RecurrenceInfo (const Loop &L)
 
 operator bool () const
 
void print (raw_ostream &OS, unsigned Indent=0) const
 
LLVM_DUMP_METHOD void dump () const
 
bool matchSimpleRecurrence (const PHINode *P)
 Wraps llvm::matchSimpleRecurrence.
 
bool matchConditionalRecurrence (const PHINode *P, Instruction::BinaryOps BOWithConstOpToMatch=Instruction::BinaryOpsEnd)
 A Conditional Recurrence is a recurrence of the form:
 

Public Attributes

const LoopL
 
const PHINodePhi = nullptr
 
BinaryOperatorBO = nullptr
 
ValueStart = nullptr
 
ValueStep = nullptr
 
std::optional< APIntExtraConst
 

Detailed Description

A structure that can hold either a Simple Recurrence or a Conditional Recurrence.

Note that in the case of a Simple Recurrence, Step is an operand of the BO, while in a Conditional Recurrence, it is a SelectInst.

Definition at line 277 of file HashRecognize.cpp.

Constructor & Destructor Documentation

◆ RecurrenceInfo()

RecurrenceInfo::RecurrenceInfo ( const Loop L)
inline

Definition at line 285 of file HashRecognize.cpp.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void RecurrenceInfo::dump ( ) const
inline

Definition at line 309 of file HashRecognize.cpp.

References llvm::dbgs(), and print().

◆ matchConditionalRecurrence()

bool RecurrenceInfo::matchConditionalRecurrence ( const PHINode P,
Instruction::BinaryOps  BOWithConstOpToMatch = Instruction::BinaryOpsEnd 
)

A Conditional Recurrence is a recurrence of the form:

loop: rec = phi [start, entry], [step, loop] ... step = select _, tv, fv

where tv and fv ultimately end up using rec via the same BO instruction, after digging through the use-def chain.

ExtraConst is relevant if BOWithConstOpToMatch is supplied: when digging the use-def chain, a BinOp with opcode BOWithConstOpToMatch is matched, and ExtraConst is a constant operand of that BinOp. This peculiarity exists, because in a CRC algorithm, the BOWithConstOpToMatch is an XOR, and the ExtraConst ends up being the generating polynomial.

Definition at line 395 of file HashRecognize.cpp.

References BO, llvm::dbgs(), ExtraConst, llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), Idx, LLVM_DEBUG, llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_Select(), llvm::SCEVPatternMatch::match(), P, Phi, Start, and Step.

Referenced by getRecurrences().

◆ matchSimpleRecurrence()

bool RecurrenceInfo::matchSimpleRecurrence ( const PHINode P)

Wraps llvm::matchSimpleRecurrence.

Match a simple first order recurrence cycle of the form:

loop: rec = phi [start, entry], [BO, loop] ... BO = binop rec, step

or

loop: rec = phi [start, entry], [BO, loop] ... BO = binop step, rec

Definition at line 338 of file HashRecognize.cpp.

References BO, llvm::matchSimpleRecurrence(), P, Phi, Start, and Step.

Referenced by getRecurrences().

◆ operator bool()

RecurrenceInfo::operator bool ( ) const
inline

Definition at line 286 of file HashRecognize.cpp.

References BO.

◆ print()

void RecurrenceInfo::print ( raw_ostream OS,
unsigned  Indent = 0 
) const
inline

Definition at line 288 of file HashRecognize.cpp.

References BO, ExtraConst, llvm::raw_ostream::indent(), OS, Phi, llvm::Value::print(), Start, and Step.

Referenced by dump().

Member Data Documentation

◆ BO

BinaryOperator* RecurrenceInfo::BO = nullptr

◆ ExtraConst

std::optional<APInt> RecurrenceInfo::ExtraConst

Definition at line 283 of file HashRecognize.cpp.

Referenced by matchConditionalRecurrence(), and print().

◆ L

const Loop& RecurrenceInfo::L

Definition at line 278 of file HashRecognize.cpp.

◆ Phi

const PHINode* RecurrenceInfo::Phi = nullptr

Definition at line 279 of file HashRecognize.cpp.

Referenced by matchConditionalRecurrence(), matchSimpleRecurrence(), and print().

◆ Start

Value* RecurrenceInfo::Start = nullptr

Definition at line 281 of file HashRecognize.cpp.

Referenced by matchConditionalRecurrence(), matchSimpleRecurrence(), and print().

◆ Step

Value* RecurrenceInfo::Step = nullptr

Definition at line 282 of file HashRecognize.cpp.

Referenced by matchConditionalRecurrence(), matchSimpleRecurrence(), and print().


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