projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add temporary fix for conv-problems
[libfirm]
/
ir
/
ana
/
irextbb2.c
diff --git
a/ir/ana/irextbb2.c
b/ir/ana/irextbb2.c
index
5e1ef70
..
310c2a7
100644
(file)
--- a/
ir/ana/irextbb2.c
+++ b/
ir/ana/irextbb2.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-200
7
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-200
8
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-23,13
+23,11
@@
* @author Matthias Braun
* @date 5.2005
* @version $Id$
* @author Matthias Braun
* @date 5.2005
* @version $Id$
- * @
summary
+ * @
brief
* Alternative algorithm for computing extended basic blocks (using out edges
* and execution frequencies)
*/
* Alternative algorithm for computing extended basic blocks (using out edges
* and execution frequencies)
*/
-#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"
@@
-52,7
+50,7
@@
typedef struct _env {
*/
static ir_extblk *allocate_extblk(ir_node *block, env_t *env)
{
*/
static ir_extblk *allocate_extblk(ir_node *block, env_t *env)
{
- ir_extblk *extblk =
obstack_alloc(env->obst, sizeof(*extblk)
);
+ ir_extblk *extblk =
OALLOC(env->obst, ir_extblk
);
extblk->kind = k_ir_extblk;
extblk->visited = 1;
extblk->kind = k_ir_extblk;
extblk->visited = 1;
@@
-84,7
+82,8
@@
static void addto_extblk(ir_extblk *extblk, ir_node *block)
* 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;
@@
-109,11
+108,10
@@
static void create_extblk(ir_node *block, env_t *env)
{
ir_extblk *extblk;
{
ir_extblk *extblk;
- if (irn_visited(block))
+ if (irn_visited
_else_mark
(block))
return;
extblk = allocate_extblk(block, env);
return;
extblk = allocate_extblk(block, env);
- mark_irn_visited(block);
pick_successor(block, extblk, env);
}
pick_successor(block, extblk, env);
}
@@
-130,8
+128,6
@@
static void pick_successor(ir_node *block, ir_extblk *extblk, env_t *env)
basic block, so create a new one here.
*/
if (get_block_n_succs(block) > 2) {
basic block, so create a new one here.
*/
if (get_block_n_succs(block) > 2) {
- const ir_edge_t *edge;
-
foreach_block_succ(block, edge) {
ir_node *succ = get_edge_src_irn(edge);
create_extblk(succ, env);
foreach_block_succ(block, edge) {
ir_node *succ = get_edge_src_irn(edge);
create_extblk(succ, env);
@@
-144,10
+140,10
@@
static void pick_successor(ir_node *block, ir_extblk *extblk, env_t *env)
ir_node *succ = get_edge_src_irn(edge);
double execfreq;
ir_node *succ = get_edge_src_irn(edge);
double execfreq;
- if(irn_visited(succ))
+ if
(irn_visited(succ))
continue;
continue;
- if(get_Block_n_cfgpreds(succ) > 1) {
+ if
(get_Block_n_cfgpreds(succ) > 1) {
create_extblk(succ, env);
continue;
}
create_extblk(succ, env);
continue;
}
@@
-172,7
+168,7
@@
static void pick_successor(ir_node *block, ir_extblk *extblk, env_t *env)
}
/* add best successor and recursively try to pick more */
}
/* add best successor and recursively try to pick more */
- if(best_succ != NULL) {
+ if
(best_succ != NULL) {
addto_extblk(extblk, best_succ);
mark_irn_visited(best_succ);
pick_successor(best_succ, extblk, env);
addto_extblk(extblk, best_succ);
mark_irn_visited(best_succ);
pick_successor(best_succ, extblk, env);
@@
-182,7
+178,8
@@
static void pick_successor(ir_node *block, ir_extblk *extblk, env_t *env)
/*
* Compute the extended basic blocks for a graph
*/
/*
* Compute the extended basic blocks for a graph
*/
-void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs) {
+void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs)
+{
env_t env;
ir_extblk *extbb, *next;
ir_node *endblock;
env_t env;
ir_extblk *extbb, *next;
ir_node *endblock;
@@
-191,7
+188,7
@@
void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs) {
obstack_free(irg->extbb_obst, NULL);
}
else {
obstack_free(irg->extbb_obst, NULL);
}
else {
- irg->extbb_obst =
xmalloc(sizeof(*irg->extbb_obst)
);
+ irg->extbb_obst =
XMALLOC(struct obstack
);
}
obstack_init(irg->extbb_obst);
}
obstack_init(irg->extbb_obst);
@@
-207,9
+204,7
@@
void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs) {
/* the end block needs a extbb assigned (even for endless loops) */
endblock = get_irg_end_block(irg);
/* the end block needs a extbb assigned (even for endless loops) */
endblock = get_irg_end_block(irg);
- if (! irn_visited(endblock)) {
- create_extblk(endblock, &env);
- }
+ create_extblk(endblock, &env);
/*
Ok, we have now the list of all extended blocks starting with env.head
/*
Ok, we have now the list of all extended blocks starting with env.head
@@
-236,8
+231,8
@@
void compute_extbb_execfreqs(ir_graph *irg, ir_exec_freq *execfreqs) {
}
#if 0
}
#if 0
- for(i = 0; i < len; ++i) {
- if(i > 0)
+ for
(i = 0; i < len; ++i) {
+ if
(i > 0)
printf(", ");
ir_printf("%+F", extbb->blks[i]);
}
printf(", ");
ir_printf("%+F", extbb->blks[i]);
}