2 * This file contains the following IRG modifications for be routines:
3 * - backend dominance information
4 * - SSA construction for a set of nodes
5 * - insertion of Perm nodes
6 * - empty block elimination
7 * - a simple dead node elimination (set inputs of unreachable nodes to BAD)
9 * Author: Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
11 * Copyright: (c) Universitaet Karlsruhe
12 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
19 #include "firm_types.h"
25 * Forward type declaration.
27 typedef struct _be_dom_front_info_t be_dom_front_info_t;
30 * Compute the dominance frontiers for a given graph.
31 * @param irg The graphs.
32 * @return A pointer to the dominance frontier information.
34 be_dom_front_info_t *be_compute_dominance_frontiers(ir_graph *irg);
37 * Get the dominance frontier of a block.
38 * @param info A pointer to the dominance frontier information.
39 * @param block The block whose dominance frontier you want.
40 * @return A list containing the all blocks in the dominance frontier of @p block.
42 ir_node **be_get_dominance_frontier(be_dom_front_info_t *info, ir_node *block);
45 * Free some dominance frontier information.
46 * @param info Some dominance frontier information.
48 void be_free_dominance_frontiers(be_dom_front_info_t *info);
51 * Introduce several copies for one node.
53 * A copy in this context means, that you want to introduce several new
54 * abstract values (in Firm: nodes) for which you know, that they
55 * represent the same concrete value. This is the case if you
61 * This function reroutes all uses of the original value to the copies in the
62 * corresponding dominance subtrees and creates Phi functions if necessary.
64 * @param info Dominance frontier information.
65 * @param lv Liveness information to be updated. If NULL, liveness updating is simply ignored.
66 * @param n Length of nodes array.
67 * @param nodes The nodes which shall represent the same SSA value.
68 * @param phis A set to which all inserted Phis are added.
69 * @param ignore_uses A set of nodes probably using one of the nodes in @p nodes.
70 * Their usage will not adjusted. They remain untouched by this function.
72 void be_ssa_constr_phis_ignore(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[], pset *phis, pset *ignore_uses);
75 * Same as be_ssa_constr_phis_ignore() but without the ignore set.
77 void be_ssa_constr_phis(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[], pset *phis);
80 * Same as be_ssa_constr_phis_ignore() but without the Phi set.
82 void be_ssa_constr_ignore(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[], pset *ignore_uses);
85 * Same as be_ssa_constr_ignore() but with empty ignore set.
87 void be_ssa_constr(be_dom_front_info_t *info, be_lv_t *lv, int n, ir_node *nodes[]);
90 * Same as be_ssa_constr_ignore() but with pset instead of array.
92 void be_ssa_constr_set_ignore(be_dom_front_info_t *df, be_lv_t *lv, pset *nodes, pset *ignore_uses);
95 * Same as be_ssa_constr() but with pset instead of array.
97 void be_ssa_constr_set(be_dom_front_info_t *info, be_lv_t *lv, pset *nodes);
100 * Same as be_ssa_constr_phis_ignore() but with set instead of array.
102 void be_ssa_constr_set_phis_ignore(be_dom_front_info_t *info, be_lv_t *lv, pset *nodes, pset *phis, pset *ignore);
105 * Same as be_ssa_constr_phis_ignore() but without ignore set.
107 void be_ssa_constr_set_phis(be_dom_front_info_t *info, be_lv_t *lv, pset *nodes, pset *phis);
110 * Insert a Perm which permutes all (non-ignore) live values of a given register class
111 * after a certain instruction.
112 * @param arch_env The architecture environment.
113 * @param lv Liveness Information.
114 * @param cls The register class.
115 * @param dom_front Dominance frontier information.
116 * @param irn The node to insert the Perm after.
117 * @return The Perm or NULL if nothing was live before @p irn.
119 ir_node *insert_Perm_after(const arch_env_t *arch_env,
121 const arch_register_class_t *cls,
122 be_dom_front_info_t *dom_front,
125 struct _be_chordal_env_t;
127 void extreme_liverange_splitting(struct _be_chordal_env_t *cenv);
130 * Removes basic blocks that only contain a jump instruction
131 * (this will potentially create critical edges).
133 * @param irg the graph that will be changed
135 * @return non-zero if the graph was changed, zero else
137 int be_remove_empty_blocks(ir_graph *irg);
140 * Set input of all nodes only reachable via out edges to BAD.
141 * @param irg The irg to check.
143 void be_kill_dead_nodes(ir_graph *irg);
145 #endif /* _BEIRGMOD_H */