projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jumps have a special irn flag now so beirgmod can identify them
[libfirm]
/
ir
/
be
/
beirgmod.c
diff --git
a/ir/be/beirgmod.c
b/ir/be/beirgmod.c
index
0023c2d
..
5c69c2f
100644
(file)
--- a/
ir/be/beirgmod.c
+++ b/
ir/be/beirgmod.c
@@
-57,14
+57,14
@@
#include "be_t.h"
#include "bechordal_t.h"
#include "be_t.h"
#include "bechordal_t.h"
-#include "bearch
_t
.h"
-#include "besched
_t
.h"
+#include "bearch.h"
+#include "besched.h"
#include "belive_t.h"
#include "belive_t.h"
-#include "benode
_t
.h"
+#include "benode.h"
#include "beutil.h"
#include "beinsn_t.h"
#include "bessaconstr.h"
#include "beutil.h"
#include "beinsn_t.h"
#include "bessaconstr.h"
-#include "beirg
_t
.h"
+#include "beirg.h"
#include "beirgmod.h"
#include "bemodule.h"
#include "beirgmod.h"
#include "bemodule.h"
@@
-85,7
+85,6
@@
ir_node *insert_Perm_after(be_irg_t *birg,
{
be_lv_t *lv = birg->lv;
ir_node *bl = is_Block(pos) ? pos : get_nodes_block(pos);
{
be_lv_t *lv = birg->lv;
ir_node *bl = is_Block(pos) ? pos : get_nodes_block(pos);
- ir_graph *irg = get_irn_irg(bl);
ir_nodeset_t live;
ir_nodeset_iterator_t iter;
ir_nodeset_t live;
ir_nodeset_iterator_t iter;
@@
-114,7
+113,7
@@
ir_node *insert_Perm_after(be_irg_t *birg,
}
ir_nodeset_destroy(&live);
}
ir_nodeset_destroy(&live);
- perm = be_new_Perm(cls,
irg,
bl, n, nodes);
+ perm = be_new_Perm(cls, bl, n, nodes);
sched_add_after(pos, perm);
free(nodes);
sched_add_after(pos, perm);
free(nodes);
@@
-125,7
+124,7
@@
ir_node *insert_Perm_after(be_irg_t *birg,
be_ssa_construction_env_t senv;
ir_mode *mode = get_irn_mode(perm_op);
be_ssa_construction_env_t senv;
ir_mode *mode = get_irn_mode(perm_op);
- ir_node *proj = new_r_Proj(
irg,
bl, perm, mode, i);
+ ir_node *proj = new_r_Proj(bl, perm, mode, i);
arch_set_irn_register(proj, reg);
curr = proj;
arch_set_irn_register(proj, reg);
curr = proj;
@@
-165,7
+164,8
@@
static void remove_empty_block(ir_node *block)
goto check_preds;
sched_foreach(block, node) {
goto check_preds;
sched_foreach(block, node) {
- if (! is_Jmp(node))
+ if (! is_Jmp(node)
+ && !(arch_irn_get_flags(node) & arch_irn_flags_simple_jump))
goto check_preds;
if (jump != NULL) {
/* we should never have 2 jumps in a block */
goto check_preds;
if (jump != NULL) {
/* we should never have 2 jumps in a block */
@@
-184,10
+184,23
@@
static void remove_empty_block(ir_node *block)
assert(succ_block == NULL);
succ_block = get_edge_src_irn(edge);
assert(succ_block == NULL);
succ_block = get_edge_src_irn(edge);
+ if (has_Block_entity(succ_block) && has_Block_entity(block)) {
+ /*
+ * Currently we can add only one label for a block.
+ * Therefore we cannot combine them if both block already have one.
+ */
+ goto check_preds;
+ }
set_irn_n(succ_block, pos, pred);
}
set_irn_n(succ_block, pos, pred);
}
+ if (has_Block_entity(block)) {
+ /* move the label to the successor block */
+ ir_entity *entity = get_Block_entity(block);
+ set_Block_entity(succ_block, entity);
+ }
+
/* there can be some non-scheduled Pin nodes left in the block, move them
* to the succ block (Pin) or pred block (Sync) */
foreach_out_edge_safe(block, edge, next) {
/* there can be some non-scheduled Pin nodes left in the block, move them
* to the succ block (Pin) or pred block (Sync) */
foreach_out_edge_safe(block, edge, next) {
@@
-201,8
+214,11
@@
static void remove_empty_block(ir_node *block)
assert(get_Block_MacroBlock(node) == block && "Wrong Block->Block edge");
continue;
}
assert(get_Block_MacroBlock(node) == block && "Wrong Block->Block edge");
continue;
}
+ /* we simply kill Pins, because there are some strange interactions
+ * between jump threading, which produce PhiMs with Pins, we simply
+ * kill the pins here, everything is scheduled anyway */
if (is_Pin(node)) {
if (is_Pin(node)) {
-
set_nodes_block(node, succ_block
);
+
exchange(node, get_Pin_op(node)
);
continue;
}
if (is_Sync(node)) {
continue;
}
if (is_Sync(node)) {
@@
-217,12
+233,6
@@
static void remove_empty_block(ir_node *block)
panic("Unexpected node %+F in block %+F with empty schedule", node, block);
}
panic("Unexpected node %+F in block %+F with empty schedule", node, block);
}
- if (has_Block_label(block)) {
- /* move the label to the successor block */
- ir_label_t label = get_Block_label(block);
- set_Block_label(succ_block, label);
- }
-
set_Block_cfgpred(block, 0, new_Bad());
kill_node(jump);
blocks_removed = 1;
set_Block_cfgpred(block, 0, new_Bad());
kill_node(jump);
blocks_removed = 1;