2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Available Optimisations of libFirm.
10 #ifndef FIRM_IROPTIMIZE_H
11 #define FIRM_IROPTIMIZE_H
13 #include "firm_types.h"
18 * @defgroup iroptimize Transformations and Optimisations
23 * Control flow optimization.
25 * Removes empty blocks doing if simplifications and loop simplifications.
26 * A block is empty if it contains only a Jmp node and Phi nodes.
27 * Merges single entry single exit blocks with their predecessor
28 * and propagates dead control flow by calling equivalent_node().
29 * Independent of compiler flag it removes Tuples from cf edges,
30 * Bad predecessors from Blocks and Phis, and unnecessary predecessors of End.
31 * Destroys backedge information.
33 FIRM_API void optimize_cf(ir_graph *irg);
36 * Creates an ir_graph pass for optimize_cf().
38 * @param name the name of this pass or NULL
40 * @return the newly created ir_graph pass
42 FIRM_API ir_graph_pass_t *optimize_cf_pass(const char *name);
45 * Perform path-sensitive jump threading on the given graph.
47 * @param irg the graph
49 FIRM_API void opt_jumpthreading(ir_graph* irg);
52 * Creates an ir_graph pass for opt_jumpthreading().
54 * @param name the name of this pass or NULL
56 * @return the newly created ir_graph pass
58 FIRM_API ir_graph_pass_t *opt_jumpthreading_pass(const char *name);
61 * Simplifies boolean expression in the given ir graph.
62 * eg. x < 5 && x < 6 becomes x < 5
64 * @param irg the graph
66 FIRM_API void opt_bool(ir_graph *irg);
69 * Creates an ir_graph pass for opt_bool().
71 * @param name the name of this pass or NULL
73 * @return the newly created ir_graph pass
75 FIRM_API ir_graph_pass_t *opt_bool_pass(const char *name);
78 * Reduces the number of Conv nodes in the given ir graph.
80 * @param irg the graph
82 FIRM_API void conv_opt(ir_graph *irg);
85 * Creates an ir_graph pass for conv_opt().
87 * @param name the name of this pass or NULL
89 * @return the newly created ir_graph pass
91 FIRM_API ir_graph_pass_t *conv_opt_pass(const char *name);
94 * A callback that checks whether a entity is an allocation
97 typedef int (*check_alloc_entity_func)(ir_entity *ent);
100 * Performs simple and fast escape analysis for one graph.
102 * @param irg the graph
103 * @param callback a callback function to check whether a
104 * given entity is a allocation call
106 FIRM_API void escape_enalysis_irg(ir_graph *irg,
107 check_alloc_entity_func callback);
110 * Performs simple and fast escape analysis for all graphs.
112 * This optimization implements a simple and fast but inexact
113 * escape analysis. Some addresses might be marked as 'escaped' even
115 * The advantage is a low memory footprint and fast speed.
117 * @param run_scalar_replace if this flag in non-zero, scalar
118 * replacement optimization is run on graphs with removed
120 * @param callback a callback function to check whether a
121 * given entity is a allocation call
123 * This optimization removes allocation which are not used (rare) and replace
124 * allocation that can be proved dead at the end of the graph which stack variables.
126 * The creation of stack variable allows scalar replacement to be run only
127 * on those graphs that have been changed.
129 * This is most effective on Java where no other stack variables exists.
131 FIRM_API void escape_analysis(int run_scalar_replace,
132 check_alloc_entity_func callback);
135 * Optimize function calls by handling const functions.
137 * This optimization first detects all "const functions", i.e.,
138 * IR graphs that neither read nor write memory (and hence did
139 * not create exceptions, as these use memory in Firm).
141 * The result of calls to such functions depends only on its
142 * arguments, hence those calls are no more pinned.
144 * This is a rather strong criteria, so do not expect that a
145 * lot of functions will be found. Moreover, all of them might
146 * already be inlined if inlining is activated.
147 * Anyway, it might be good for handling builtin's
148 * even if the later read/write memory (but we know how).
150 * This optimizations read the irg_const_function property of
151 * entities and and sets the irg_const_function property of
154 * If callee information is valid, we also optimize polymorphic Calls.
156 FIRM_API void optimize_funccalls(void);
159 * Creates an ir_prog pass for optimize_funccalls().
161 * @param name the name of this pass or NULL
162 * @return the newly created ir_prog pass
164 FIRM_API ir_prog_pass_t *optimize_funccalls_pass(const char *name);
167 * Does Partial Redundancy Elimination combined with
168 * Global Value Numbering.
169 * Can be used to replace place_code() completely.
171 * Based on VanDrunen and Hosking 2004.
173 * @param irg the graph
175 FIRM_API void do_gvn_pre(ir_graph *irg);
178 * Creates an ir_graph pass for do_gvn_pre().
180 * @param name the name of this pass or NULL
182 * @return the newly created ir_graph pass
184 FIRM_API ir_graph_pass_t *do_gvn_pre_pass(const char *name);
187 * This function is called to evaluate, if a
188 * mux(@p sel, @p mux_false, @p mux_true) should be built for the current
190 * If it returns non-zero, a mux is created, else the code
192 * @param sel A selector of a Cond.
193 * @param phi_list phi node to be converted
194 * @param i First data predecessor involved in if conversion
195 * @param j Second data predecessor involved in if conversion
197 typedef int (*arch_allow_ifconv_func)(ir_node *sel, ir_node *mux_false,
201 * Perform If conversion on a graph.
203 * @param irg The graph.
205 * Cannot handle blocks with Bad control predecessors, so call it after control
208 FIRM_API void opt_if_conv(ir_graph *irg);
211 * Creates an ir_graph pass for opt_if_conv().
213 * @param name the name of this pass or NULL
215 * @return the newly created ir_graph pass
217 FIRM_API ir_graph_pass_t *opt_if_conv_pass(const char *name);
220 * Tries to reduce dependencies for memory nodes where possible by parallelizing
221 * them and synchronizing with Sync nodes
222 * @param irg the graph where memory operations should be parallelized
224 FIRM_API void opt_parallelize_mem(ir_graph *irg);
227 * Creates an ir_graph pass for opt_sync().
229 * @param name the name of this pass or NULL
231 * @return the newly created ir_graph pass
233 FIRM_API ir_graph_pass_t *opt_parallelize_mem_pass(const char *name);
236 * Check if we can replace the load by a given const from
237 * the const code irg.
239 * @param load the load to replace
240 * @param c the constant
242 * @return if the modes match or can be transformed using a reinterpret cast
243 * returns a copy of the constant (possibly Conv'ed) in the graph where
246 FIRM_API ir_node *can_replace_load_by_const(const ir_node *load, ir_node *c);
249 * Load/Store optimization.
251 * Removes redundant non-volatile Loads and Stores.
252 * May introduce Bad nodes if exceptional control flow
253 * is removed. The following cases are optimized:
255 * Load without result: A Load which has only a memory use
258 * Load after Store: A Load after a Store is removed, if
259 * the Load doesn't have an exception handler OR is in
260 * the same block as the Store.
262 * Load after Load: A Load after a Load is removed, if the
263 * Load doesn't have an exception handler OR is in the
264 * same block as the previous Load.
266 * Store before Store: A Store immediately before another
267 * Store in the same block is removed, if the Store doesn't
268 * have an exception handler.
270 * Store after Load: A Store after a Load is removed, if the
271 * Store doesn't have an exception handler.
273 FIRM_API void optimize_load_store(ir_graph *irg);
276 * Creates an ir_graph pass for optimize_load_store().
278 * @param name the name of this pass or NULL
280 * @return the newly created ir_graph pass
282 FIRM_API ir_graph_pass_t *optimize_load_store_pass(const char *name);
285 * New experimental alternative to optimize_load_store.
286 * Based on a dataflow analysis, so load/stores are moved out of loops
289 FIRM_API void opt_ldst(ir_graph *irg);
292 * Creates an ir_graph pass for opt_ldst().
294 * @param name the name of this pass or NULL
296 * @return the newly created ir_graph pass
298 FIRM_API ir_graph_pass_t *opt_ldst_pass(const char *name);
301 * Optimize loops by peeling or unrolling them if beneficial.
303 * @param irg The graph whose loops will be processed
305 * This function did not change the graph, only its frame type.
306 * The layout state of the frame type will be set to layout_undefined
307 * if entities were removed.
309 FIRM_API void loop_optimization(ir_graph *irg);
312 * Optimize the frame type of an irg by removing
313 * never touched entities.
315 * @param irg The graph whose frame type will be optimized
317 * This function did not change the graph, only its frame type.
318 * The layout state of the frame type will be set to layout_undefined
319 * if entities were removed.
321 FIRM_API void opt_frame_irg(ir_graph *irg);
324 * Creates an ir_graph pass for opt_frame_irg().
326 * @param name the name of this pass or NULL
328 * @return the newly created ir_graph pass
330 FIRM_API ir_graph_pass_t *opt_frame_irg_pass(const char *name);
332 /** Possible flags for the Operator Scalar Replacement. */
333 typedef enum osr_flags {
334 osr_flag_none = 0, /**< no additional flags */
335 osr_flag_lftr_with_ov_check = 1, /**< do linear function test replacement
336 only if no overflow can occur. */
337 osr_flag_ignore_x86_shift = 2, /**< ignore Multiplications by 2, 4, 8 */
338 osr_flag_keep_reg_pressure = 4 /**< do NOT increase register pressure by introducing new
339 induction variables. */
342 /** default setting */
343 #define osr_flag_default osr_flag_lftr_with_ov_check
346 * Performs the Operator Scalar Replacement optimization and linear
347 * function test replacement for loop control.
348 * Can be switched off using the set_opt_strength_red() flag.
349 * In that case, only remove_phi_cycles() is executed.
351 * @param irg the graph which should be optimized
352 * @param flags set of osr_flags
354 * The linear function replacement test is controlled by the flags.
355 * If the osr_flag_lftr_with_ov_check is set, the replacement is only
356 * done if do overflow can occur.
357 * Otherwise it is ALWAYS done which might be insecure.
361 * for (i = 0; i < 100; ++i)
363 * might be replaced by
365 * for (i = 0; i < 400; i += 4)
369 * for (i = 0; i < 0x7FFFFFFF; ++i)
371 * will not be replaced by
373 * for (i = 0; i < 0xFFFFFFFC; i += 4)
375 * because of overflow.
379 * for (i = 0; i <= 0xF; ++i)
381 * will NOT be transformed into
383 * for (i = 0xFFFFFFF0; i <= 0xFFFFFFFF; ++i)
385 * although here is no direct overflow. The OV occurs when the ++i
386 * is executed (and would created an endless loop here!).
388 * For the same reason, a loop
390 * for (i = 0; i <= 9; i += x)
392 * will NOT be transformed because we cannot estimate whether an overflow
393 * might happen adding x.
395 * Note that i < a + 400 is also not possible with the current implementation
396 * although this might be allowed by other compilers...
398 * Note further that tests for equality can be handled some simpler (but are not
401 * This algorithm destroys the link field of nodes.
403 FIRM_API void opt_osr(ir_graph *irg, unsigned flags);
406 * Creates an ir_graph pass for remove_phi_cycles().
408 * @param name the name of this pass or NULL
409 * @param flags set of osr_flags
411 * @return the newly created ir_graph pass
413 FIRM_API ir_graph_pass_t *opt_osr_pass(const char *name, unsigned flags);
416 * Removes useless Phi cycles, i.e cycles of Phi nodes with only one
418 * This is automatically done in opt_osr(), so there is no need to call it
421 * @param irg the graph which should be optimized
423 * This algorithm destroys the link field of nodes.
425 FIRM_API void remove_phi_cycles(ir_graph *irg);
428 * Creates an ir_graph pass for remove_phi_cycles().
430 * @param name the name of this pass or NULL
432 * @return the newly created ir_graph pass
434 FIRM_API ir_graph_pass_t *remove_phi_cycles_pass(const char *name);
437 /** A default threshold. */
438 #define DEFAULT_CLONE_THRESHOLD 20
441 * Performs procedure cloning. Evaluate a heuristic weight for every
442 * Call(..., Const, ...). If the weight is bigger than threshold,
443 * clone the entity and fix the calls.
445 * @param threshold the threshold for cloning
447 * The threshold is an estimation of how many instructions are saved
448 * when executing a cloned method. If threshold is 0.0, every possible
451 FIRM_API void proc_cloning(float threshold);
454 * Creates an ir_prog pass for proc_cloning().
456 * @param name the name of this pass or NULL
457 * @param threshold the threshold for cloning
459 * @return the newly created ir_prog pass
461 FIRM_API ir_prog_pass_t *proc_cloning_pass(const char *name, float threshold);
466 * Applies Reassociation rules to integer expressions.
467 * Beware: Works only if integer overflow might be ignored, as for C, Java
468 * and for address expression.
469 * Works only if Constant folding is activated.
471 * Uses loop information to detect loop-invariant (i.e. contant
472 * inside the loop) values.
474 * See Muchnik 12.3.1 Algebraic Simplification and Reassociation of
475 * Addressing Expressions.
477 FIRM_API void optimize_reassociation(ir_graph *irg);
480 * Creates an ir_graph pass for optimize_reassociation().
482 * @param name the name of this pass or NULL
484 * @return the newly created ir_graph pass
486 FIRM_API ir_graph_pass_t *optimize_reassociation_pass(const char *name);
489 * Normalize the Returns of a graph by creating a new End block
490 * with One Return(Phi).
491 * This is the preferred input for the if-conversion.
493 * In pseudocode, it means:
500 * is transformed into
508 FIRM_API void normalize_one_return(ir_graph *irg);
511 * Creates an ir_graph pass for normalize_one_return().
513 * @param name the name of this pass or NULL
515 * @return the newly created ir_graph pass
517 FIRM_API ir_graph_pass_t *normalize_one_return_pass(const char *name);
520 * Normalize the Returns of a graph by moving
521 * the Returns upwards as much as possible.
522 * This might be preferred for code generation.
524 * In pseudocode, it means:
532 * is transformed into
539 FIRM_API void normalize_n_returns(ir_graph *irg);
542 * Creates an ir_graph pass for normalize_n_returns().
544 * @param name the name of this pass or NULL
546 * @return the newly created ir_graph pass
548 FIRM_API ir_graph_pass_t *normalize_n_returns_pass(const char *name);
551 * Performs the scalar replacement optimization.
552 * Replaces local compound entities (like structures and arrays)
553 * with atomic values if possible. Does not handle classes yet.
555 * @param irg the graph which should be optimized
557 FIRM_API void scalar_replacement_opt(ir_graph *irg);
560 * Creates an ir_graph pass for scalar_replacement_opt().
562 * @param name the name of this pass or NULL
564 * @return the newly created ir_graph pass
566 FIRM_API ir_graph_pass_t *scalar_replacement_opt_pass(const char *name);
569 * Optimizes tail-recursion calls by converting them into loops.
570 * Depends on the flag opt_tail_recursion.
571 * Currently supports the following forms:
573 * - return x + func();
574 * - return func() - x;
575 * - return x * func();
578 * Does not work for Calls that use the exception stuff.
580 * @param irg the graph to be optimized
582 FIRM_API void opt_tail_rec_irg(ir_graph *irg);
585 * Creates an ir_graph pass for opt_tail_rec_irg().
587 * @param name the name of this pass or NULL
589 * @return the newly created ir_graph pass
591 FIRM_API ir_graph_pass_t *opt_tail_rec_irg_pass(const char *name);
594 * Optimize tail-recursion calls for all IR-Graphs.
595 * Can currently handle:
596 * - direct return value, i.e. return func().
597 * - additive return value, i.e. return x +/- func()
598 * - multiplicative return value, i.e. return x * func() or return -func()
600 * The current implementation must be run before optimize_funccalls(),
601 * because it expects the memory edges pointing to calls, which might be
602 * removed by optimize_funccalls().
604 FIRM_API void opt_tail_recursion(void);
607 * Creates an ir_prog pass for opt_tail_recursion().
609 * @param name the name of this pass or NULL
611 * @return the newly created ir_prog pass
613 FIRM_API ir_prog_pass_t *opt_tail_recursion_pass(const char *name);
616 * CLiff Click's combo algorithm from
617 * "Combining Analyses, combining Optimizations".
619 * Does conditional constant propagation, unreachable code elimination and
620 * optimistic global value numbering at once.
622 * @param irg the graph to run on
624 FIRM_API void combo(ir_graph *irg);
627 * Creates an ir_graph pass for combo.
629 * @param name the name of this pass or NULL
631 * @return the newly created ir_graph pass
633 FIRM_API ir_graph_pass_t *combo_pass(const char *name);
635 /** pointer to an optimization function */
636 typedef void (*opt_ptr)(ir_graph *irg);
639 * Heuristic inliner. Calculates a benefice value for every call and inlines
640 * those calls with a value higher than the threshold.
642 * @param maxsize Do not inline any calls if a method has more than
643 * maxsize firm nodes. It may reach this limit by
645 * @param inline_threshold inlining threshold
646 * @param after_inline_opt optimizations performed immediately after inlining
649 FIRM_API void inline_functions(unsigned maxsize, int inline_threshold,
650 opt_ptr after_inline_opt);
653 * Creates an ir_prog pass for inline_functions().
655 * @param name the name of this pass or NULL
656 * @param maxsize Do not inline any calls if a method has more than
657 * maxsize firm nodes. It may reach this limit by
659 * @param inline_threshold inlining threshold
660 * @param after_inline_opt a function that is called after inlining a
661 * procedure. You should run fast local optimisations
662 * here which cleanup the graph before further
665 * @return the newly created ir_prog pass
667 FIRM_API ir_prog_pass_t *inline_functions_pass(const char *name,
668 unsigned maxsize, int inline_threshold, opt_ptr after_inline_opt);
671 * Combines congruent blocks into one.
673 * @param irg The IR-graph to optimize.
675 FIRM_API void shape_blocks(ir_graph *irg);
678 * Creates an ir_graph pass for shape_blocks().
680 * @param name the name of this pass or NULL
682 * @return the newly created ir_graph pass
684 FIRM_API ir_graph_pass_t *shape_blocks_pass(const char *name);
687 * Perform loop inversion on a given graph.
688 * Loop inversion transforms a head controlled loop (like while(...) {} and
689 * for(...) {}) into a foot controlled loop (do {} while(...)).
691 FIRM_API void do_loop_inversion(ir_graph *irg);
694 * Perform loop unrolling on a given graph.
695 * Loop unrolling multiplies the number loop completely by a number found
696 * through a heuristic.
698 FIRM_API void do_loop_unrolling(ir_graph *irg);
701 * Perform loop peeling on a given graph.
703 FIRM_API void do_loop_peeling(ir_graph *irg);
706 * Creates an ir_graph pass for loop inversion.
708 * @param name the name of this pass or NULL
710 * @return the newly created ir_graph pass
712 FIRM_API ir_graph_pass_t *loop_inversion_pass(const char *name);
715 * Creates an ir_graph pass for loop unrolling.
717 * @param name the name of this pass or NULL
719 * @return the newly created ir_graph pass
721 FIRM_API ir_graph_pass_t *loop_unroll_pass(const char *name);
724 * Creates an ir_graph pass for loop peeling.
726 * @param name the name of this pass or NULL
728 * @return the newly created ir_graph pass
730 FIRM_API ir_graph_pass_t *loop_peeling_pass(const char *name);
733 * Creates an ir_graph pass for set_vrp_data()
735 * @param name The name of this pass or NULL
737 * @return the newly created ir_graph pass
739 FIRM_API ir_graph_pass_t *set_vrp_pass(const char *name);
742 * Removes all entities which are unused.
744 * Unused entities have ir_visibility_local and are not used directly or
745 * indirectly through entities/code visible outside the compilation unit.
746 * This is usually conservative than gc_irgs, but does not respect properties
747 * of object-oriented programs.
749 FIRM_API void garbage_collect_entities(void);
751 /** Pass for garbage_collect_entities */
752 FIRM_API ir_prog_pass_t *garbage_collect_entities_pass(const char *name);
755 * Performs dead node elimination by copying the ir graph to a new obstack.
757 * The major intention of this pass is to free memory occupied by
758 * dead nodes and outdated analyzes information. Further this
759 * function removes Bad predecessors from Blocks and the corresponding
760 * inputs to Phi nodes. This opens optimization potential for other
761 * optimizations. Further this phase reduces dead Block<->Jmp
762 * self-cycles to Bad nodes.
764 * Dead_node_elimination is only performed if options `optimize' and
765 * `opt_dead_node_elimination' are set. The graph may
766 * not be in state phase_building. The outs datastructure is freed,
767 * the outs state set to outs_none. Backedge information is conserved.
768 * Removes old attributes of nodes. Sets link field to NULL.
769 * Callee information must be freed (irg_callee_info_none).
771 * @param irg The graph to be optimized.
773 FIRM_API void dead_node_elimination(ir_graph *irg);
776 * Creates an ir_graph pass for dead_node_elimination().
778 * @param name the name of this pass or NULL
780 * @return the newly created ir_graph pass
782 FIRM_API ir_graph_pass_t *dead_node_elimination_pass(const char *name);
785 * Inlines a method at the given call site.
787 * Removes the call node and splits the basic block the call node
788 * belongs to. Inserts a copy of the called graph between these nodes.
789 * Assumes that call is a Call node in current_ir_graph and that
790 * the type in the Call nodes type attribute is the same as the
791 * type of the called graph.
792 * Further it assumes that all Phi nodes in a block of current_ir_graph
793 * are assembled in a "link" list in the link field of the corresponding
794 * block nodes. Further assumes that all Proj nodes are in a "link" list
795 * in the nodes producing the tuple. (This is only an optical feature
796 * for the graph.) Conserves this feature for the old
797 * nodes of the graph. This precondition can be established by a call to
798 * collect_phisprojs(), see irgmod.h.
799 * As dead_node_elimination this function reduces dead Block<->Jmp
800 * self-cycles to Bad nodes.
802 * Called_graph must be unequal to current_ir_graph. Will not inline
804 * Sets visited masterflag in current_ir_graph to the max of the flag in
805 * current and called graph.
806 * Assumes that both, the called and the calling graph are in state
807 * "op_pin_state_pinned".
808 * It is recommended to call local_optimize_graph() after inlining as this
809 * function leaves a set of obscure Tuple nodes, e.g. a Proj-Tuple-Jmp
810 * combination as control flow operation.
812 * @param call the call node that should be inlined
813 * @param called_graph the IR-graph that is called at call
815 * @return zero if method could not be inlined (recursion for instance),
816 * non-zero if all went ok
818 FIRM_API int inline_method(ir_node *call, ir_graph *called_graph);
823 * Pins all floating nodes to a block where they
824 * will be executed only if needed. Depends on the flag opt_global_cse.
825 * Graph may not be in phase_building. Does not schedule control dead
826 * code. Uses dominator information which it computes if the irg is not
827 * in state dom_consistent. Destroys the out information as it moves nodes
828 * to other blocks. Optimizes Tuples in Control edges.
830 * Call remove_critical_cf_edges() before place_code(). This normalizes
831 * the control flow graph so that for all operations a basic block exists
832 * where they can be optimally placed.
834 FIRM_API void place_code(ir_graph *irg);
837 * Creates an ir_graph pass for place_code().
838 * This pass enables GCSE, runs optimize_graph_df() and finally
841 * @param name the name of this pass or NULL
843 * @return the newly created ir_graph pass
845 FIRM_API ir_graph_pass_t *place_code_pass(const char *name);
848 * Determines information about the values of nodes and perform simplifications
849 * using this information. This optimization performs a data-flow analysis to
850 * find the minimal fixpoint.
852 FIRM_API void fixpoint_vrp(ir_graph*);
855 * Creates an ir_graph pass for fixpoint_vrp().
856 * This pass dDetermines information about the values of nodes
857 * and perform simplifications using this information.
858 * This optimization performs a data-flow analysis to
859 * find the minimal fixpoint.
861 * @param name the name of this pass or NULL
863 * @return the newly created ir_graph pass
865 FIRM_API ir_graph_pass_t *fixpoint_vrp_irg_pass(const char *name);
868 * Checks if the value of a node is != 0.
870 * This is a often needed case, so we handle here Confirm
873 * @param n a node representing the value
874 * @param confirm if n is confirmed to be != 0, returns
875 * the the Confirm-node, else NULL
877 FIRM_API int value_not_zero(const ir_node *n, const ir_node **confirm);
880 * Checks if the value of a node cannot represent a NULL pointer.
882 * - If option sel_based_null_check_elim is enabled, all
883 * Sel nodes can be skipped.
884 * - A SymConst(entity) is NEVER a NULL pointer
885 * - A Const != NULL is NEVER a NULL pointer
886 * - Confirms are evaluated
888 * @param n a node representing the value
889 * @param confirm if n is confirmed to be != NULL, returns
890 * the the Confirm-node, else NULL
892 FIRM_API int value_not_null(const ir_node *n, const ir_node **confirm);
895 * Checks if the value of a node can be confirmed >= 0 or <= 0,
896 * If the mode of the value did not honor signed zeros, else
897 * check for >= 0 or < 0.
899 * @param n a node representing the value
901 FIRM_API ir_value_classify_sign classify_value_sign(ir_node *n);
904 * Returns the value of a Cmp if one or both predecessors are Confirm nodes.
906 * @param cmp the compare node that will be evaluated
907 * @param left the left operand of the Cmp
908 * @param right the right operand of the Cmp
909 * @param relation the compare relation
911 FIRM_API ir_tarval *computed_value_Cmp_Confirm(
912 const ir_node *cmp, ir_node *left, ir_node *right, ir_relation relation);
914 /** Type of callbacks for creating entities of the compiler library */
915 typedef ir_entity *(*compilerlib_entity_creator_t)(ident *id, ir_type *mt);
918 * Sets the compilerlib entity creation callback that is used to create
919 * compilerlib function entities.
921 * @param cb the new compilerlib entity creation callback
923 FIRM_API void set_compilerlib_entity_creator(compilerlib_entity_creator_t cb);
925 /** Returns the compilerlib entity creation callback. */
926 FIRM_API compilerlib_entity_creator_t get_compilerlib_entity_creator(void);
929 * Constructs the entity for a given function using the current compilerlib
930 * entity creation callback.
932 * @param id the identifier of the compilerlib function
933 * @param mt the method type of the compilerlib function
935 FIRM_API ir_entity *create_compilerlib_entity(ident *id, ir_type *mt);