From 2a7834a29182aa4629539021217a2fddf72bfe6d Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Mon, 10 Sep 2012 20:05:11 +0200 Subject: [PATCH] Remove the unused facility to register space /in front of/ a node. --- include/libfirm/irnode.h | 30 -------------------------- ir/common/firm.c | 2 -- ir/ir/irnode.c | 46 +++------------------------------------- ir/ir/irnode_t.h | 8 ------- ir/ir/irop.c | 6 ------ 5 files changed, 3 insertions(+), 89 deletions(-) diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h index 6a2ca9a38..53d613e4d 100644 --- a/include/libfirm/irnode.h +++ b/include/libfirm/irnode.h @@ -772,36 +772,6 @@ FIRM_API int is_irn_cse_neutral(const ir_node *node); /** Returns the string representation of the jump prediction. */ FIRM_API const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred); -/** - * Access custom node data. - * The data must have been registered with - * register_additional_node_data() before. - * @param node The ir node to get the data from. - * @param type The type of the data you registered. - * @param off The value returned by register_additional_node_data(). - * @return A pointer of type @p type. - */ -#define get_irn_data(node,type,off) \ - (assert(off > 0 && "Invalid node data offset"), (type *) ((char *) (node) - (off))) - -/** - * Returns the pointer to the node some custom data belongs to. - * @param data The pointer to the custom data. - * @param off The number as returned by register_additional_node_data(). - * @return A pointer to the ir node the custom data belongs to. - */ -#define get_irn_data_base(data,off) \ - (assert(off > 0 && "Invalid node data offset"), (ir_node *) ((char *) (data) + (off))) - -/** - * Request additional data to be allocated with an ir node. - * @param size The size of the additional data required. - * @return A positive number, if the operation was successful, which - * must be passed to the access macro get_irn_data(), 0 if the - * registration failed. - */ -FIRM_API unsigned firm_register_additional_node_data(unsigned size); - /** * Returns a pointer to the node attributes. * Used for accessing attributes of user-defined nodes. diff --git a/ir/common/firm.c b/ir/common/firm.c index 1575e3d63..0034aa460 100644 --- a/ir/common/firm.c +++ b/ir/common/firm.c @@ -112,8 +112,6 @@ void ir_init(void) /* Init architecture dependent optimizations. */ arch_dep_set_opts(arch_dep_none); - init_irnode(); - init_execfreq(); #ifdef DEBUG_libfirm diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 2515eafc8..4a9a57831 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -95,57 +95,17 @@ ir_relation get_inversed_relation(ir_relation relation) return code; } -/** - * Indicates, whether additional data can be registered to ir nodes. - * If set to 1, this is not possible anymore. - */ -static int forbid_new_data = 0; - -unsigned firm_add_node_size = 0; - - -unsigned firm_register_additional_node_data(unsigned size) -{ - assert(!forbid_new_data && "Too late to register additional node data"); - - if (forbid_new_data) - return 0; - - return firm_add_node_size += size; -} - - -void init_irnode(void) -{ - /* Forbid the addition of new data to an ir node. */ - forbid_new_data = 1; -} - -struct struct_align { - char c; - struct s { - int i; - float f; - double d; - } s; -}; - ir_node *new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode, int arity, ir_node *const *in) { - ir_node *res; - unsigned align = offsetof(struct struct_align, s) - 1; - unsigned add_node_size = (firm_add_node_size + align) & ~align; - size_t node_size = offsetof(ir_node, attr) + op->attr_size + add_node_size; - char *p; int i; assert(irg); assert(op); assert(mode); - p = (char*)obstack_alloc(irg->obst, node_size); - memset(p, 0, node_size); - res = (ir_node *)(p + add_node_size); + + size_t const node_size = offsetof(ir_node, attr) + op->attr_size; + ir_node *const res = (ir_node*)OALLOCNZ(irg->obst, char, node_size); res->kind = k_ir_node; res->op = op; diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index d8190c667..0b8c4c64d 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -41,11 +41,6 @@ */ ir_node **get_irn_in(const ir_node *node); -/** - * The amount of additional space for custom data to be allocated upon creating a new node. - */ -extern unsigned firm_add_node_size; - /** * Returns an array with the predecessors of the Block. Depending on * the implementation of the graph data structure this can be a copy of @@ -560,9 +555,6 @@ static inline const ir_switch_table_entry *ir_switch_table_get_entry_const( void ir_register_getter_ops(void); -/** initialize ir_node module */ -void init_irnode(void); - /** * because firm keepalive edges are a broken concept, we have to make sure that * nodes which are only held by a keepalive edges are never moved again. diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 67eab22f9..42347124d 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -501,16 +501,10 @@ static int node_cmp_attr_InstOf(const ir_node *a, const ir_node *b) static void default_copy_attr(ir_graph *irg, const ir_node *old_node, ir_node *new_node) { - unsigned size = firm_add_node_size; (void) irg; assert(get_irn_op(old_node) == get_irn_op(new_node)); memcpy(&new_node->attr, &old_node->attr, get_op_attr_size(get_irn_op(old_node))); - - if (size > 0) { - /* copy additional node data */ - memcpy(get_irn_data(new_node, void, size), get_irn_data(old_node, void, size), size); - } } /** -- 2.20.1