Jlm
print.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_JLM_LLVM_IR_PRINT_HPP
7 #define JLM_JLM_LLVM_IR_PRINT_HPP
8 
9 /* FIXME: I would rather like to forward declare AnnotationMap and demand_set */
12 
13 #include <string>
14 
15 namespace jlm::llvm
16 {
17 
18 class InterProceduralGraph;
19 class InterProceduralGraphModule;
20 
21 /* inter-procedural graph */
22 
23 std::string
24 to_str(const InterProceduralGraph & ipg);
25 
26 static inline void
27 print_ascii(const InterProceduralGraph & ipg, FILE * out)
28 {
29  fputs(to_str(ipg).c_str(), out);
30  fflush(out);
31 }
32 
33 /* ipgraph module */
34 
35 static inline std::string
37 {
38  return to_str(im.ipgraph());
39 }
40 
41 static inline void
42 print(const InterProceduralGraphModule & im, FILE * out)
43 {
44  fputs(to_str(im).c_str(), out);
45  fflush(out);
46 }
47 
48 /* aggregation tree */
49 
50 std::string
51 to_str(const AggregationNode & n, const AnnotationMap & dm);
52 
53 static inline std::string
55 {
56  return to_str(n, {});
57 }
58 
59 void
60 print(const AggregationNode & n, const AnnotationMap & dm, FILE * out);
61 
62 static inline void
63 print(const AggregationNode & n, FILE * out)
64 {
65  print(n, {}, out);
66 }
67 
68 }
69 
70 #endif
InterProceduralGraph & ipgraph() noexcept
Global memory state passed between functions.
static void print_ascii(const InterProceduralGraph &ipg, FILE *out)
Definition: print.hpp:27
void print(const AggregationNode &n, const AnnotationMap &dm, FILE *out)
Definition: print.cpp:120
std::string to_str(const InterProceduralGraph &clg)
Definition: print.cpp:79