X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=1711aa07dbcf580419fa7648fbd31ea1e7cf1ca7;hb=87f7c13645e762f21991ad79985a7f3e6ef612cf;hp=310e1021159951be22268b6cfe3f8978790c2810;hpb=9ab5d60e01154230efcd2e85ccf569c2fed3a115;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 310e10211..1711aa07d 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -76,7 +76,7 @@ static tarval *computed_value_SymConst(ir_node *n) { ent = get_SymConst_entity(n); type = get_entity_owner(ent); if (get_type_state(type) == layout_fixed) - return new_tarval_from_long(get_entity_offset_bytes(ent), get_irn_mode(n)); + return new_tarval_from_long(get_entity_offset(ent), get_irn_mode(n)); break; default: break; @@ -2039,7 +2039,8 @@ static ir_node *transform_node_Sub(ir_node *n) if (mode_is_float(mode) && (get_irg_fp_model(current_ir_graph) & fp_strict_algebraic)) return n; - if (mode_is_num(mode) && (classify_Const(a) == CNST_NULL)) { + /* Beware of Sub(P, P) which cannot be optimized into a simple Minus ... */ + if (mode_is_num(mode) && mode == get_irn_mode(a) && (classify_Const(a) == CNST_NULL)) { n = new_rd_Minus( get_irn_dbg_info(n), current_ir_graph, @@ -3683,6 +3684,10 @@ void del_identities(pset *value_table) { /** * Return the canonical node computing the same value as n. + * + * @param value_table The value table + * @param n The node to lookup + * * Looks up the node in a hash table. * * For Const nodes this is performed in the constructor, too. Const @@ -3859,6 +3864,8 @@ static INLINE ir_node *gigo(ir_node *node) * It can only be called if it is guaranteed that no other nodes * reference this one, i.e., right after construction of a node. * + * @param n The node to optimize + * * current_ir_graph must be set to the graph of the node! */ ir_node *optimize_node(ir_node *n) @@ -4051,8 +4058,7 @@ ir_node *optimize_in_place_2(ir_node *n) /** * Wrapper for external use, set proper status bits after optimization. */ -ir_node *optimize_in_place(ir_node *n) -{ +ir_node *optimize_in_place(ir_node *n) { /* Handle graph state */ assert(get_irg_phase_state(current_ir_graph) != phase_building); @@ -4070,8 +4076,7 @@ ir_node *optimize_in_place(ir_node *n) /* * Sets the default operation for an ir_ops. */ -ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops) -{ +ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops) { ops = firm_set_default_computed_value(code, ops); ops = firm_set_default_equivalent_node(code, ops); ops = firm_set_default_transform_node(code, ops);