[llvm-commits] [llvm] r86747 - /llvm/trunk/include/llvm/Analysis/CFGPrinter.h
Chris Lattner
sabre at nondot.org
Tue Nov 10 14:56:15 PST 2009
Author: lattner
Date: Tue Nov 10 16:56:15 2009
New Revision: 86747
URL: http://llvm.org/viewvc/llvm-project?rev=86747&view=rev
Log:
in -dot-cfg and -dot-cfg-only, when rendering switch instructions,
put the switch value in the successor boxes like we put T/F for branches.
Modified:
llvm/trunk/include/llvm/Analysis/CFGPrinter.h
Modified: llvm/trunk/include/llvm/Analysis/CFGPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CFGPrinter.h?rev=86747&r1=86746&r2=86747&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CFGPrinter.h (original)
+++ llvm/trunk/include/llvm/Analysis/CFGPrinter.h Tue Nov 10 16:56:15 2009
@@ -71,6 +71,18 @@
if (const BranchInst *BI = dyn_cast<BranchInst>(Node->getTerminator()))
if (BI->isConditional())
return (I == succ_begin(Node)) ? "T" : "F";
+
+ // Label source of conditional branches with "T" or "F"
+ if (const SwitchInst *SI = dyn_cast<SwitchInst>(Node->getTerminator())) {
+ unsigned SuccNo = I.getSuccessorIndex();
+
+ if (SuccNo == 0) return "def";
+
+ std::string Str;
+ raw_string_ostream OS(Str);
+ OS << SI->getCaseValue(SuccNo)->getValue();
+ return OS.str();
+ }
return "";
}
};
More information about the llvm-commits
mailing list