LLVM 22.0.0git
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 106 of file HashRecognize.cpp.

Constructor & Destructor Documentation

◆ RecurrenceInfo()

RecurrenceInfo::RecurrenceInfo ( const Loop & L)
inline

Definition at line 114 of file HashRecognize.cpp.

References L.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void RecurrenceInfo::dump ( ) const
inline

Definition at line 138 of file HashRecognize.cpp.

References llvm::dbgs(), LLVM_DUMP_METHOD, 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 283 of file HashRecognize.cpp.

References BO, llvm::dbgs(), ExtraConst, 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 223 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 115 of file HashRecognize.cpp.

References BO.

◆ print()

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

Definition at line 117 of file HashRecognize.cpp.

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

Referenced by dump().

Member Data Documentation

◆ BO

◆ ExtraConst

std::optional<APInt> RecurrenceInfo::ExtraConst

◆ L

const Loop& RecurrenceInfo::L

Definition at line 107 of file HashRecognize.cpp.

Referenced by RecurrenceInfo().

◆ Phi

const PHINode* RecurrenceInfo::Phi = nullptr

◆ Start

Value* RecurrenceInfo::Start = nullptr

Definition at line 110 of file HashRecognize.cpp.

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

◆ Step

Value* RecurrenceInfo::Step = nullptr

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