projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
we can do without the odd align.h
[libfirm]
/
ir
/
ana
/
irextbb.c
diff --git
a/ir/ana/irextbb.c
b/ir/ana/irextbb.c
index
e2d93f5
..
0e1a17e
100644
(file)
--- a/
ir/ana/irextbb.c
+++ b/
ir/ana/irextbb.c
@@
-24,9
+24,7
@@
* @date 5.2005
* @version $Id$
*/
* @date 5.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
#include "irextbb_t.h"
#include "irgwalk.h"
#include "irextbb_t.h"
#include "irgwalk.h"
@@
-46,15
+44,17
@@
typedef struct _env {
ir_node *start_block; /**< the start block of the current graph */
} env_t;
ir_node *start_block; /**< the start block of the current graph */
} env_t;
-int (is_ir_extbb)(const void *thing) {
+int (is_ir_extbb)(const void *thing)
+{
return _is_ir_extbb(thing);
}
/**
* allocate a new extended block header.
*/
return _is_ir_extbb(thing);
}
/**
* allocate a new extended block header.
*/
-static void allocate_extblk(ir_node *block, env_t *env) {
- ir_extblk *extblk = obstack_alloc(env->obst, sizeof(*extblk));
+static void allocate_extblk(ir_node *block, env_t *env)
+{
+ ir_extblk *extblk = OALLOC(env->obst, ir_extblk);
extblk->kind = k_ir_extblk;
extblk->visited = 1;
extblk->kind = k_ir_extblk;
extblk->visited = 1;
@@
-70,7
+70,8
@@
static void allocate_extblk(ir_node *block, env_t *env) {
* Returns the number of block successors.
* we are interested only in 1, 2 and >2.
*/
* Returns the number of block successors.
* we are interested only in 1, 2 and >2.
*/
-static int get_block_n_succs(ir_node *block) {
+static int get_block_n_succs(ir_node *block)
+{
if (edges_activated(current_ir_graph)) {
const ir_edge_t *edge;
if (edges_activated(current_ir_graph)) {
const ir_edge_t *edge;
@@
-89,7
+90,8
@@
static int get_block_n_succs(ir_node *block) {
/**
* Pre block-walker. Calculates the extended block info.
*/
/**
* Pre block-walker. Calculates the extended block info.
*/
-static void pre_walk_calc_extbb(ir_node *block, void *ctx) {
+static void pre_walk_calc_extbb(ir_node *block, void *ctx)
+{
int n = get_Block_n_cfgpreds(block);
env_t *env = ctx;
int n = get_Block_n_cfgpreds(block);
env_t *env = ctx;
@@
-178,7
+180,7
@@
static void post_walk_calc_extbb(ir_node *block, void *ctx)
/* replace all sentinels by the extbb info */
prev = block;
list = NULL;
/* replace all sentinels by the extbb info */
prev = block;
list = NULL;
-
while (1
) {
+
for (;;
) {
if (get_Block_extbb(prev) != sentinel)
break;
set_irn_link(prev, list);
if (get_Block_extbb(prev) != sentinel)
break;
set_irn_link(prev, list);
@@
-199,7
+201,8
@@
static void post_walk_calc_extbb(ir_node *block, void *ctx)
/*
* Compute the extended basic blocks for a graph
*/
/*
* Compute the extended basic blocks for a graph
*/
-void compute_extbb(ir_graph *irg) {
+void compute_extbb(ir_graph *irg)
+{
env_t env;
ir_extblk *extbb, *next;
env_t env;
ir_extblk *extbb, *next;
@@
-267,7
+270,8
@@
void compute_extbb(ir_graph *irg) {
}
/* free all extended block info. */
}
/* free all extended block info. */
-void free_extbb(ir_graph *irg) {
+void free_extbb(ir_graph *irg)
+{
if (irg->extbb_obst) {
obstack_free(irg->extbb_obst, NULL);
xfree(irg->extbb_obst);
if (irg->extbb_obst) {
obstack_free(irg->extbb_obst, NULL);
xfree(irg->extbb_obst);
@@
-277,67
+281,80
@@
void free_extbb(ir_graph *irg) {
}
/* Return the extended block of a node. */
}
/* Return the extended block of a node. */
-ir_extblk *get_nodes_extbb(ir_node *node) {
- ir_node *block = is_Block(node) ? node : get_irn_n(node, -1);
+ir_extblk *get_nodes_extbb(const ir_node *node)
+{
+ const ir_node *block = is_Block(node) ? node : get_nodes_block(node);
return get_Block_extbb(block);
}
/* Gets the visited counter of an extended block. */
return get_Block_extbb(block);
}
/* Gets the visited counter of an extended block. */
-ir_visited_t (get_extbb_visited)(const ir_extblk *blk) {
+ir_visited_t (get_extbb_visited)(const ir_extblk *blk)
+{
return _get_extbb_visited(blk);
}
/* Sets the visited counter of an extended block. */
return _get_extbb_visited(blk);
}
/* Sets the visited counter of an extended block. */
-void (set_extbb_visited)(ir_extblk *blk, ir_visited_t visited) {
+void (set_extbb_visited)(ir_extblk *blk, ir_visited_t visited)
+{
_set_extbb_visited(blk, visited);
}
/* Mark an extended block as visited in a graph. */
_set_extbb_visited(blk, visited);
}
/* Mark an extended block as visited in a graph. */
-void (mark_extbb_visited)(ir_extblk *blk) {
+void (mark_extbb_visited)(ir_extblk *blk)
+{
_mark_extbb_visited(blk);
}
/* Returns non-zero if an extended was visited. */
_mark_extbb_visited(blk);
}
/* Returns non-zero if an extended was visited. */
-int (extbb_visited)(const ir_extblk *blk) {
+int (extbb_visited)(const ir_extblk *blk)
+{
return _extbb_visited(blk);
}
/* Returns non-zero if an extended block was NOT visited. */
return _extbb_visited(blk);
}
/* Returns non-zero if an extended block was NOT visited. */
-int (extbb_not_visited)(const ir_extblk *blk) {
+int (extbb_not_visited)(const ir_extblk *blk)
+{
return _extbb_not_visited(blk);
}
/* Returns the link field of an extended block. */
return _extbb_not_visited(blk);
}
/* Returns the link field of an extended block. */
-void *(get_extbb_link)(const ir_extblk *blk) {
+void *(get_extbb_link)(const ir_extblk *blk)
+{
return _get_extbb_link(blk);
}
/* Sets the link field of an extended block. */
return _get_extbb_link(blk);
}
/* Sets the link field of an extended block. */
-void (set_extbb_link)(ir_extblk *blk, void *link) {
+void (set_extbb_link)(ir_extblk *blk, void *link)
+{
_set_extbb_link(blk, link);
}
/* Return the number of basic blocks of an extended block */
_set_extbb_link(blk, link);
}
/* Return the number of basic blocks of an extended block */
-int (get_extbb_n_blocks)(const ir_extblk *blk) {
+int (get_extbb_n_blocks)(const ir_extblk *blk)
+{
return _get_extbb_n_blocks(blk);
}
/* Return the i'th basic block of an extended block */
return _get_extbb_n_blocks(blk);
}
/* Return the i'th basic block of an extended block */
-ir_node *(get_extbb_block)(ir_extblk *blk, int pos) {
+ir_node *(get_extbb_block)(const ir_extblk *blk, int pos)
+{
return _get_extbb_block(blk, pos);
}
/* Return the leader basis block of an extended block. */
return _get_extbb_block(blk, pos);
}
/* Return the leader basis block of an extended block. */
-ir_node *(get_extbb_leader)(ir_extblk *blk) {
+ir_node *(get_extbb_leader)(const ir_extblk *blk)
+{
return _get_extbb_leader(blk);
}
/* Return the node number of an extended block. */
return _get_extbb_leader(blk);
}
/* Return the node number of an extended block. */
-long get_extbb_node_nr(ir_extblk *blk) {
+long get_extbb_node_nr(const ir_extblk *blk)
+{
return get_irn_node_nr(get_extbb_leader(blk));
}
return get_irn_node_nr(get_extbb_leader(blk));
}
-static void irg_extblock_walk_2(ir_extblk *blk, extbb_walk_func *pre, extbb_walk_func *post, void *env) {
+static void irg_extblock_walk_2(ir_extblk *blk, extbb_walk_func *pre, extbb_walk_func *post, void *env)
+{
int i;
ir_node *node;
int i;
ir_node *node;
@@
-365,7
+382,8
@@
static void irg_extblock_walk_2(ir_extblk *blk, extbb_walk_func *pre, extbb_walk
/* walks only over extended Block nodes in the graph. Has it's own visited
flag, so that it can be interleaved with the other walker. */
/* walks only over extended Block nodes in the graph. Has it's own visited
flag, so that it can be interleaved with the other walker. */
-void irg_extblock_walk(ir_extblk *blk, extbb_walk_func *pre, extbb_walk_func *post, void *env) {
+void irg_extblock_walk(ir_extblk *blk, extbb_walk_func *pre, extbb_walk_func *post, void *env)
+{
ir_node *pred, *start_bl = get_irg_start_block(current_ir_graph);
ir_extblk *start_blk = get_Block_extbb(start_bl);
int i;
ir_node *pred, *start_bl = get_irg_start_block(current_ir_graph);
ir_extblk *start_blk = get_Block_extbb(start_bl);
int i;
@@
-403,7
+421,8
@@
void irg_extblock_walk(ir_extblk *blk, extbb_walk_func *pre, extbb_walk_func *po
}
/* Walks only over reachable Extended Basic Block nodes in the graph. */
}
/* Walks only over reachable Extended Basic Block nodes in the graph. */
-void irg_extblock_walk_graph(ir_graph *irg, extbb_walk_func *pre, extbb_walk_func *post, void *env) {
+void irg_extblock_walk_graph(ir_graph *irg, extbb_walk_func *pre, extbb_walk_func *post, void *env)
+{
ir_node *endbl = get_irg_end_block(irg);
ir_extblk *blk = get_Block_extbb(endbl);
ir_graph *rem = current_ir_graph;
ir_node *endbl = get_irg_end_block(irg);
ir_extblk *blk = get_Block_extbb(endbl);
ir_graph *rem = current_ir_graph;