libFirm 1.20
libfirm/callgraph.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
00003  *
00004  * This file is part of libFirm.
00005  *
00006  * This file may be distributed and/or modified under the terms of the
00007  * GNU General Public License version 2 as published by the Free Software
00008  * Foundation and appearing in the file LICENSE.GPL included in the
00009  * packaging of this file.
00010  *
00011  * Licensees holding valid libFirm Professional Edition licenses may use
00012  * this file in accordance with the libFirm Commercial License.
00013  * Agreement provided with the Software.
00014  *
00015  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE.
00018  */
00019 
00027 #ifndef FIRM_ANA_CALLGRAPH_H
00028 #define FIRM_ANA_CALLGRAPH_H
00029 
00030 #include "firm_types.h"
00031 #include "begin.h"
00032 
00053 typedef enum {
00054     irp_callgraph_none,                   
00055     irp_callgraph_consistent,             
00056     irp_callgraph_inconsistent,           
00057     irp_callgraph_and_calltree_consistent 
00058 } irp_callgraph_state;
00059 
00061 FIRM_API irp_callgraph_state get_irp_callgraph_state(void);
00062 
00064 FIRM_API void set_irp_callgraph_state(irp_callgraph_state s);
00065 
00067 FIRM_API size_t get_irg_n_callers(const ir_graph *irg);
00068 
00070 ir_graph *get_irg_caller(const ir_graph *irg, size_t pos);
00071 
00073 FIRM_API int is_irg_caller_backedge(const ir_graph *irg, size_t pos);
00074 
00076 FIRM_API int has_irg_caller_backedge(const ir_graph *irg);
00077 
00079 FIRM_API size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos);
00080 
00082 FIRM_API size_t get_irg_n_callees(const ir_graph *irg);
00083 
00085 FIRM_API ir_graph *get_irg_callee(const ir_graph *irg, size_t pos);
00086 
00088 FIRM_API int is_irg_callee_backedge(const ir_graph *irg, size_t pos);
00089 
00091 FIRM_API int has_irg_callee_backedge(const ir_graph *irg);
00092 
00094 FIRM_API size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos);
00095 
00098 FIRM_API size_t get_irg_loop_depth(const ir_graph *irg);
00099 
00102 FIRM_API size_t get_irg_recursion_depth(const ir_graph *irg);
00103 
00105 FIRM_API double get_irg_method_execution_frequency(const ir_graph *irg);
00106 
00112 FIRM_API void compute_callgraph(void);
00113 
00115 FIRM_API void free_callgraph(void);
00116 
00117 
00119 typedef void callgraph_walk_func(ir_graph *g, void *env);
00120 
00136 FIRM_API void callgraph_walk(callgraph_walk_func *pre,
00137                              callgraph_walk_func *post, void *env);
00138 
00142 FIRM_API void find_callgraph_recursions(void);
00143 
00154 FIRM_API void analyse_loop_nesting_depth(void);
00155 
00157 typedef enum {
00158     loop_nesting_depth_none,         
00160     loop_nesting_depth_consistent,   
00161     loop_nesting_depth_inconsistent  
00163 } loop_nesting_depth_state;
00164 
00166 FIRM_API loop_nesting_depth_state get_irp_loop_nesting_depth_state(void);
00167 
00169 FIRM_API void set_irp_loop_nesting_depth_state(loop_nesting_depth_state s);
00170 
00172 FIRM_API void set_irp_loop_nesting_depth_state_inconsistent(void);
00173 
00176 #include "end.h"
00177 
00178 #endif