libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
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 <stddef.h>
17 #include "firm_types.h"
18 #include "begin.h"
19 
40 typedef enum {
46 
49 
52 
54 FIRM_API size_t get_irg_n_callers(const ir_graph *irg);
55 
57 FIRM_API ir_graph *get_irg_caller(const ir_graph *irg, size_t pos);
58 
60 FIRM_API int is_irg_caller_backedge(const ir_graph *irg, size_t pos);
61 
63 FIRM_API int has_irg_caller_backedge(const ir_graph *irg);
64 
66 FIRM_API size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos);
67 
69 FIRM_API size_t get_irg_n_callees(const ir_graph *irg);
70 
72 FIRM_API ir_graph *get_irg_callee(const ir_graph *irg, size_t pos);
73 
75 FIRM_API int is_irg_callee_backedge(const ir_graph *irg, size_t pos);
76 
78 FIRM_API int has_irg_callee_backedge(const ir_graph *irg);
79 
81 FIRM_API size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos);
82 
84 FIRM_API double get_irg_method_execution_frequency(const ir_graph *irg);
85 
91 FIRM_API void compute_callgraph(void);
92 
94 FIRM_API void free_callgraph(void);
95 
96 
98 typedef void callgraph_walk_func(ir_graph *g, void *env);
99 
115 FIRM_API void callgraph_walk(callgraph_walk_func *pre,
116  callgraph_walk_func *post, void *env);
117 
121 FIRM_API void find_callgraph_recursions(void);
122 
133 FIRM_API void analyse_loop_nesting_depth(void);
134 
136 typedef enum {
143 
146 
149 
152 
155 #include "end.h"
156 
157 #endif
void analyse_loop_nesting_depth(void)
Computes the interprocedural loop nesting information.
Loop nesting depth is computed but the graphs have been changed since.
Definition: callgraph.h:140
void set_irp_loop_nesting_depth_state_inconsistent(void)
Marks the nesting depth state of the program representation as inconsistent.
int has_irg_callee_backedge(const ir_graph *irg)
Returns non-zero if the irg has a backedge callee.
ir_graph * get_irg_callee(const ir_graph *irg, size_t pos)
Returns the callee at position pos.
void callgraph_walk_func(ir_graph *g, void *env)
A function type for functions passed to the callgraph walker.
Definition: callgraph.h:98
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.
loop_nesting_depth_state get_irp_loop_nesting_depth_state(void)
Returns the nesting depth state of the program representation.
void set_irp_loop_nesting_depth_state(loop_nesting_depth_state s)
Sets the nesting depth state of the program representation.
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
ir_graph * get_irg_caller(const ir_graph *irg, size_t pos)
Returns the caller at position pos.
No callgraph allocated.
Definition: callgraph.h:41
double get_irg_method_execution_frequency(const ir_graph *irg)
Returns the method execution frequency of a graph.
Loop nesting depth information is computed and correct.
Definition: callgraph.h:139
void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *env)
Walks over the callgraph.
Both callgraph and calltree are consistent.
Definition: callgraph.h:44
loop_nesting_depth_state
The state of loop nesting depth.
Definition: callgraph.h:136
size_t get_irg_n_callees(const ir_graph *irg)
Returns the number of procedures that are called by the given irg.
irp_callgraph_state
Flag to indicate state of callgraph.
Definition: callgraph.h:40
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 set_irp_callgraph_state(irp_callgraph_state s)
Sets the callgraph state of the program representation.
void find_callgraph_recursions(void)
Compute the backedges that represent recursions and a looptree.
Callgraph is allocated but inconsistent.
Definition: callgraph.h:43
irp_callgraph_state get_irp_callgraph_state(void)
Returns the callgraph state of the program representation.
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.
int has_irg_caller_backedge(const ir_graph *irg)
Returns non-zero if the irg has a backedge caller.
Callgraph constistent but calltree is inconsistent.
Definition: callgraph.h:42
size_t get_irg_n_callers(const ir_graph *irg)
Returns the number of procedures that call the given irg.
void free_callgraph(void)
Destruct the callgraph.
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.
Loop nesting depths are not computed, no memory is allocated, access fails.
Definition: callgraph.h:137
void compute_callgraph(void)
Construct the callgraph.