mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 01:15:32 +00:00
If the basic block has no name, make sure to print the % number of it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
002362c837
commit
a75b3ef9a8
@ -21,6 +21,7 @@
|
|||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/iTerminators.h"
|
#include "llvm/iTerminators.h"
|
||||||
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -39,9 +40,14 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
|
|||||||
|
|
||||||
static std::string getNodeLabel(const BasicBlock *Node,
|
static std::string getNodeLabel(const BasicBlock *Node,
|
||||||
const Function *Graph) {
|
const Function *Graph) {
|
||||||
if (CFGOnly) return Node->getName() + ":";
|
if (CFGOnly && !Node->getName().empty()) return Node->getName() + ":";
|
||||||
|
|
||||||
std::ostringstream Out;
|
std::ostringstream Out;
|
||||||
|
if (CFGOnly) {
|
||||||
|
WriteAsOperand(Out, Node, false, true);
|
||||||
|
return Out.str();
|
||||||
|
}
|
||||||
|
|
||||||
Out << *Node;
|
Out << *Node;
|
||||||
std::string OutStr = Out.str();
|
std::string OutStr = Out.str();
|
||||||
if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
|
if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user