diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-10 22:56:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-10 22:56:15 +0000 |
commit | 0a26870d921c4f5507126f3068fc13148c426496 (patch) | |
tree | f709ab7d396fc25f1d6345ac241eca7f92a6bb2d /include | |
parent | 055d046f483af3c66f4d19a32a17fc63ed2c22d5 (diff) | |
download | external_llvm-0a26870d921c4f5507126f3068fc13148c426496.zip external_llvm-0a26870d921c4f5507126f3068fc13148c426496.tar.gz external_llvm-0a26870d921c4f5507126f3068fc13148c426496.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/CFGPrinter.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index 435f8ea..bee2c5b 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -71,6 +71,18 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits { 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 ""; } }; |