mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
bc98e0079f
The new value is 21.
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/Support/DOTGraphTraits.h"
|
|
|
|
#include "revng/ADT/GenericGraph.h"
|
|
#include "revng/Support/MetaAddress.h"
|
|
|
|
namespace efa {
|
|
|
|
struct BasicBlockNodeData {
|
|
BasicBlockNodeData(MetaAddress Address) : Address(Address) {}
|
|
MetaAddress Address;
|
|
};
|
|
using BasicBlockNode = BidirectionalNode<BasicBlockNodeData>;
|
|
using CallGraph = GenericGraph<BasicBlockNode>;
|
|
|
|
} // namespace efa
|
|
|
|
template<>
|
|
struct llvm::DOTGraphTraits<efa::CallGraph *>
|
|
: public llvm::DefaultDOTGraphTraits {
|
|
using EdgeIterator = llvm::GraphTraits<efa::CallGraph *>::ChildIteratorType;
|
|
DOTGraphTraits(bool IsSimple = false) : DefaultDOTGraphTraits(IsSimple) {}
|
|
|
|
static std::string getNodeLabel(const efa::BasicBlockNode *Node,
|
|
const efa::CallGraph *Graph) {
|
|
return Node->Address.toString();
|
|
}
|
|
|
|
static std::string getEdgeAttributes(const efa::BasicBlockNode *Node,
|
|
const EdgeIterator EI,
|
|
const efa::CallGraph *Graph) {
|
|
return "color=black,style=dashed";
|
|
}
|
|
};
|