implemented a function to retrieve estimated costs of an op
[libfirm] / ir / be / beirgmod.h
1
2 /**
3  * IRG modifications for be routines.
4  * @date 4.5.2005
5  *
6  * Copyright (C) 2005 Universitaet Karlsruhe.
7  * Released under the GPL.
8  */
9
10 #ifndef _BEIRGMOD_H
11 #define _BEIRGMOD_H
12
13 #include "firm_types.h"
14 #include "pset.h"
15
16 /*
17  * Forward type declaration.
18  */
19 typedef struct _dom_front_info_t dom_front_info_t;
20
21 /**
22  * Compute the dominance frontiers for a given graph.
23  * @param  irg The graphs.
24  * @return A pointer to the dominance frontier information.
25  */
26 dom_front_info_t *be_compute_dominance_frontiers(ir_graph *irg);
27
28 /**
29  * Get the dominance frontier of a block.
30  * @param info  A pointer to the dominance frontier information.
31  * @param block The block whose dominance frontier you want.
32  * @return A set containing the all blocks in the dominance frontier of @p block.
33  */
34 pset *be_get_dominance_frontier(dom_front_info_t *info, ir_node *block);
35
36 /**
37  * Free some dominance frontier information.
38  * @param info Some dominance frontier information.
39  */
40 void be_free_dominance_frontiers(dom_front_info_t *info);
41
42 /**
43  * Introduce several copies for one node.
44  *
45  * A copy in this context means, that you want to introduce several new
46  * abstract values (in Firm: nodes) for which you know, that they
47  * represent the same concrete value. This is the case if you
48  * - copy
49  * - spill and reload
50  * - re-materialize
51  * a value.
52  *
53  * This function reroutes all uses of the original value to the copies in the
54  * corresponding dominance subtrees and creates Phi functions if necessary.
55  *
56  * @param info            Dominance frontier information.
57  * @param n           Length of nodes array.
58  * @param nodes       The nodes which shall represent the same SSA value.
59  * @param phis        A set to which all inserted Phis are added.
60  * @param ignore_uses A set of nodes probably using one of the nodes in @p nodes.
61  *                    Their usage will not adjusted. They remain untouched by this function.
62  * @param uses        A set of nodes that are only considered for adjusting. Set to NULL
63                       to consider all uses except @p ignore_uses.
64  */
65 void be_ssa_constr_phis_ignore(dom_front_info_t *info, int n, ir_node *nodes[], pset *phis, pset *ignore_uses, pset *uses);
66
67 /**
68  * Same as be_ssa_constr_phis_ignore() but without the ignore set.
69  */
70 void be_ssa_constr_phis(dom_front_info_t *info, int n, ir_node *nodes[], pset *phis);
71
72 /**
73  * Same as be_ssa_constr_phis_ignore() but without the Phi set.
74  */
75 void be_ssa_constr_ignore(dom_front_info_t *info, int n, ir_node *nodes[], pset *ignore_uses);
76
77 /**
78  * Same as be_ssa_constr_ignore() but with empty ignore set.
79  */
80 void be_ssa_constr(dom_front_info_t *info, int n, ir_node *nodes[]);
81
82 /**
83  * Same as be_ssa_constr_ignore() but with pset instead of array.
84  */
85 void be_ssa_constr_set_ignore(dom_front_info_t *df, pset *nodes, pset *ignore_uses);
86
87 /**
88  * Same as be_ssa_constr() but with pset instead of array.
89  */
90 void be_ssa_constr_set(dom_front_info_t *info, pset *nodes);
91
92 /**
93  * Same as be_ssa_constr_set() but with uses.
94  */
95 void be_ssa_constr_set_uses(dom_front_info_t *info, pset *nodes, pset *uses);
96
97 /**
98  * Same as be_ssa_constr_phis_ignore() but with set instead of array.
99  */
100 void be_ssa_constr_set_phis_ignore(dom_front_info_t *info, pset *nodes, pset *phis, pset *ignore, pset *uses);
101
102 /**
103  * Same as be_ssa_constr_phis_ignore() but without ignore set.
104  */
105 void be_ssa_constr_set_phis(dom_front_info_t *info, pset *nodes, pset *phis);
106
107 /**
108  * Insert a Perm which permutates all (non-ignore) live values of a given register class
109  * after a certain instruction.
110  * @param arch_env  The architecture environment.
111  * @param cls       The register class.
112  * @param dom_front Dominance frontier information.
113  * @param irn       The node to insert the Perm after.
114  * @return          The Perm or NULL if nothing was live before @p irn.
115  */
116 ir_node *insert_Perm_after(const arch_env_t *arch_env,
117                                                    const arch_register_class_t *cls,
118                                                    dom_front_info_t *dom_front,
119                                                    ir_node *irn);
120
121 #endif /* _BEIRGMOD_H */