2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Backend IRG modification routines.
23 * @author Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
27 * This file contains the following IRG modifications for be routines:
28 * - insertion of Perm nodes
29 * - empty block elimination
30 * - a simple dead node elimination (set inputs of unreachable nodes to BAD)
32 #ifndef FIRM_BE_BEIRGMOD_H
33 #define FIRM_BE_BEIRGMOD_H
40 * Introduce several copies for one node.
42 * A copy in this context means, that you want to introduce several new
43 * abstract values (in Firm: nodes) for which you know, that they
44 * represent the same concrete value. This is the case if you
50 * This function reroutes all uses of the original value to the copies in the
51 * corresponding dominance subtrees and creates Phi functions where necessary.
53 * @note The visited flag and link fields are used.
55 * @param info Dominance frontier information.
56 * @param lv Liveness information to be updated. If NULL, no liveness
57 * updating is performed.
58 * @param value The value that has been duplicated.
59 * @param copies_len the length of the copies array
60 * @param copie an array holding all copies of the value
61 * @param phis An ARR_F where all newly created phis will be inserted,
63 * @param ignore_uses A set of nodes probably using one of the nodes in
64 * @p nodes. Their usage will not adjusted. They remain
65 * untouched by this function. May be NULL.
67 ir_node **be_ssa_construction(const be_dom_front_info_t *info, be_lv_t *lv,
68 ir_node *value, int copies_len, ir_node **copies,
69 const ir_nodeset_t *ignore_uses, int need_new_phis);
72 void be_ssa_constr_set_ignore(const be_dom_front_info_t *info, be_lv_t *lv,
73 pset *nodes, pset *ignores);
77 * Insert a Perm which permutes all (non-ignore) live values of a given register class
78 * after a certain instruction.
79 * @param lv Liveness Information.
80 * @param irn The node to insert the Perm after.
81 * @return The Perm or NULL if nothing was live before @p irn.
83 ir_node *insert_Perm_after(be_irg_t *birg, const arch_register_class_t *cls,
87 * Removes basic blocks that only contain a jump instruction
88 * (this will potentially create critical edges).
90 * @param irg the graph that will be changed
92 * @return non-zero if the graph was changed, zero else
94 int be_remove_empty_blocks(ir_graph *irg);
96 #endif /* FIRM_BE_BEIRGMOD_H */