Commit a459f39c authored by Matthias Braun's avatar Matthias Braun
Browse files

revert transformation tactics to old style

[r15097]
parent c0092b45
...@@ -219,11 +219,20 @@ ir_node *be_pre_transform_node(ir_node *place) { ...@@ -219,11 +219,20 @@ ir_node *be_pre_transform_node(ir_node *place) {
return be_transform_node(place); return be_transform_node(place);
} }
static void pre_transform_anchor(int anchor)
{
ir_node *old_anchor_node = get_irn_n(env.old_anchor, anchor);
ir_node *transformed = be_transform_node(old_anchor_node);
set_irg_anchor(current_ir_graph, anchor, transformed);
}
/** /**
* Transforms all nodes. Deletes the old obstack and creates a new one. * Transforms all nodes. Deletes the old obstack and creates a new one.
*/ */
static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, void *cg) { static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform,
int i; void *cg)
{
int i;
ir_node *old_end, *new_anchor; ir_node *old_end, *new_anchor;
hook_dead_node_elim(irg, 1); hook_dead_node_elim(irg, 1);
...@@ -246,15 +255,16 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v ...@@ -246,15 +255,16 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v
waitq_put(env.worklist, anchor); waitq_put(env.worklist, anchor);
} }
new_anchor = new_Anchor(irg); new_anchor = new_Anchor(irg);
irg->anchor = new_anchor;
/* pre transform some anchors (so they are available in the other transform /* pre transform some anchors (so they are available in the other transform
* functions) */ * functions) */
set_irn_n(new_anchor, anchor_bad, be_transform_node(get_irg_anchor(irg, anchor_bad))); pre_transform_anchor(anchor_bad);
set_irn_n(new_anchor, anchor_no_mem, be_transform_node(get_irg_anchor(irg, anchor_no_mem))); pre_transform_anchor(anchor_no_mem);
set_irn_n(new_anchor, anchor_start_block, be_transform_node(get_irg_anchor(irg, anchor_start_block))); pre_transform_anchor(anchor_start_block);
set_irn_n(new_anchor, anchor_start, be_transform_node(get_irg_anchor(irg, anchor_start))); pre_transform_anchor(anchor_start);
set_irn_n(new_anchor, anchor_frame, be_transform_node(get_irg_anchor(irg, anchor_frame))); pre_transform_anchor(anchor_frame);
if (pre_transform) if (pre_transform)
(*pre_transform)(cg); (*pre_transform)(cg);
...@@ -268,7 +278,7 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v ...@@ -268,7 +278,7 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v
/* fix loops and set new anchors*/ /* fix loops and set new anchors*/
inc_irg_visited(irg); inc_irg_visited(irg);
for (i = get_irg_n_anchors(irg) - 1; i >= 0; --i) { for (i = get_irg_n_anchors(irg) - 1; i >= 0; --i) {
ir_node *anchor = get_irg_anchor(irg, i); ir_node *anchor = get_irn_n(env.old_anchor, i);
if (anchor == NULL) if (anchor == NULL)
continue; continue;
...@@ -277,8 +287,7 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v ...@@ -277,8 +287,7 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v
fix_loops(anchor); fix_loops(anchor);
set_irn_n(new_anchor, i, anchor); set_irn_n(new_anchor, i, anchor);
} }
irg->anchor = new_anchor; set_irn_n(new_anchor, -1, get_irg_anchor(irg, anchor_end_block));
set_irn_n(new_anchor, -1, get_irn_intra_n(new_anchor, anchor_end_block));
del_waitq(env.worklist); del_waitq(env.worklist);
free_End(old_end); free_End(old_end);
...@@ -289,16 +298,16 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v ...@@ -289,16 +298,16 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform, v
* Transform helper for blocks. * Transform helper for blocks.
*/ */
static ir_node *gen_Block(ir_node *node) { static ir_node *gen_Block(ir_node *node) {
ir_graph *irg = current_ir_graph; ir_graph *irg = current_ir_graph;
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_node *start_block = get_irg_anchor(irg, anchor_start_block); ir_node *old_start_block = get_irn_n(env.old_anchor, anchor_start_block);
ir_node *block; ir_node *block;
/* /*
* We replace the ProjX from the start node with a jump, * We replace the ProjX from the start node with a jump,
* so the startblock has no preds anymore now * so the startblock has no preds anymore now
*/ */
if (node == start_block) { if (node == old_start_block) {
return new_rd_Block(dbgi, irg, 0, NULL); return new_rd_Block(dbgi, irg, 0, NULL);
} }
......
...@@ -265,7 +265,8 @@ static int is_Const_1(ir_node *node) { ...@@ -265,7 +265,8 @@ static int is_Const_1(ir_node *node) {
*/ */
static ir_node *gen_Const(ir_node *node) { static ir_node *gen_Const(ir_node *node) {
ir_graph *irg = current_ir_graph; ir_graph *irg = current_ir_graph;
ir_node *block = be_transform_node(get_nodes_block(node)); ir_node *old_block = get_nodes_block(node);
ir_node *block = be_transform_node(old_block);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_mode *mode = get_irn_mode(node); ir_mode *mode = get_irn_mode(node);
...@@ -344,7 +345,8 @@ static ir_node *gen_Const(ir_node *node) { ...@@ -344,7 +345,8 @@ static ir_node *gen_Const(ir_node *node) {
*/ */
static ir_node *gen_SymConst(ir_node *node) { static ir_node *gen_SymConst(ir_node *node) {
ir_graph *irg = current_ir_graph; ir_graph *irg = current_ir_graph;
ir_node *block = be_transform_node(get_nodes_block(node)); ir_node *old_block = get_nodes_block(node);
ir_node *block = be_transform_node(old_block);
dbg_info *dbgi = get_irn_dbg_info(node); dbg_info *dbgi = get_irn_dbg_info(node);
ir_mode *mode = get_irn_mode(node); ir_mode *mode = get_irn_mode(node);
ir_node *cnst; ir_node *cnst;
...@@ -1444,7 +1446,8 @@ static ir_node *gen_Abs(ir_node *node) { ...@@ -1444,7 +1446,8 @@ static ir_node *gen_Abs(ir_node *node) {
* @return the created ia32 Load node * @return the created ia32 Load node
*/ */
static ir_node *gen_Load(ir_node *node) { static ir_node *gen_Load(ir_node *node) {
ir_node *block = be_transform_node(get_nodes_block(node)); ir_node *old_block = get_nodes_block(node);
ir_node *block = be_transform_node(old_block);
ir_node *ptr = get_Load_ptr(node); ir_node *ptr = get_Load_ptr(node);
ir_node *new_ptr = be_transform_node(ptr); ir_node *new_ptr = be_transform_node(ptr);
ir_node *mem = get_Load_mem(node); ir_node *mem = get_Load_mem(node);
...@@ -2362,13 +2365,10 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type) ...@@ -2362,13 +2365,10 @@ ir_node *try_create_Immediate(ir_node *node, char immediate_constraint_type)
irg = current_ir_graph; irg = current_ir_graph;
dbgi = get_irn_dbg_info(node); dbgi = get_irn_dbg_info(node);
block = get_irg_start_block(irg); block = get_irg_start_block(irg);
res = new_rd_ia32_Immediate(dbgi, irg, block, symconst_ent, symconst_sign, res = new_rd_ia32_Immediate(dbgi, irg, block, symconst_ent,
val); symconst_sign, val);
arch_set_irn_register(env_cg->arch_env, res, &ia32_gp_regs[REG_GP_NOREG]); arch_set_irn_register(env_cg->arch_env, res, &ia32_gp_regs[REG_GP_NOREG]);
/* make sure we don't schedule stuff before the barrier */
add_irn_dep(res, get_irg_frame(irg));
return res; return res;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment