mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 04:06:44 +00:00
Dumping CFG to .dot: showing indirect jumps with dashed lines
This commit is contained in:
parent
f233122943
commit
f062fd0165
1 changed files with 4 additions and 7 deletions
|
|
@ -935,7 +935,6 @@ void Compiler::dumpBasicBlockGraph(std::ostream& out)
|
||||||
<< " node [shape=record];\n"
|
<< " node [shape=record];\n"
|
||||||
<< " entry [share=record, label=\"entry block\"];\n";
|
<< " entry [share=record, label=\"entry block\"];\n";
|
||||||
|
|
||||||
// std::map<std::string, BasicBlock*> blocksByName;
|
|
||||||
std::vector<BasicBlock*> blocks;
|
std::vector<BasicBlock*> blocks;
|
||||||
for (auto& pair : this->basicBlocks)
|
for (auto& pair : this->basicBlocks)
|
||||||
{
|
{
|
||||||
|
|
@ -948,7 +947,6 @@ void Compiler::dumpBasicBlockGraph(std::ostream& out)
|
||||||
for (auto bb : blocks)
|
for (auto bb : blocks)
|
||||||
{
|
{
|
||||||
std::string blockName = bb->llvm()->getName();
|
std::string blockName = bb->llvm()->getName();
|
||||||
// blocksByName.insert(std::pair<std::string, BasicBlock*>(blockName, bb));
|
|
||||||
|
|
||||||
int numOfPhiNodes = 0;
|
int numOfPhiNodes = 0;
|
||||||
auto firstNonPhiPtr = bb->llvm()->getFirstNonPHI();
|
auto firstNonPhiPtr = bb->llvm()->getFirstNonPHI();
|
||||||
|
|
@ -957,10 +955,8 @@ void Compiler::dumpBasicBlockGraph(std::ostream& out)
|
||||||
auto endStackSize = bb->getStack().size();
|
auto endStackSize = bb->getStack().size();
|
||||||
|
|
||||||
out << " \"" << blockName << "\" [shape=record, label=\""
|
out << " \"" << blockName << "\" [shape=record, label=\""
|
||||||
<< std::to_string(numOfPhiNodes) << "|"
|
<< numOfPhiNodes << "|" << blockName << "|" << endStackSize
|
||||||
<< blockName << "|"
|
<< "\"];\n";
|
||||||
<< std::to_string(endStackSize)
|
|
||||||
<< "\"];\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " entry -> \"Instr.0\";\n";
|
out << " entry -> \"Instr.0\";\n";
|
||||||
|
|
@ -974,7 +970,8 @@ void Compiler::dumpBasicBlockGraph(std::ostream& out)
|
||||||
for (llvm::succ_iterator it = llvm::succ_begin(bb->llvm()); it != end; ++it)
|
for (llvm::succ_iterator it = llvm::succ_begin(bb->llvm()); it != end; ++it)
|
||||||
{
|
{
|
||||||
std::string succName = it->getName();
|
std::string succName = it->getName();
|
||||||
out << " \"" << blockName << "\" -> \"" << succName << "\";\n";
|
out << " \"" << blockName << "\" -> \"" << succName << "\""
|
||||||
|
<< ((bb == m_jumpTableBlock.get()) ? " [style = dashed];\n" : "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue