From cf3056ad5ceb8c9018c01e634fc5e85bb4bfd6fb Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 30 May 2007 12:41:44 +0000 Subject: [PATCH] get_divop_resmod() added PartBlock() constructors added renamed boolean attributes x into is_x [r14178] --- ir/ir/irnode.c | 40 +++++++++++++++++++++++++++++----------- ir/ir/irnode.h | 9 +++++++-- ir/ir/irnode_t.h | 12 +++++++----- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 5013c048d..613baca7f 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -732,13 +732,13 @@ ir_node * int get_Block_matured(ir_node *node) { assert(node->op == op_Block); - return (int)node->attr.block.matured; + return (int)node->attr.block.is_matured; } void set_Block_matured(ir_node *node, int matured) { assert(node->op == op_Block); - node->attr.block.matured = matured; + node->attr.block.is_matured = matured; } unsigned long @@ -779,7 +779,7 @@ set_Block_graph_arr (ir_node *node, int pos, ir_node *value) { node->attr.block.graph_arr[pos+1] = value; } -void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) { +void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]) { assert(node->op == op_Block); if (node->attr.block.in_cg == NULL || arity != ARR_LEN(node->attr.block.in_cg) - 1) { node->attr.block.in_cg = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1); @@ -797,29 +797,29 @@ void set_Block_cg_cfgpred_arr(ir_node * node, int arity, ir_node ** in) { memcpy(node->attr.block.in_cg + 1, in, sizeof(ir_node *) * arity); } -void set_Block_cg_cfgpred(ir_node * node, int pos, ir_node * pred) { +void set_Block_cg_cfgpred(ir_node *node, int pos, ir_node *pred) { assert(node->op == op_Block && node->attr.block.in_cg && 0 <= pos && pos < ARR_LEN(node->attr.block.in_cg) - 1); node->attr.block.in_cg[pos + 1] = pred; } -ir_node **get_Block_cg_cfgpred_arr(ir_node * node) { +ir_node **get_Block_cg_cfgpred_arr(ir_node *node) { assert(node->op == op_Block); return node->attr.block.in_cg == NULL ? NULL : node->attr.block.in_cg + 1; } -int get_Block_cg_n_cfgpreds(ir_node * node) { +int get_Block_cg_n_cfgpreds(ir_node *node) { assert(node->op == op_Block); return node->attr.block.in_cg == NULL ? 0 : ARR_LEN(node->attr.block.in_cg) - 1; } -ir_node *get_Block_cg_cfgpred(ir_node * node, int pos) { +ir_node *get_Block_cg_cfgpred(ir_node *node, int pos) { assert(node->op == op_Block && node->attr.block.in_cg); return node->attr.block.in_cg[pos + 1]; } -void remove_Block_cg_cfgpred_arr(ir_node * node) { +void remove_Block_cg_cfgpred_arr(ir_node *node) { assert(node->op == op_Block); node->attr.block.in_cg = NULL; } @@ -846,6 +846,11 @@ void set_Block_extbb(ir_node *block, ir_extblk *extblk) { block->attr.block.extblk = extblk; } +ir_node *get_Block_MacroBlock(const ir_node *block) { + assert(is_Block(block)); + return get_irn_n(block, -1); +} + int get_End_n_keepalives(ir_node *end) { assert(end->op == op_End); @@ -859,7 +864,7 @@ get_End_keepalive(ir_node *end, int pos) { } void -add_End_keepalive (ir_node *end, ir_node *ka) { +add_End_keepalive(ir_node *end, ir_node *ka) { assert(end->op == op_End); assert((is_Phi(ka) || is_Proj(ka) || is_Block(ka) || is_irn_keep(ka)) && "Only Phi, Block or Keep nodes can be kept alive!"); add_irn_n(end, ka); @@ -2684,7 +2689,7 @@ is_fragile_op(const ir_node *node) { ir_node *get_fragile_op_mem(ir_node *node) { assert(node && is_fragile_op(node)); - switch (get_irn_opcode (node)) { + switch (get_irn_opcode(node)) { case iro_Call : case iro_Quot : case iro_DivMod: @@ -2704,6 +2709,19 @@ ir_node *get_fragile_op_mem(ir_node *node) { } } +/* Returns the result mode of a Div operation. */ +ir_mode *get_divop_resmod(const ir_node *node) { + switch (get_irn_opcode(node)) { + case iro_Quot : return get_Quot_resmode(node); + case iro_DivMod: return get_DivMod_resmode(node); + case iro_Div : return get_Div_resmode(node); + case iro_Mod : return get_Mod_resmode(node); + default: ; + assert(0 && "should not be reached"); + return NULL; + } +} + /* Returns true if the operation is a forking control flow operation. */ int (is_irn_forking)(const ir_node *node) { return _is_irn_forking(node); @@ -2774,7 +2792,7 @@ const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred) { } /* Returns the conditional jump prediction of a Cond node. */ -cond_jmp_predicate (get_Cond_jmp_pred)(ir_node *cond) { +cond_jmp_predicate (get_Cond_jmp_pred)(const ir_node *cond) { return _get_Cond_jmp_pred(cond); } diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index 0510a74f8..a523b2629 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -378,7 +378,7 @@ int Block_block_visited(const ir_node *node); * predecessors are removed, the node has the same predecessors in * both views. * @@@ Maybe better: arity is zero if no cg preds. */ -void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node **in); +void set_Block_cg_cfgpred_arr(ir_node *node, int arity, ir_node *in[]); void set_Block_cg_cfgpred(ir_node *node, int pos, ir_node *pred); /* @@@ not supported */ ir_node **get_Block_cg_cfgpred_arr(ir_node *node); @@ -394,6 +394,9 @@ ir_extblk *get_Block_extbb(const ir_node *block); /** Sets the extended basic block a block belongs to. */ void set_Block_extbb(ir_node *block, ir_extblk *extblk); +/** Get the Macro Block header of a (sub-) block. */ +ir_node *get_Block_MacroBlock(const ir_node *block); + /** Return the number of Keep alive node. */ int get_End_n_keepalives(ir_node *end); @@ -1252,6 +1255,8 @@ int is_ip_cfop(const ir_node *node); int is_fragile_op(const ir_node *node); /** Returns the memory operand of fragile operations. */ ir_node *get_fragile_op_mem(ir_node *node); +/** Returns the result mode of a Div operation. */ +ir_mode *get_divop_resmod(const ir_node *node); /** Returns true if the operation is a forking control flow * operation: Cond. */ @@ -1317,7 +1322,7 @@ typedef enum { const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred); /** Returns the conditional jump prediction of a Cond node. */ -cond_jmp_predicate get_Cond_jmp_pred(ir_node *cond); +cond_jmp_predicate get_Cond_jmp_pred(const ir_node *cond); /** Sets a new conditional jump prediction. */ void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred); diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index a2aa95c13..0dc618c62 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -54,8 +54,9 @@ typedef struct { ir_graph *irg; /**< The graph this block belongs to. */ unsigned long block_visited; /**< For the walker that walks over all blocks. */ /* Attributes private to construction: */ - unsigned matured:1; /**< If set, all in-nodes of the block are fixed. */ - unsigned dead:1; /**< If set, the block is dead (and could be replace by a Bad. */ + unsigned is_matured:1; /**< If set, all in-nodes of the block are fixed. */ + unsigned is_dead:1; /**< If set, the block is dead (and could be replace by a Bad. */ + unsigned is_mb_head:1; /**< Set if this block is a macroblock head. */ ir_node **graph_arr; /**< An array to store all parameters. */ /* Attributes holding analyses information */ ir_dom_info dom; /**< Datastructure that holds information about dominators. @@ -73,6 +74,7 @@ typedef struct { @@@ @todo Ev. replace by bit field! */ ir_extblk *extblk; /**< The extended basic block this block belongs to. */ ir_region *region; /**< The immediate structural region this block belongs to. */ + unsigned mb_depth; /**< The macroblock depth: A distance from the macroblock header */ struct list_head succ_head; /**< A list head for all successor edges of a block. */ } block_attr; @@ -903,7 +905,7 @@ _Block_block_visited(const ir_node *node) { static INLINE ir_node * _set_Block_dead(ir_node *block) { assert(_get_irn_op(block) == op_Block); - block->attr.block.dead = 1; + block->attr.block.is_dead = 1; return block; } @@ -915,7 +917,7 @@ _is_Block_dead(const ir_node *block) { return 1; else { assert(op == op_Block); - return block->attr.block.dead; + return block->attr.block.is_dead; } } @@ -982,7 +984,7 @@ static INLINE int _is_irn_machine_user(const ir_node *node, unsigned n) { return is_op_machine_user(_get_irn_op(node), n); } -static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) { +static INLINE cond_jmp_predicate _get_Cond_jmp_pred(const ir_node *node) { assert(_get_irn_op(node) == op_Cond); return node->attr.cond.pred; } -- 2.20.1