X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Fircons.c;h=7cbd797d1db61d96e9f73b3f32ee860962de2136;hb=34bf5ac0969a125bb21e26bd893f6601ea175ff3;hp=b30e1a28eec547b9c8f8c12d184880af0a4fcd5e;hpb=cc4124203510eec76651c9ddf4d9d9f5129cb35e;p=libfirm diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index b30e1a28e..7cbd797d1 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -104,7 +104,7 @@ new_bd_##instr(dbg_info *db, ir_node *block, \ #define NEW_BD_DIVOP(instr) \ static ir_node * \ new_bd_##instr(dbg_info *db, ir_node *block, \ - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) \ + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) \ { \ ir_node *in[3]; \ ir_node *res; \ @@ -113,7 +113,7 @@ new_bd_##instr(dbg_info *db, ir_node *block, \ in[1] = op1; \ in[2] = op2; \ res = new_ir_node(db, irg, block, op_##instr, mode_T, 3, in); \ - res->attr.divmod.exc.pin_state = op_pin_state_pinned; \ + res->attr.divmod.exc.pin_state = state; \ res->attr.divmod.res_mode = mode; \ res = optimize_node(res); \ IRN_VRFY_IRG(res, irg); \ @@ -152,12 +152,12 @@ new_rd_##instr(dbg_info *db, ir_graph *irg, ir_node *block, \ #define NEW_RD_DIVOP(instr) \ ir_node * \ new_rd_##instr(dbg_info *db, ir_graph *irg, ir_node *block, \ - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) \ + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) \ { \ ir_node *res; \ ir_graph *rem = current_ir_graph; \ current_ir_graph = irg; \ - res = new_bd_##instr(db, block, memop, op1, op2, mode); \ + res = new_bd_##instr(db, block, memop, op1, op2, mode, state);\ current_ir_graph = rem; \ return res; \ } @@ -179,28 +179,36 @@ new_d_##instr(dbg_info *db, ir_node *op, ir_mode *mode) { \ /** * Constructs a Block with a fixed number of predecessors. - * Does not set current_block. Can not be used with automatic + * Does not set current_block. Cannot be used with automatic * Phi node construction. */ static ir_node * -new_bd_Block(dbg_info *db, int arity, ir_node **in) { +new_bd_Block(dbg_info *db, int arity, ir_node **in) { ir_node *res; ir_graph *irg = current_ir_graph; - res = new_ir_node (db, irg, NULL, op_Block, mode_BB, arity, in); - set_Block_matured(res, 1); - set_Block_block_visited(res, 0); + res = new_ir_node(db, irg, NULL, op_Block, mode_BB, arity, in); - res->attr.block.dead = 0; + /* macroblock header */ + res->in[0] = res; + + res->attr.block.is_dead = 0; + res->attr.block.is_mb_head = 1; + res->attr.block.has_label = 0; res->attr.block.irg = irg; res->attr.block.backedge = new_backedge_arr(irg->obst, arity); res->attr.block.in_cg = NULL; res->attr.block.cg_backedge = NULL; res->attr.block.extblk = NULL; + res->attr.block.mb_depth = 0; + res->attr.block.label = 0; + + set_Block_matured(res, 1); + set_Block_block_visited(res, 0); IRN_VRFY_IRG(res, irg); return res; - } /* new_bd_Block */ +} /* new_bd_Block */ static ir_node * new_bd_Start(dbg_info *db, ir_node *block) { @@ -250,7 +258,7 @@ new_bd_Phi(dbg_info *db, ir_node *block, int arity, ir_node **in, ir_mode *mode) break; } - if (!has_unknown) res = optimize_node (res); + if (!has_unknown) res = optimize_node(res); IRN_VRFY_IRG(res, irg); /* Memory Phis in endless loops must be kept alive. @@ -264,6 +272,7 @@ static ir_node * new_bd_Const_type(dbg_info *db, ir_node *block, ir_mode *mode, tarval *con, ir_type *tp) { ir_node *res; ir_graph *irg = current_ir_graph; + (void) block; res = new_ir_node(db, irg, get_irg_start_block(irg), op_Const, mode, 0, NULL); res->attr.con.tv = con; @@ -407,8 +416,8 @@ new_bd_Jmp(dbg_info *db, ir_node *block) { ir_node *res; ir_graph *irg = current_ir_graph; - res = new_ir_node (db, irg, block, op_Jmp, mode_X, 0, NULL); - res = optimize_node (res); + res = new_ir_node(db, irg, block, op_Jmp, mode_X, 0, NULL); + res = optimize_node(res); IRN_VRFY_IRG(res, irg); return res; } /* new_bd_Jmp */ @@ -418,12 +427,9 @@ new_bd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt) { ir_node *res; ir_graph *irg = current_ir_graph; - res = new_ir_node (db, irg, block, op_IJmp, mode_X, 1, &tgt); - res = optimize_node (res); + res = new_ir_node(db, irg, block, op_IJmp, mode_X, 1, &tgt); + res = optimize_node(res); IRN_VRFY_IRG(res, irg); - - if (get_irn_op(res) == op_IJmp) /* still an IJmp */ - keep_alive(res); return res; } /* new_bd_IJmp */ @@ -432,11 +438,11 @@ new_bd_Cond(dbg_info *db, ir_node *block, ir_node *c) { ir_node *res; ir_graph *irg = current_ir_graph; - res = new_ir_node (db, irg, block, op_Cond, mode_T, 1, &c); + res = new_ir_node(db, irg, block, op_Cond, mode_T, 1, &c); res->attr.cond.kind = dense; res->attr.cond.default_proj = 0; res->attr.cond.pred = COND_JMP_PRED_NONE; - res = optimize_node (res); + res = optimize_node(res); IRN_VRFY_IRG(res, irg); return res; } /* new_bd_Cond */ @@ -497,6 +503,7 @@ new_bd_Load(dbg_info *db, ir_node *block, res->attr.load.exc.pin_state = op_pin_state_pinned; res->attr.load.load_mode = mode; res->attr.load.volatility = volatility_non_volatile; + res->attr.load.aligned = align_is_aligned; res = optimize_node(res); IRN_VRFY_IRG(res, irg); return res; @@ -515,6 +522,7 @@ new_bd_Store(dbg_info *db, ir_node *block, res = new_ir_node(db, irg, block, op_Store, mode_T, 3, in); res->attr.store.exc.pin_state = op_pin_state_pinned; res->attr.store.volatility = volatility_non_volatile; + res->attr.store.aligned = align_is_aligned; res = optimize_node(res); IRN_VRFY_IRG(res, irg); return res; @@ -623,9 +631,9 @@ new_bd_Confirm(dbg_info *db, ir_node *block, ir_node *val, ir_node *bound, pn_Cm in[0] = val; in[1] = bound; - res = new_ir_node (db, irg, block, op_Confirm, get_irn_mode(val), 2, in); - res->attr.confirm_cmp = cmp; - res = optimize_node (res); + res = new_ir_node(db, irg, block, op_Confirm, get_irn_mode(val), 2, in); + res->attr.confirm.cmp = cmp; + res = optimize_node(res); IRN_VRFY_IRG(res, irg); return res; } /* new_bd_Confirm */ @@ -830,6 +838,28 @@ new_bd_Pin(dbg_info *db, ir_node *block, ir_node *node) { return res; } /* new_bd_Pin */ +static ir_node * +new_bd_ASM(dbg_info *db, ir_node *block, int arity, ir_node *in[], ir_asm_constraint *inputs, + int n_outs, ir_asm_constraint *outputs, int n_clobber, ident *clobber[], ident *asm_text) { + ir_node *res; + ir_graph *irg = current_ir_graph; + (void) clobber; + + res = new_ir_node(db, irg, block, op_ASM, mode_T, arity, in); + res->attr.assem.pin_state = op_pin_state_pinned; + res->attr.assem.inputs = NEW_ARR_D(ir_asm_constraint, irg->obst, arity); + res->attr.assem.outputs = NEW_ARR_D(ir_asm_constraint, irg->obst, n_outs); + res->attr.assem.clobber = NEW_ARR_D(ident *, irg->obst, n_clobber); + res->attr.assem.asm_text = asm_text; + + memcpy(res->attr.assem.inputs, inputs, sizeof(inputs[0]) * arity); + memcpy(res->attr.assem.outputs, outputs, sizeof(outputs[0]) * n_outs); + + res = optimize_node(res); + IRN_VRFY_IRG(res, irg); + return res; +} /* new_bd_ASM */ + /* --------------------------------------------- */ /* private interfaces, for professional use only */ /* --------------------------------------------- */ @@ -838,7 +868,7 @@ new_bd_Pin(dbg_info *db, ir_node *block, ir_node *node) { Does not set current_block. Can not be used with automatic Phi node construction. */ ir_node * -new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node **in) { +new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node **in) { ir_graph *rem = current_ir_graph; ir_node *res; @@ -866,7 +896,7 @@ new_rd_End(dbg_info *db, ir_graph *irg, ir_node *block) { ir_node *res; ir_graph *rem = current_ir_graph; - current_ir_graph = rem; + current_ir_graph = irg; res = new_bd_End(db, block); current_ir_graph = rem; @@ -1412,6 +1442,21 @@ ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node) return res; } /* new_rd_Pin */ +ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block, + int arity, ir_node *in[], ir_asm_constraint *inputs, + int n_outs, ir_asm_constraint *outputs, + int n_clobber, ident *clobber[], ident *asm_text) { + ir_node *res; + ir_graph *rem = current_ir_graph; + + current_ir_graph = irg; + res = new_bd_ASM(db, block, arity, in, inputs, n_outs, outputs, n_clobber, clobber, asm_text); + current_ir_graph = rem; + + return res; +} /* new_rd_ASM */ + + ir_node *new_r_Block(ir_graph *irg, int arity, ir_node **in) { return new_rd_Block(NULL, irg, arity, in); } @@ -1481,20 +1526,20 @@ ir_node *new_r_Mul(ir_graph *irg, ir_node *block, return new_rd_Mul(NULL, irg, block, op1, op2, mode); } ir_node *new_r_Quot(ir_graph *irg, ir_node *block, - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_rd_Quot(NULL, irg, block, memop, op1, op2, mode); + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_rd_Quot(NULL, irg, block, memop, op1, op2, mode, state); } ir_node *new_r_DivMod(ir_graph *irg, ir_node *block, - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_rd_DivMod(NULL, irg, block, memop, op1, op2, mode); + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_rd_DivMod(NULL, irg, block, memop, op1, op2, mode, state); } ir_node *new_r_Div(ir_graph *irg, ir_node *block, - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_rd_Div(NULL, irg, block, memop, op1, op2, mode); + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_rd_Div(NULL, irg, block, memop, op1, op2, mode, state); } ir_node *new_r_Mod(ir_graph *irg, ir_node *block, - ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_rd_Mod(NULL, irg, block, memop, op1, op2, mode); + ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_rd_Mod(NULL, irg, block, memop, op1, op2, mode, state); } ir_node *new_r_Abs(ir_graph *irg, ir_node *block, ir_node *op, ir_mode *mode) { @@ -1594,7 +1639,7 @@ ir_node *new_r_Bad(ir_graph *irg) { return new_rd_Bad(irg); } ir_node *new_r_Confirm(ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp) { - return new_rd_Confirm (NULL, irg, block, val, bound, cmp); + return new_rd_Confirm(NULL, irg, block, val, bound, cmp); } ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m) { return new_rd_Unknown(irg, m); @@ -1645,6 +1690,12 @@ ir_node *new_r_Bound(ir_graph *irg, ir_node *block, ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node) { return new_rd_Pin(NULL, irg, block, node); } +ir_node *new_r_ASM(ir_graph *irg, ir_node *block, + int arity, ir_node *in[], ir_asm_constraint *inputs, + int n_outs, ir_asm_constraint *outputs, + int n_clobber, ident *clobber[], ident *asm_text) { + return new_rd_ASM(NULL, irg, block, arity, in, inputs, n_outs, outputs, n_clobber, clobber, asm_text); +} /** ********************/ /** public interfaces */ @@ -1766,9 +1817,9 @@ Phi_in_stack * new_Phi_in_stack(void) { Phi_in_stack *res; - res = (Phi_in_stack *) malloc ( sizeof (Phi_in_stack)); + res = (Phi_in_stack *) xmalloc(sizeof(Phi_in_stack)); - res->stack = NEW_ARR_F (ir_node *, 0); + res->stack = NEW_ARR_F(ir_node *, 0); res->pos = 0; return res; @@ -2025,7 +2076,7 @@ get_r_value_internal(ir_node *block, int pos, ir_mode *mode) /* case 2 -- If the value is actually computed, return it. */ if (res) return res; - if (block->attr.block.matured) { /* case 3 */ + if (block->attr.block.is_matured) { /* case 3 */ /* The Phi has the same amount of ins as the corresponding block. */ int ins = get_irn_arity(block); @@ -2056,8 +2107,7 @@ get_r_value_internal(ir_node *block, int pos, ir_mode *mode) /* Error Message */ printf("Error: no value set. Use of undefined variable. Initializing to zero.\n"); assert(mode->code >= irm_F && mode->code <= irm_P); - res = new_rd_Const(NULL, current_ir_graph, block, mode, - tarval_mode_null[mode->code]); + res = new_rd_Const(NULL, current_ir_graph, block, mode, tarval_mode_null[mode->code]); } /* The local valid value is available now. */ @@ -2248,14 +2298,14 @@ get_r_frag_value_internal(ir_node *block, ir_node *cfOp, int pos, ir_mode *mode) if (block->attr.block.graph_arr[pos]) { /* There was a set_value() after the cfOp and no get_value before that set_value(). We must build a Phi node now. */ - if (block->attr.block.matured) { + if (block->attr.block.is_matured) { int ins = get_irn_arity(block); ir_node **nin; - NEW_ARR_A (ir_node *, nin, ins); + NEW_ARR_A(ir_node *, nin, ins); res = phi_merge(block, pos, mode, nin, ins); } else { - res = new_rd_Phi0 (current_ir_graph, block, mode); - res->attr.phi0_pos = pos; + res = new_rd_Phi0(current_ir_graph, block, mode); + res->attr.phi0.pos = pos; res->link = block->link; block->link = res; } @@ -2444,7 +2494,7 @@ get_r_value_internal(ir_node *block, int pos, ir_mode *mode) { /* case 2 -- If the value is actually computed, return it. */ if (res) { return res; }; - if (block->attr.block.matured) { /* case 3 */ + if (block->attr.block.is_matured) { /* case 3 */ /* The Phi has the same amount of ins as the corresponding block. */ int ins = get_irn_arity(block); @@ -2462,8 +2512,8 @@ get_r_value_internal(ir_node *block, int pos, ir_mode *mode) { The Phi0 has to remember the pos of it's internal value. If the real Phi is computed, pos is used to update the array with the local values. */ - res = new_rd_Phi0 (current_ir_graph, block, mode); - res->attr.phi0_pos = pos; + res = new_rd_Phi0(current_ir_graph, block, mode); + res->attr.phi0.pos = pos; res->link = block->link; block->link = res; } @@ -2502,22 +2552,22 @@ mature_immBlock(ir_node *block) { assert (!get_Block_matured(block) && "Block already matured"); */ if (!get_Block_matured(block)) { - ins = ARR_LEN (block->in)-1; + ins = ARR_LEN(block->in)-1; /* Fix block parameters */ block->attr.block.backedge = new_backedge_arr(current_ir_graph->obst, ins); /* An array for building the Phi nodes. */ - NEW_ARR_A (ir_node *, nin, ins); + NEW_ARR_A(ir_node *, nin, ins); /* Traverse a chain of Phi nodes attached to this block and mature these, too. **/ for (n = block->link; n; n = next) { inc_irg_visited(current_ir_graph); next = n->link; - exchange(n, phi_merge (block, n->attr.phi0_pos, n->mode, nin, ins)); + exchange(n, phi_merge(block, n->attr.phi0.pos, n->mode, nin, ins)); } - block->attr.block.matured = 1; + block->attr.block.is_matured = 1; /* Now, as the block is a finished firm node, we can optimize it. Since other nodes have been allocated since the block was created @@ -2565,6 +2615,7 @@ new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode, long proj) { ir_node * new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj) { ir_node *res; + (void) db; assert(arg->op == op_Cond); arg->attr.cond.kind = fragmentary; arg->attr.cond.default_proj = max_proj; @@ -2611,9 +2662,9 @@ static void allocate_frag_arr(ir_node *res, ir_op *op, ir_node ***frag_store) { } /* allocate_frag_arr */ ir_node * -new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { +new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { ir_node *res; - res = new_bd_Quot(db, current_ir_graph->current_block, memop, op1, op2, mode); + res = new_bd_Quot(db, current_ir_graph->current_block, memop, op1, op2, mode, state); #if PRECISE_EXC_CONTEXT allocate_frag_arr(res, op_Quot, &res->attr.except.frag_arr); /* Could be optimized away. */ #endif @@ -2622,9 +2673,9 @@ new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mo } /* new_d_Quot */ ir_node * -new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { +new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { ir_node *res; - res = new_bd_DivMod(db, current_ir_graph->current_block, memop, op1, op2, mode); + res = new_bd_DivMod(db, current_ir_graph->current_block, memop, op1, op2, mode, state); #if PRECISE_EXC_CONTEXT allocate_frag_arr(res, op_DivMod, &res->attr.except.frag_arr); /* Could be optimized away. */ #endif @@ -2633,9 +2684,9 @@ new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode * } /* new_d_DivMod */ ir_node * -new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { +new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { ir_node *res; - res = new_bd_Div(db, current_ir_graph->current_block, memop, op1, op2, mode); + res = new_bd_Div(db, current_ir_graph->current_block, memop, op1, op2, mode, state); #if PRECISE_EXC_CONTEXT allocate_frag_arr(res, op_Div, &res->attr.except.frag_arr); /* Could be optimized away. */ #endif @@ -2644,9 +2695,9 @@ new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mod } ir_node * -new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { +new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { ir_node *res; - res = new_bd_Mod(db, current_ir_graph->current_block, memop, op1, op2, mode); + res = new_bd_Mod(db, current_ir_graph->current_block, memop, op1, op2, mode, state); #if PRECISE_EXC_CONTEXT allocate_frag_arr(res, op_Mod, &res->attr.except.frag_arr); /* Could be optimized away. */ #endif @@ -2880,6 +2931,13 @@ new_d_Pin(dbg_info *db, ir_node *node) { return new_bd_Pin(db, current_ir_graph->current_block, node); } /* new_d_Pin */ +ir_node * +new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs, + int n_outs, ir_asm_constraint *outputs, + int n_clobber, ident *clobber[], ident *asm_text) { + return new_bd_ASM(db, current_ir_graph->current_block, arity, in, inputs, n_outs, outputs, n_clobber, clobber, asm_text); +} /* new_d_ASM */ + /* ********************************************************************* */ /* Comfortable interface with automatic Phi node construction. */ /* (Uses also constructors of ?? interface, except new_Block. */ @@ -2887,21 +2945,31 @@ new_d_Pin(dbg_info *db, ir_node *node) { /* Block construction */ /* immature Block without predecessors */ -ir_node *new_d_immBlock(dbg_info *db) { +ir_node * +new_d_immBlock(dbg_info *db) { ir_node *res; assert(get_irg_phase_state(current_ir_graph) == phase_building); /* creates a new dynamic in-array as length of in is -1 */ - res = new_ir_node (db, current_ir_graph, NULL, op_Block, mode_BB, -1, NULL); + res = new_ir_node(db, current_ir_graph, NULL, op_Block, mode_BB, -1, NULL); current_ir_graph->current_block = res; - res->attr.block.matured = 0; - res->attr.block.dead = 0; + + /* macroblock head */ + res->in[0] = res; + + res->attr.block.is_matured = 0; + res->attr.block.is_dead = 0; + res->attr.block.is_mb_head = 1; + res->attr.block.has_label = 0; res->attr.block.irg = current_ir_graph; res->attr.block.backedge = NULL; res->attr.block.in_cg = NULL; res->attr.block.cg_backedge = NULL; res->attr.block.extblk = NULL; res->attr.block.region = NULL; + res->attr.block.mb_depth = 0; + res->attr.block.label = 0; + set_Block_block_visited(res, 0); /* Create and initialize array for Phi-node construction. */ @@ -2920,18 +2988,38 @@ new_immBlock(void) { return new_d_immBlock(NULL); } /* new_immBlock */ +/* immature PartBlock with its predecessors */ +ir_node * +new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp) { + ir_node *res = new_d_immBlock(db); + ir_node *blk = get_nodes_block(pred_jmp); + + res->in[0] = blk->in[0]; + add_immBlock_pred(res, pred_jmp); + + res->attr.block.is_mb_head = 0; + res->attr.block.mb_depth = blk->attr.block.mb_depth + 1; + + return res; +} /* new_d_immPartBlock */ + +ir_node * +new_immPartBlock(ir_node *pred_jmp) { + return new_d_immPartBlock(NULL, pred_jmp); +} /* new_immPartBlock */ + /* add an edge to a jmp/control flow node */ void add_immBlock_pred(ir_node *block, ir_node *jmp) { - if (block->attr.block.matured) { - assert(0 && "Error: Block already matured!\n"); - } else { - int n = ARR_LEN(block->in) - 1; - assert(jmp != NULL); - ARR_APP1(ir_node *, block->in, jmp); - /* Call the hook */ - hook_set_irn_n(block, n, jmp, NULL); - } + int n = ARR_LEN(block->in) - 1; + + assert(!block->attr.block.is_matured && "Error: Block already matured!\n"); + assert(block->attr.block.is_mb_head && "Error: Cannot add a predecessor to a PartBlock"); + assert(jmp != NULL); + + ARR_APP1(ir_node *, block->in, jmp); + /* Call the hook */ + hook_set_irn_n(block, n, jmp, NULL); } /* add_immBlock_pred */ /* changing the current block */ @@ -2949,6 +3037,7 @@ get_d_value(dbg_info *db, int pos, ir_mode *mode) { ir_graph *irg = current_ir_graph; assert(get_irg_phase_state(irg) == phase_building); inc_irg_visited(irg); + (void) db; return get_r_value_internal(irg->current_block, pos + 1, mode); } /* get_d_value */ @@ -3129,17 +3218,17 @@ ir_node *new_Minus(ir_node *op, ir_mode *mode) { ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode) { return new_d_Mul(NULL, op1, op2, mode); } -ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_d_Quot(NULL, memop, op1, op2, mode); +ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_d_Quot(NULL, memop, op1, op2, mode, state); } -ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_d_DivMod(NULL, memop, op1, op2, mode); +ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_d_DivMod(NULL, memop, op1, op2, mode, state); } -ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_d_Div(NULL, memop, op1, op2, mode); +ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_d_Div(NULL, memop, op1, op2, mode, state); } -ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode) { - return new_d_Mod(NULL, memop, op1, op2, mode); +ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state) { + return new_d_Mod(NULL, memop, op1, op2, mode, state); } ir_node *new_Abs(ir_node *op, ir_mode *mode) { return new_d_Abs(NULL, op, mode); @@ -3222,7 +3311,7 @@ ir_node *new_Bad(void) { return new_d_Bad(); } ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp) { - return new_d_Confirm (NULL, val, bound, cmp); + return new_d_Confirm(NULL, val, bound, cmp); } ir_node *new_Unknown(ir_mode *m) { return new_d_Unknown(m); @@ -3266,3 +3355,15 @@ ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper) ir_node *new_Pin(ir_node *node) { return new_d_Pin(NULL, node); } +ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs, + int n_outs, ir_asm_constraint *outputs, + int n_clobber, ident *clobber[], ident *asm_text) { + return new_d_ASM(NULL, arity, in, inputs, n_outs, outputs, n_clobber, clobber, asm_text); +} + +/* create a new anchor node */ +ir_node *new_Anchor(ir_graph *irg) { + ir_node *in[anchor_last]; + memset(in, 0, sizeof(in)); + return new_ir_node(NULL, irg, NULL, op_Anchor, mode_ANY, anchor_last, in); +}