projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed warning.
[libfirm]
/
ir
/
opt
/
return.c
diff --git
a/ir/opt/return.c
b/ir/opt/return.c
index
796baeb
..
5eca06b
100644
(file)
--- a/
ir/opt/return.c
+++ b/
ir/opt/return.c
@@
-30,6
+30,7
@@
#include "ircons_t.h"
#include "irnode_t.h"
#include "irgmod.h"
#include "ircons_t.h"
#include "irnode_t.h"
#include "irgmod.h"
+#include "irpass.h"
#define set_bit(n) (returns[(n) >> 3] |= 1 << ((n) & 7))
#define get_bit(n) (returns[(n) >> 3] & (1 << ((n) & 7)))
#define set_bit(n) (returns[(n) >> 3] |= 1 << ((n) & 7))
#define get_bit(n) (returns[(n) >> 3] & (1 << ((n) & 7)))
@@
-57,7
+58,8
@@
* res = c;
* return res;
*/
* res = c;
* return res;
*/
-void normalize_one_return(ir_graph *irg) {
+void normalize_one_return(ir_graph *irg)
+{
ir_node *endbl = get_irg_end_block(irg);
int i, j, k, n, last_idx, n_rets, n_ret_vals = -1;
unsigned char *returns;
ir_node *endbl = get_irg_end_block(irg);
int i, j, k, n, last_idx, n_rets, n_ret_vals = -1;
unsigned char *returns;
@@
-166,6
+168,12
@@
void normalize_one_return(ir_graph *irg) {
set_irg_loopinfo_inconsistent(irg);
}
set_irg_loopinfo_inconsistent(irg);
}
+/* Create a graph pass. */
+ir_graph_pass_t *normalize_one_return_pass(const char *name)
+{
+ return def_graph_pass(name ? name : "one_ret", normalize_one_return);
+}
+
/**
* Check, whether a Return can be moved on block upwards.
*
/**
* Check, whether a Return can be moved on block upwards.
*
@@
-182,7
+190,8
@@
void normalize_one_return(ir_graph *irg) {
* All predecessors of the Return block must be Jmp's of course, or we
* cannot move it up, so we add blocks if needed.
*/
* All predecessors of the Return block must be Jmp's of course, or we
* cannot move it up, so we add blocks if needed.
*/
-static int can_move_ret(ir_node *ret) {
+static int can_move_ret(ir_node *ret)
+{
ir_node *retbl = get_nodes_block(ret);
int i, n = get_irn_arity(ret);
ir_node *retbl = get_nodes_block(ret);
int i, n = get_irn_arity(ret);
@@
-236,7
+245,8
@@
static int can_move_ret(ir_node *ret) {
* else
* return c;
*/
* else
* return c;
*/
-void normalize_n_returns(ir_graph *irg) {
+void normalize_n_returns(ir_graph *irg)
+{
int i, j, n, n_rets, n_finals, n_ret_vals;
ir_node *list = NULL;
ir_node *final = NULL;
int i, j, n, n_rets, n_finals, n_ret_vals;
ir_node *list = NULL;
ir_node *final = NULL;
@@
-373,3
+383,9
@@
void normalize_n_returns(ir_graph *irg) {
set_irg_outs_inconsistent(irg);
set_irg_loopinfo_inconsistent(current_ir_graph);
}
set_irg_outs_inconsistent(irg);
set_irg_loopinfo_inconsistent(current_ir_graph);
}
+
+/* Create a graph pass. */
+ir_graph_pass_t *normalize_n_returns_pass(const char *name)
+{
+ return def_graph_pass(name ? name : "n_rets", normalize_n_returns);
+}