[Analysis] Make LocationSize pretty-printing more descriptive
This is the third patch in a series intended to make
https://reviews.llvm.org/D44748 more easily reviewable. Please see that
patch for more context. The second being r344013.
The intent is to make the output of printing a LocationSize more
precise. The main motivation for this is that we plan to add a bit to
distinguish whether a given LocationSize is an upper-bound or is
precise; making that information available in pretty-printing is nice.
llvm-svn: 344108
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index 326944f..df863d6 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -18,6 +18,18 @@
#include "llvm/IR/Type.h"
using namespace llvm;
+void LocationSize::print(raw_ostream &OS) const {
+ OS << "LocationSize::";
+ if (*this == unknown())
+ OS << "unknown";
+ else if (*this == mapEmpty())
+ OS << "mapEmpty";
+ else if (*this == mapTombstone())
+ OS << "mapTombstone";
+ else
+ OS << "precise(" << getValue() << ')';
+}
+
MemoryLocation MemoryLocation::get(const LoadInst *LI) {
AAMDNodes AATags;
LI->getAAMetadata(AATags);