Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions llvm/include/llvm/Analysis/HashRecognize.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ using ErrBits = std::tuple<KnownBits, unsigned, bool>;

/// A custom std::array with 256 entries, that also has a print function.
struct CRCTable : public std::array<APInt, 256> {
void print(raw_ostream &OS) const;
LLVM_DUMP_METHOD void print(raw_ostream &OS) const;

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const;
#endif
};

/// The structure that is returned when a polynomial algorithm was recognized by
Expand Down Expand Up @@ -87,7 +91,11 @@ class HashRecognize {
// and return a 256-entry CRC table.
CRCTable genSarwateTable(const APInt &GenPoly, bool ByteOrderSwapped) const;

void print(raw_ostream &OS) const;
LLVM_DUMP_METHOD void print(raw_ostream &OS) const;

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const;
#endif
};

class HashRecognizePrinterPass
Expand Down
16 changes: 14 additions & 2 deletions llvm/lib/Analysis/HashRecognize.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===- HashRecognize.h ------------------------------------------*- C++ -*-===//
//===- HashRecognize.cpp ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down Expand Up @@ -274,7 +274,7 @@ struct RecurrenceInfo {
RecurrenceInfo(const Loop &L) : L(L) {}
operator bool() const { return BO; }

void print(raw_ostream &OS, unsigned Indent) const {
LLVM_DUMP_METHOD void print(raw_ostream &OS, unsigned Indent = 0) const {
OS.indent(Indent) << "Phi: ";
Phi->print(OS);
OS << "\n";
Expand All @@ -294,6 +294,10 @@ struct RecurrenceInfo {
}
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const { print(dbgs()); }
#endif

bool matchSimpleRecurrence(const PHINode *P);
bool matchConditionalRecurrence(
const PHINode *P,
Expand Down Expand Up @@ -628,6 +632,10 @@ void CRCTable::print(raw_ostream &OS) const {
}
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void CRCTable::dump() const { print(dbgs()); }
#endif

void HashRecognize::print(raw_ostream &OS) const {
if (!L.isInnermost())
return;
Expand Down Expand Up @@ -671,6 +679,10 @@ void HashRecognize::print(raw_ostream &OS) const {
genSarwateTable(Info.RHS, Info.ByteOrderSwapped).print(OS);
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void HashRecognize::dump() const { print(dbgs()); }
#endif

HashRecognize::HashRecognize(const Loop &L, ScalarEvolution &SE)
: L(L), SE(SE) {}

Expand Down
Loading