Remove the unused facility to register space /in front of/ a node.
authorChristoph Mallon <christoph.mallon@gmx.de>
Mon, 10 Sep 2012 18:05:11 +0000 (20:05 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 11 Sep 2012 06:42:21 +0000 (08:42 +0200)
include/libfirm/irnode.h
ir/common/firm.c
ir/ir/irnode.c
ir/ir/irnode_t.h
ir/ir/irop.c

index 6a2ca9a..53d613e 100644 (file)
@@ -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.
index 1575e3d..0034aa4 100644 (file)
@@ -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
index 2515eaf..4a9a578 100644 (file)
@@ -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;
index d8190c6..0b8c4c6 100644 (file)
  */
 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.
index 67eab22..4234712 100644 (file)
@@ -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);
-       }
 }
 
 /**