From: Moritz Kroll Date: Wed, 21 Jan 2009 17:40:25 +0000 (+0000) Subject: Added Dummy node which does not CSE with anything X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=af0115376ccdcc72e0643caf221407218f4504f0;p=libfirm Added Dummy node which does not CSE with anything [r25322] --- diff --git a/include/libfirm/ircons.h b/include/libfirm/ircons.h index ac1dd2b05..f251e694f 100644 --- a/include/libfirm/ircons.h +++ b/include/libfirm/ircons.h @@ -4481,6 +4481,12 @@ 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); +/** Constructor for a Dummy node. + * + * @param *mode The mode of the node. + */ +ir_node *new_Dummy(ir_mode *mode); + /*---------------------------------------------------------------------*/ /* The comfortable interface. */ /* Supports automatic Phi node construction. */ diff --git a/include/libfirm/irop.h b/include/libfirm/irop.h index 2ae87d347..db0544d81 100644 --- a/include/libfirm/irop.h +++ b/include/libfirm/irop.h @@ -96,6 +96,7 @@ typedef enum { iro_InstOf, iro_Raise, iro_Bound, iro_Pin, iro_ASM, iro_Builtin, + iro_Dummy, iro_Anchor, /* first not middleend node number */ iro_Last = iro_Anchor, @@ -197,6 +198,8 @@ extern ir_op *op_Pin; ir_op *get_op_Pin (void); extern ir_op *op_ASM; ir_op *get_op_ASM (void); extern ir_op *op_Builtin; ir_op *get_op_Builtin (void); +extern ir_op *op_Dummy; ir_op *get_op_Dummy (void); + extern ir_op *op_Anchor; ir_op *get_op_Anchor (void); /** Returns the ident for the opcode name */ diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index fe13edd8a..08ce8c580 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -3157,6 +3157,10 @@ 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_Dummy(ir_mode *m) { + ir_graph *irg = current_ir_graph; + return new_ir_node(NULL, irg, get_irg_start_block(irg), op_Dummy, m, 0, NULL); +} 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) { diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 5f7c53993..9ae042e8c 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -113,6 +113,7 @@ ir_op *op_Bound; ir_op *get_op_Bound (void) { return op_Bound; } ir_op *op_Pin; ir_op *get_op_Pin (void) { return op_Pin; } ir_op *op_ASM; ir_op *get_op_ASM (void) { return op_ASM; } +ir_op *op_Dummy; ir_op *get_op_Dummy (void) { return op_Dummy; } ir_op *op_Anchor; ir_op *get_op_Anchor (void) { return op_Anchor; } /* @@ -356,6 +357,8 @@ init_op(void) op_ASM = new_ir_op(iro_ASM, "ASM", op_pin_state_mem_pinned, K|M, oparity_variable, -1, sizeof(asm_attr), NULL); op_Builtin = new_ir_op(iro_Builtin, "Builtin", op_pin_state_mem_pinned, M, oparity_variable, -1, sizeof(builtin_attr), NULL); + op_Dummy = new_ir_op(iro_Dummy, "Dummy", op_pin_state_pinned, X|F|S|c|NB,oparity_zero, -1, 0, NULL); + op_Anchor = new_ir_op(iro_Anchor, "Anchor", op_pin_state_pinned, N|NB, oparity_variable, -1, 0, NULL); #undef S @@ -443,6 +446,7 @@ void finish_op(void) { free_ir_op (op_Pin ); op_Pin = NULL; free_ir_op (op_ASM ); op_ASM = NULL; + free_ir_op (op_Dummy ); op_Dummy = NULL; free_ir_op (op_Anchor ); op_Anchor = NULL; } diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 50a00bc04..6b212d103 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -6091,6 +6091,12 @@ static int node_cmp_attr_ASM(ir_node *a, ir_node *b) { return 0; } /* node_cmp_attr_ASM */ +/** Compares the inexistent attributes of two Dummy nodes. */ +static int node_cmp_attr_Dummy(ir_node *a, ir_node *b) +{ + return 1; +} + /** * Set the default node attribute compare operation for an ir_op_ops. * @@ -6129,6 +6135,7 @@ static ir_op_ops *firm_set_default_node_cmp_attr(ir_opcode code, ir_op_ops *ops) CASE(Quot); CASE(Bound); CASE(Builtin); + CASE(Dummy); /* FIXME CopyB */ default: /* leave NULL */;