summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2015-07-23 22:25:26 +0000
committerPhilip Reames <listmail@philipreames.com>2015-07-23 22:25:26 +0000
commit2a892a630bd0846cfa94b89e562ab15f91ed36a0 (patch)
treedfa4bb1f75216cdfa27edbf6c22e13b19e9dd909 /llvm/lib
parentfe563d5573d17da446f3c848d8d6e1b2155658dd (diff)
downloadbcm5719-llvm-2a892a630bd0846cfa94b89e562ab15f91ed36a0.tar.gz
bcm5719-llvm-2a892a630bd0846cfa94b89e562ab15f91ed36a0.zip
[RewriteStatepointsForGC] Use idomatic mechanisms for debug tracing [NFC]
Deleting much of the code using trace-rewrite-statepoints and use idiomatic DEBUG statements instead. This includes adding operator<< to a helper class. llvm-svn: 243054
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
index f704389a8b0..a133f01a55f 100644
--- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
+++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
@@ -546,13 +546,10 @@ static Value *findBaseDefiningValueCached(Value *I, DefiningValueMapTy &Cache) {
Value *&Cached = Cache[I];
if (!Cached) {
Cached = findBaseDefiningValue(I);
+ DEBUG(dbgs() << "fBDV-cached: " << I->getName() << " -> "
+ << Cached->getName() << "\n");
}
assert(Cache[I] != nullptr);
-
- if (TraceLSP) {
- dbgs() << "fBDV-cached: " << I->getName() << " -> " << Cached->getName()
- << "\n";
- }
return Cached;
}
@@ -612,9 +609,12 @@ public:
bool operator!=(const PhiState &other) const { return !(*this == other); }
- void dump() {
- errs() << status << " (" << base << " - "
- << (base ? base->getName() : "nullptr") << "): ";
+ LLVM_DUMP_METHOD
+ void dump() const { print(dbgs()); dbgs() << '\n'; }
+
+ void print(raw_ostream &OS) const {
+ OS << status << " (" << base << " - "
+ << (base ? base->getName() : "nullptr") << "): ";
}
private:
@@ -622,6 +622,12 @@ private:
Value *base; // non null only if status == base
};
+inline raw_ostream &operator<<(raw_ostream &OS, const PhiState &State) {
+ State.print(OS);
+ return OS;
+}
+
+
typedef DenseMap<Value *, PhiState> ConflictStateMapTy;
// Values of type PhiState form a lattice, and this is a helper
// class that implementes the meet operation. The meat of the meet
@@ -646,7 +652,10 @@ private:
static PhiState meet(PhiState LHS, PhiState RHS) {
assert((pureMeet(LHS, RHS) == pureMeet(RHS, LHS)) &&
"math is wrong: meet does not commute!");
- return pureMeet(LHS, RHS);
+ PhiState Result = pureMeet(LHS, RHS);
+ DEBUG(dbgs() << "meet of " << LHS << " with " << RHS
+ << " produced " << Result << "\n");
+ return Result;
}
static PhiState pureMeet(const PhiState &stateA, const PhiState &stateB) {
@@ -754,12 +763,8 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &cache) {
if (TraceLSP) {
errs() << "States after initialization:\n";
- for (auto Pair : states) {
- Instruction *v = cast<Instruction>(Pair.first);
- PhiState state = Pair.second;
- state.dump();
- v->dump();
- }
+ for (auto Pair : states)
+ dbgs() << " " << Pair.second << " for " << Pair.first << "\n";
}
// TODO: come back and revisit the state transitions around inputs which
@@ -815,12 +820,8 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &cache) {
if (TraceLSP) {
errs() << "States after meet iteration:\n";
- for (auto Pair : states) {
- Instruction *v = cast<Instruction>(Pair.first);
- PhiState state = Pair.second;
- state.dump();
- v->dump();
- }
+ for (auto Pair : states)
+ dbgs() << " " << Pair.second << " for " << Pair.first << "\n";
}
// Insert Phis for all conflicts
OpenPOWER on IntegriCloud