27 for (
const auto & tac : tacs)
30 return "[" + str +
"]";
36 const auto & node = *util::assertedCast<const FunctionNode>(&clg_node);
38 const auto & fcttype = node.fcttype();
41 std::string results(
"<");
42 for (
size_t n = 0; n < fcttype.NumResults(); n++)
44 results += fcttype.ResultType(n).debug_string();
45 if (n != fcttype.NumResults() - 1)
52 for (
size_t n = 0; n < fcttype.NumArguments(); n++)
54 operands += fcttype.ArgumentType(n).debug_string();
55 if (n != fcttype.NumArguments() - 1)
63 return exported + results +
" " + node.name() +
" " +
operands +
"\n{\n" + cfg +
"\n}\n";
69 const auto & node = *util::assertedCast<const DataNode>(&clg_node);
70 auto init = node.initialization();
72 std::string str = node.name();
88 for (
const auto & node : clg)
90 JLM_ASSERT(map.find(
typeid(node)) != map.end());
91 str += map[
typeid(node)](node) +
"\n";
99 static inline std::string
103 const auto en =
static_cast<const EntryNode *
>(&node);
106 for (
size_t n = 0; n < en->narguments(); n++)
109 str +=
"<" + argument->
type().
debug_string() +
"> " + argument->name() +
"\\n";
115 static inline std::string
119 const auto xn =
static_cast<const ExitNode *
>(&node);
122 for (
size_t n = 0; n < xn->nresults(); n++)
124 auto result = xn->
result(n);
131 static inline std::string
135 auto & tacs =
static_cast<const BasicBlock *
>(&node)->tacs();
138 for (
const auto & tac : tacs)
144 static inline std::string
147 if (is<EntryNode>(&node))
150 if (is<ExitNode>(&node))
156 static inline std::string
164 JLM_ASSERT(map.find(
typeid(node)) != map.end());
165 std::string body = map[
typeid(node)](node);
173 auto entry = cfg.
entry();
174 auto exit = cfg.
exit();
176 std::string dot(
"digraph cfg {\n");
182 "[shape=box, label = \"",
188 (intptr_t)entry->OutEdge(0)->sink(),
195 "[shape=box, label = \"",
199 for (
const auto & node : cfg)
203 for (
auto & edge : node.OutEdges())
205 dot +=
util::strfmt((intptr_t)edge.source(),
" -> ", (intptr_t)edge.sink());
206 dot +=
util::strfmt(
"[label = \"", edge.index(),
"\"];\n");
217 std::string dot(
"digraph clg {\n");
218 for (
const auto & node : clg)
221 dot +=
util::strfmt(
"[label = \"", node.name(),
"\"];\n");
223 for (
const auto & call : node)
224 dot +=
util::strfmt((intptr_t)&node,
" -> ", (intptr_t)call,
";\n");
239 std::string subtree(depth,
'-');
245 for (
const auto & child : n)
246 subtree += f(child, depth + 1);
257 fputs(
to_str(n, dm).c_str(), out);
virtual std::string debug_string() const =0
T & Lookup(const AggregationNode &aggregationNode) const noexcept
bool Contains(const AggregationNode &aggregationNode) const noexcept
static std::string ToAscii(const ControlFlowGraph &controlFlowGraph)
EntryNode * entry() const noexcept
ExitNode * exit() const noexcept
const llvm::Argument * argument(size_t index) const
const Variable * result(size_t index) const
static std::string ToAscii(const ThreeAddressCode &threeAddressCode)
const jlm::rvsdg::Type & type() const noexcept
virtual std::string debug_string() const =0
Global memory state passed between functions.
static std::string emit_entry_dot(const ControlFlowGraphNode &node)
std::string to_dot(const ControlFlowGraph &cfg)
static std::string emit_data_node(const InterProceduralGraphNode &clg_node)
static std::string emit_tacs(const tacsvector_t &tacs)
std::vector< std::unique_ptr< llvm::ThreeAddressCode > > tacsvector_t
void print(const AggregationNode &n, const AnnotationMap &dm, FILE *out)
static std::string emit_exit_dot(const ControlFlowGraphNode &node)
bool isPrivateOrInternal(const Linkage linkage)
static std::string emit_header(const ControlFlowGraphNode &node)
static std::string emit_basic_block(const ControlFlowGraphNode &node)
std::string to_str(const InterProceduralGraph &clg)
static std::string emit_node(const ControlFlowGraphNode &node)
static std::string emit_function_node(const InterProceduralGraphNode &clg_node)
static std::vector< jlm::rvsdg::Output * > operands(const Node *node)
static std::string strfmt(Args... args)