libFirm
iroptimize.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
10 #ifndef FIRM_IROPTIMIZE_H
11 #define FIRM_IROPTIMIZE_H
12 
13 #include "firm_types.h"
14 
15 #include "begin.h"
16 
33 FIRM_API void optimize_cf(ir_graph *irg);
34 
40 FIRM_API void opt_jumpthreading(ir_graph* irg);
41 
48 FIRM_API void opt_bool(ir_graph *irg);
49 
55 FIRM_API void conv_opt(ir_graph *irg);
56 
61 typedef int (*check_alloc_entity_func)(ir_entity *ent);
62 
85 FIRM_API void optimize_funccalls(void);
86 
96 FIRM_API void do_gvn_pre(ir_graph *irg);
97 
109 typedef int (*arch_allow_ifconv_func)(ir_node const *sel,
110  ir_node const *mux_false,
111  ir_node const *mux_true);
112 
121 FIRM_API void opt_if_conv(ir_graph *irg);
122 
132 FIRM_API void opt_if_conv_cb(ir_graph *irg, arch_allow_ifconv_func callback);
133 
139 FIRM_API void opt_parallelize_mem(ir_graph *irg);
140 
152 FIRM_API ir_node *can_replace_load_by_const(const ir_node *load, ir_node *c);
153 
179 FIRM_API void optimize_load_store(ir_graph *irg);
180 
184 FIRM_API void combine_memops(ir_graph *irg);
185 
191 FIRM_API void opt_ldst(ir_graph *irg);
192 
203 FIRM_API void opt_frame_irg(ir_graph *irg);
204 
206 typedef enum osr_flags {
213 } osr_flags;
214 
216 #define osr_flag_default osr_flag_lftr_with_ov_check
217 
274 FIRM_API void opt_osr(ir_graph *irg, unsigned flags);
275 
286 FIRM_API void remove_phi_cycles(ir_graph *irg);
287 
289 #define DEFAULT_CLONE_THRESHOLD 20
290 
302 FIRM_API void proc_cloning(float threshold);
303 
318 FIRM_API void optimize_reassociation(ir_graph *irg);
319 
340 FIRM_API void normalize_one_return(ir_graph *irg);
341 
362 FIRM_API void normalize_n_returns(ir_graph *irg);
363 
371 FIRM_API void scalar_replacement_opt(ir_graph *irg);
372 
387 FIRM_API void opt_tail_rec_irg(ir_graph *irg);
388 
398 FIRM_API void combo(ir_graph *irg);
399 
401 typedef void (*opt_ptr)(ir_graph *irg);
402 
414 FIRM_API void inline_functions(unsigned maxsize, int inline_threshold,
415  opt_ptr after_inline_opt);
416 
422 FIRM_API void shape_blocks(ir_graph *irg);
423 
429 FIRM_API void do_loop_inversion(ir_graph *irg);
430 
436 FIRM_API void do_loop_unrolling(ir_graph *irg);
437 
445 FIRM_API void unroll_loops(ir_graph *irg, unsigned factor, unsigned maxsize);
446 
450 FIRM_API void do_loop_peeling(ir_graph *irg);
451 
460 FIRM_API void garbage_collect_entities(void);
461 
481 FIRM_API void dead_node_elimination(ir_graph *irg);
482 
497 FIRM_API void place_code(ir_graph *irg);
498 
503 FIRM_API void occult_consts(ir_graph*);
504 
512 FIRM_API int value_not_null(const ir_node *n, const ir_node **confirm);
513 
521 FIRM_API ir_tarval *computed_value_Cmp_Confirm(ir_node *left, ir_node *right,
522  ir_relation relation);
523 
528 FIRM_API ir_entity *create_compilerlib_entity(char const *name, ir_type *mt);
529 
532 #include "end.h"
533 
534 #endif
void do_loop_unrolling(ir_graph *irg)
Perform loop unrolling on a given graph.
void opt_jumpthreading(ir_graph *irg)
Perform path-sensitive jump threading on the given graph.
void combine_memops(ir_graph *irg)
Combine adjacent "small" load/store operations into bigger ones.
void opt_parallelize_mem(ir_graph *irg)
Tries to reduce dependencies for memory nodes where possible by parallelizing them and synchronizing ...
void combo(ir_graph *irg)
CLiff Click's combo algorithm from "Combining Analyses, combining Optimizations". ...
ir_relation
Relations for comparing numbers.
Definition: firm_types.h:162
struct ir_tarval ir_tarval
Target Machine Value.
Definition: firm_types.h:68
void normalize_one_return(ir_graph *irg)
Normalize the Returns of a graph by creating a new End block with One Return(Phi).
void opt_if_conv_cb(ir_graph *irg, arch_allow_ifconv_func callback)
Perform If conversion on a graph - callback version.
void opt_bool(ir_graph *irg)
Simplifies boolean expression in the given ir graph.
void do_loop_peeling(ir_graph *irg)
Perform loop peeling on a given graph.
void garbage_collect_entities(void)
Removes all entities which are unused.
void optimize_reassociation(ir_graph *irg)
Reassociation.
void optimize_load_store(ir_graph *irg)
Load/Store optimization.
ir_entity * create_compilerlib_entity(char const *name, ir_type *mt)
Constructs the entity for a given function using the current compilerlib entity creation callback...
void scalar_replacement_opt(ir_graph *irg)
Performs the scalar replacement optimization.
void occult_consts(ir_graph *)
This optimization finds values where the bits are either constant or irrelevant and exchanges them fo...
void unroll_loops(ir_graph *irg, unsigned factor, unsigned maxsize)
Perform loop unrolling on a given graph.
void place_code(ir_graph *irg)
Code Placement.
no additional flags
Definition: iroptimize.h:207
void do_gvn_pre(ir_graph *irg)
Does Partial Redundancy Elimination combined with Global Value Numbering.
struct ir_type ir_type
Type.
Definition: firm_types.h:71
int(* arch_allow_ifconv_func)(ir_node const *sel, ir_node const *mux_false, ir_node const *mux_true)
This function is called to evaluate, if a mux(sel, mux_false, mux_true) should be built for the curre...
Definition: iroptimize.h:109
int(* check_alloc_entity_func)(ir_entity *ent)
A callback that checks whether a entity is an allocation routine.
Definition: iroptimize.h:61
do linear function test replacement only if no overflow can occur.
Definition: iroptimize.h:208
void opt_ldst(ir_graph *irg)
New experimental alternative to optimize_load_store.
void dead_node_elimination(ir_graph *irg)
Performs dead node elimination by copying the ir graph to a new obstack.
void opt_frame_irg(ir_graph *irg)
Optimize the frame type of an irg by removing never touched entities.
void opt_tail_rec_irg(ir_graph *irg)
Optimizes tail-recursion calls by converting them into loops.
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
void normalize_n_returns(ir_graph *irg)
Normalize the Returns of a graph by moving the Returns upwards as much as possible.
do NOT increase register pressure by introducing new induction variables.
Definition: iroptimize.h:211
void(* opt_ptr)(ir_graph *irg)
pointer to an optimization function
Definition: iroptimize.h:401
ir_node * can_replace_load_by_const(const ir_node *load, ir_node *c)
Check if we can replace the load by a given const from the const code irg.
void opt_if_conv(ir_graph *irg)
Perform If conversion on a graph.
int value_not_null(const ir_node *n, const ir_node **confirm)
Returns true if the value n is known not be zero/null.
void conv_opt(ir_graph *irg)
Reduces the number of Conv nodes in the given ir graph.
ignore Multiplications by 2, 4, 8
Definition: iroptimize.h:210
struct ir_entity ir_entity
Entity.
Definition: firm_types.h:83
void shape_blocks(ir_graph *irg)
Combines congruent blocks into one.
void opt_osr(ir_graph *irg, unsigned flags)
Performs the Operator Scalar Replacement optimization and linear function test replacement for loop c...
ir_tarval * computed_value_Cmp_Confirm(ir_node *left, ir_node *right, ir_relation relation)
Returns the value of a Cmp if one or both predecessors are Confirm nodes.
void proc_cloning(float threshold)
Performs procedure cloning.
void do_loop_inversion(ir_graph *irg)
Perform loop inversion on a given graph.
void optimize_funccalls(void)
Optimize function calls by handling const functions.
void remove_phi_cycles(ir_graph *irg)
Removes useless Phi cycles, i.e cycles of Phi nodes with only one non-Phi node.
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
void optimize_cf(ir_graph *irg)
Control flow optimization.
osr_flags
Possible flags for the Operator Scalar Replacement.
Definition: iroptimize.h:206
void inline_functions(unsigned maxsize, int inline_threshold, opt_ptr after_inline_opt)
Heuristic inliner.