[llvm-branch-commits] [llvm] d93b8ac - [BasicAA] Add print routines to DecomposedGEP for ease of debugging
Philip Reames via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 3 12:48:41 PST 2020
Author: Philip Reames
Date: 2020-12-03T12:43:39-08:00
New Revision: d93b8acd0949f65de5e7360c79f04a98a66cbd9d
URL: https://github.com/llvm/llvm-project/commit/d93b8acd0949f65de5e7360c79f04a98a66cbd9d
DIFF: https://github.com/llvm/llvm-project/commit/d93b8acd0949f65de5e7360c79f04a98a66cbd9d.diff
LOG: [BasicAA] Add print routines to DecomposedGEP for ease of debugging
Added:
Modified:
llvm/include/llvm/Analysis/BasicAliasAnalysis.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
index 7f3cbba0b6af..e59fd6919f66 100644
--- a/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/BasicAliasAnalysis.h
@@ -126,6 +126,14 @@ class BasicAAResult : public AAResultBase<BasicAAResult> {
bool operator!=(const VariableGEPIndex &Other) const {
return !operator==(Other);
}
+
+ void dump() const { print(dbgs()); }
+ void print(raw_ostream &OS) const {
+ OS << "(V=" << V->getName()
+ << ", zextbits=" << ZExtBits
+ << ", sextbits=" << SExtBits
+ << ", scale=" << Scale << ")";
+ }
};
// Represents the internal structure of a GEP, decomposed into a base pointer,
@@ -139,6 +147,20 @@ class BasicAAResult : public AAResultBase<BasicAAResult> {
SmallVector<VariableGEPIndex, 4> VarIndices;
// Is GEP index scale compile-time constant.
bool HasCompileTimeConstantScale;
+
+ void dump() const { print(dbgs()); }
+ void print(raw_ostream &OS) const {
+ OS << "(DecomposedGEP Base=" << Base->getName()
+ << ", Offset=" << Offset
+ << ", VarIndices=[" << Offset;
+ for (size_t i = 0; i < VarIndices.size(); i++) {
+ if (i != 0)
+ OS << ", ";
+ VarIndices[i].print(OS);
+ }
+ OS << "], HasCompileTimeConstantScale=" << HasCompileTimeConstantScale
+ << ")";
+ }
};
/// Tracks phi nodes we have visited.
More information about the llvm-branch-commits
mailing list