libFirm 1.20
libfirm/iroptimize.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2010 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 
00024 #ifndef FIRM_IROPTIMIZE_H
00025 #define FIRM_IROPTIMIZE_H
00026 
00027 #include "firm_types.h"
00028 #include "nodeops.h"
00029 #include "begin.h"
00030 
00047 FIRM_API void optimize_cf(ir_graph *irg);
00048 
00056 FIRM_API ir_graph_pass_t *optimize_cf_pass(const char *name);
00057 
00063 FIRM_API void opt_jumpthreading(ir_graph* irg);
00064 
00072 FIRM_API ir_graph_pass_t *opt_jumpthreading_pass(const char *name);
00073 
00080 FIRM_API void opt_bool(ir_graph *irg);
00081 
00089 FIRM_API ir_graph_pass_t *opt_bool_pass(const char *name);
00090 
00098 FIRM_API int conv_opt(ir_graph *irg);
00099 
00107 FIRM_API ir_graph_pass_t *conv_opt_pass(const char *name);
00108 
00113 typedef int (*check_alloc_entity_func)(ir_entity *ent);
00114 
00122 FIRM_API void escape_enalysis_irg(ir_graph *irg,
00123                                   check_alloc_entity_func callback);
00124 
00147 FIRM_API void escape_analysis(int run_scalar_replace,
00148                               check_alloc_entity_func callback);
00149 
00172 FIRM_API void optimize_funccalls(void);
00173 
00180 FIRM_API ir_prog_pass_t *optimize_funccalls_pass(const char *name);
00181 
00191 FIRM_API void do_gvn_pre(ir_graph *irg);
00192 
00200 FIRM_API ir_graph_pass_t *do_gvn_pre_pass(const char *name);
00201 
00213 typedef int (*arch_allow_ifconv_func)(ir_node *sel, ir_node *mux_false,
00214                                       ir_node *mux_true);
00215 
00224 FIRM_API void opt_if_conv(ir_graph *irg);
00225 
00233 FIRM_API ir_graph_pass_t *opt_if_conv_pass(const char *name);
00234 
00240 FIRM_API void opt_parallelize_mem(ir_graph *irg);
00241 
00249 FIRM_API ir_graph_pass_t *opt_parallelize_mem_pass(const char *name);
00250 
00262 FIRM_API ir_node *can_replace_load_by_const(const ir_node *load, ir_node *c);
00263 
00291 FIRM_API int optimize_load_store(ir_graph *irg);
00292 
00300 FIRM_API ir_graph_pass_t *optimize_load_store_pass(const char *name);
00301 
00307 FIRM_API int opt_ldst(ir_graph *irg);
00308 
00316 FIRM_API ir_graph_pass_t *opt_ldst_pass(const char *name);
00317 
00327 FIRM_API void loop_optimization(ir_graph *irg);
00328 
00339 FIRM_API void opt_frame_irg(ir_graph *irg);
00340 
00348 FIRM_API ir_graph_pass_t *opt_frame_irg_pass(const char *name);
00349 
00351 typedef enum osr_flags {
00352     osr_flag_none               = 0,  
00353     osr_flag_lftr_with_ov_check = 1,  
00355     osr_flag_ignore_x86_shift   = 2,  
00356     osr_flag_keep_reg_pressure  = 4   
00358 } osr_flags;
00359 
00361 #define osr_flag_default osr_flag_lftr_with_ov_check
00362 
00421 FIRM_API void opt_osr(ir_graph *irg, unsigned flags);
00422 
00431 FIRM_API ir_graph_pass_t *opt_osr_pass(const char *name, unsigned flags);
00432 
00443 FIRM_API void remove_phi_cycles(ir_graph *irg);
00444 
00452 FIRM_API ir_graph_pass_t *remove_phi_cycles_pass(const char *name);
00453 
00454 
00456 #define DEFAULT_CLONE_THRESHOLD 20
00457 
00469 FIRM_API void proc_cloning(float threshold);
00470 
00479 FIRM_API ir_prog_pass_t *proc_cloning_pass(const char *name, float threshold);
00480 
00497 FIRM_API int optimize_reassociation(ir_graph *irg);
00498 
00506 FIRM_API ir_graph_pass_t *optimize_reassociation_pass(const char *name);
00507 
00528 FIRM_API void normalize_one_return(ir_graph *irg);
00529 
00537 FIRM_API ir_graph_pass_t *normalize_one_return_pass(const char *name);
00538 
00559 FIRM_API void normalize_n_returns(ir_graph *irg);
00560 
00568 FIRM_API ir_graph_pass_t *normalize_n_returns_pass(const char *name);
00569 
00579 FIRM_API int scalar_replacement_opt(ir_graph *irg);
00580 
00588 FIRM_API ir_graph_pass_t *scalar_replacement_opt_pass(const char *name);
00589 
00606 FIRM_API int opt_tail_rec_irg(ir_graph *irg);
00607 
00615 FIRM_API ir_graph_pass_t *opt_tail_rec_irg_pass(const char *name);
00616 
00628 FIRM_API void opt_tail_recursion(void);
00629 
00637 FIRM_API ir_prog_pass_t *opt_tail_recursion_pass(const char *name);
00638 
00641 typedef ir_type *(*gen_pointer_type_to_func)(ir_type *tp);
00642 
00668 FIRM_API void normalize_irp_class_casts(gen_pointer_type_to_func gppt_fct);
00669 
00677 FIRM_API void normalize_irg_class_casts(ir_graph *irg,
00678                                         gen_pointer_type_to_func gppt_fct);
00679 
00700 FIRM_API void optimize_class_casts(void);
00701 
00711 FIRM_API void combo(ir_graph *irg);
00712 
00720 FIRM_API ir_graph_pass_t *combo_pass(const char *name);
00721 
00741 FIRM_API void inline_small_irgs(ir_graph *irg, int size);
00742 
00751 FIRM_API ir_graph_pass_t *inline_small_irgs_pass(const char *name, int size);
00752 
00776 FIRM_API void inline_leave_functions(unsigned maxsize, unsigned leavesize,
00777                                      unsigned size, int ignore_runtime);
00778 
00794 FIRM_API ir_prog_pass_t *inline_leave_functions_pass(const char *name,
00795         unsigned maxsize, unsigned leavesize, unsigned size,
00796         int ignore_runtime);
00797 
00799 typedef void (*opt_ptr)(ir_graph *irg);
00800 
00812 FIRM_API void inline_functions(unsigned maxsize, int inline_threshold,
00813                                opt_ptr after_inline_opt);
00814 
00830 FIRM_API ir_prog_pass_t *inline_functions_pass(const char *name,
00831         unsigned maxsize, int inline_threshold, opt_ptr after_inline_opt);
00832 
00840 FIRM_API int shape_blocks(ir_graph *irg);
00841 
00849 FIRM_API ir_graph_pass_t *shape_blocks_pass(const char *name);
00850 
00856 FIRM_API void do_loop_inversion(ir_graph *irg);
00857 
00863 FIRM_API void do_loop_unrolling(ir_graph *irg);
00864 
00868 FIRM_API void do_loop_peeling(ir_graph *irg);
00869 
00877 FIRM_API ir_graph_pass_t *loop_inversion_pass(const char *name);
00878 
00886 FIRM_API ir_graph_pass_t *loop_unroll_pass(const char *name);
00887 
00895 FIRM_API ir_graph_pass_t *loop_peeling_pass(const char *name);
00896 
00904 FIRM_API ir_graph_pass_t *set_vrp_pass(const char *name);
00905 
00914 FIRM_API void garbage_collect_entities(void);
00915 
00917 FIRM_API ir_prog_pass_t *garbage_collect_entities_pass(const char *name);
00918 
00938 FIRM_API void dead_node_elimination(ir_graph *irg);
00939 
00947 FIRM_API ir_graph_pass_t *dead_node_elimination_pass(const char *name);
00948 
00983 FIRM_API int inline_method(ir_node *call, ir_graph *called_graph);
00984 
00999 FIRM_API void place_code(ir_graph *irg);
01000 
01010 FIRM_API ir_graph_pass_t *place_code_pass(const char *name);
01011 
01017 FIRM_API void fixpoint_vrp(ir_graph*);
01018 
01030 FIRM_API ir_graph_pass_t *fixpoint_vrp_irg_pass(const char *name);
01031 
01042 FIRM_API int value_not_zero(const ir_node *n, const ir_node **confirm);
01043 
01057 FIRM_API int value_not_null(const ir_node *n, const ir_node **confirm);
01058 
01066 FIRM_API ir_value_classify_sign classify_value_sign(ir_node *n);
01067 
01076 FIRM_API ir_tarval *computed_value_Cmp_Confirm(
01077     const ir_node *cmp, ir_node *left, ir_node *right, ir_relation relation);
01078 
01080 typedef ir_entity *(*compilerlib_entity_creator_t)(ident *id, ir_type *mt);
01081 
01088 FIRM_API void set_compilerlib_entity_creator(compilerlib_entity_creator_t cb);
01089 
01091 FIRM_API compilerlib_entity_creator_t get_compilerlib_entity_creator(void);
01092 
01100 FIRM_API ir_entity *create_compilerlib_entity(ident *id, ir_type *mt);
01101 
01104 #include "end.h"
01105 
01106 #endif