libFirm
callgraph.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
13 #ifndef FIRM_ANA_CALLGRAPH_H
14 #define FIRM_ANA_CALLGRAPH_H
15 
16 #include "firm_types.h"
17 #include "begin.h"
18 
39 typedef enum {
45 
48 
51 
53 FIRM_API size_t get_irg_n_callers(const ir_graph *irg);
54 
56 FIRM_API ir_graph *get_irg_caller(const ir_graph *irg, size_t pos);
57 
59 FIRM_API int is_irg_caller_backedge(const ir_graph *irg, size_t pos);
60 
62 FIRM_API int has_irg_caller_backedge(const ir_graph *irg);
63 
65 FIRM_API size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos);
66 
68 FIRM_API size_t get_irg_n_callees(const ir_graph *irg);
69 
71 FIRM_API ir_graph *get_irg_callee(const ir_graph *irg, size_t pos);
72 
74 FIRM_API int is_irg_callee_backedge(const ir_graph *irg, size_t pos);
75 
77 FIRM_API int has_irg_callee_backedge(const ir_graph *irg);
78 
80 FIRM_API size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos);
81 
83 FIRM_API double get_irg_method_execution_frequency(const ir_graph *irg);
84 
90 FIRM_API void compute_callgraph(void);
91 
93 FIRM_API void free_callgraph(void);
94 
95 
97 typedef void callgraph_walk_func(ir_graph *g, void *env);
98 
114 FIRM_API void callgraph_walk(callgraph_walk_func *pre,
115  callgraph_walk_func *post, void *env);
116 
120 FIRM_API void find_callgraph_recursions(void);
121 
132 FIRM_API void analyse_loop_nesting_depth(void);
133 
135 typedef enum {
142 
145 
148 
151 
154 #include "end.h"
155 
156 #endif
void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *env)
Walks over the callgraph.
void set_irp_loop_nesting_depth_state(loop_nesting_depth_state s)
Sets the nesting depth state of the program representation.
Callgraph constistent but calltree is inconsistent.
Definition: callgraph.h:41
No callgraph allocated.
Definition: callgraph.h:40
Callgraph is allocated but inconsistent.
Definition: callgraph.h:42
irp_callgraph_state
Flag to indicate state of callgraph.
Definition: callgraph.h:39
size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos)
Returns the maximal loop depth of call nodes that call along this edge.
void free_callgraph(void)
Destruct the callgraph.
loop_nesting_depth_state
The state of loop nesting depth.
Definition: callgraph.h:135
ir_graph * get_irg_caller(const ir_graph *irg, size_t pos)
Returns the caller at position pos.
void compute_callgraph(void)
Construct the callgraph.
double get_irg_method_execution_frequency(const ir_graph *irg)
Returns the method execution frequency of a graph.
size_t get_irg_n_callers(const ir_graph *irg)
Returns the number of procedures that call the given irg.
size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos)
Returns the maximal loop depth of call nodes that call along this edge.
void set_irp_callgraph_state(irp_callgraph_state s)
Sets the callgraph state of the program representation.
int has_irg_caller_backedge(const ir_graph *irg)
Returns non-zero if the irg has a backedge caller.
int is_irg_caller_backedge(const ir_graph *irg, size_t pos)
Returns non-zero if the caller at position pos is "a backedge", i.e.
Loop nesting depth is computed but the graphs have been changed since.
Definition: callgraph.h:139
ir_graph * get_irg_callee(const ir_graph *irg, size_t pos)
Returns the callee at position pos.
void analyse_loop_nesting_depth(void)
Computes the interprocedural loop nesting information.
loop_nesting_depth_state get_irp_loop_nesting_depth_state(void)
Returns the nesting depth state of the program representation.
irp_callgraph_state get_irp_callgraph_state(void)
Returns the callgraph state of the program representation.
int has_irg_callee_backedge(const ir_graph *irg)
Returns non-zero if the irg has a backedge callee.
int is_irg_callee_backedge(const ir_graph *irg, size_t pos)
Returns non-zero if the callee at position pos is "a backedge", i.e.
Both callgraph and calltree are consistent.
Definition: callgraph.h:43
void find_callgraph_recursions(void)
Compute the backedges that represent recursions and a looptree.
void set_irp_loop_nesting_depth_state_inconsistent(void)
Marks the nesting depth state of the program representation as inconsistent.
Loop nesting depths are not computed, no memory is allocated, access fails.
Definition: callgraph.h:136
Loop nesting depth information is computed and correct.
Definition: callgraph.h:138
size_t get_irg_n_callees(const ir_graph *irg)
Returns the number of procedures that are called by the given irg.
void callgraph_walk_func(ir_graph *g, void *env)
A function type for functions passed to the callgraph walker.
Definition: callgraph.h:97
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74