irgraph: Remove the unused facility to register space /in front of/ a graph.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 1 Dec 2012 18:32:58 +0000 (19:32 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 2 Dec 2012 08:56:22 +0000 (09:56 +0100)
include/libfirm/irgraph.h
ir/ir/irgraph.c

index 3c892c2..63149c4 100644 (file)
@@ -507,36 +507,6 @@ FIRM_API void assure_irg_properties(ir_graph *irg, ir_graph_properties_t props);
  */
 FIRM_API void confirm_irg_properties(ir_graph *irg, ir_graph_properties_t props);
 
-/**
- * Accesses custom graph data.
- * The data must have been registered with
- * register_additional_graph_data() before.
- * @param graph The graph to get the data from.
- * @param type The type of the data you registered.
- * @param off The value returned by register_additional_graph_data().
- * @return A pointer of type @p type.
- */
-#define get_irg_data(graph,type,off) \
-       (assert(off > 0 && "Invalid graph data offset"), (type *) ((char *) (graph) - (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_graph_data().
- * @return A pointer to the ir node the custom data belongs to.
- */
-#define get_irg_data_base(data,off) \
-       (assert(off > 0 && "Invalid graph data offset"), (ir_graph *) ((char *) (data) + (off)))
-
-/**
- * Requests additional data to be allocated with an ir graph.
- * @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_irg_data(), 0 if the
- * registration failed.
- */
-FIRM_API size_t register_additional_graph_data(size_t size);
-
 /** @} */
 
 #include "end.h"
index 1fc1b93..6e78c50 100644 (file)
 /** Suffix that is added to every frame type. */
 #define FRAME_TP_SUFFIX "frame_tp"
 
-/**
- * Indicates, whether additional data can be registered to graphs.
- * If set to 1, this is not possible anymore.
- */
-static int forbid_new_data = 0;
-
-/**
- * The amount of additional space for custom data to be allocated upon
- * creating a new graph.
- */
-static size_t additional_graph_data_size = 0;
-
 ir_graph *current_ir_graph;
 ir_graph *get_current_ir_graph(void)
 {
@@ -82,7 +70,6 @@ static ident *frame_type_suffix = NULL;
 void firm_init_irgraph(void)
 {
        frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
-       forbid_new_data   = 1;
 }
 
 /**
@@ -94,11 +81,7 @@ void firm_init_irgraph(void)
  */
 static ir_graph *alloc_graph(void)
 {
-       ir_graph *res;
-       size_t   size = sizeof(ir_graph) + additional_graph_data_size;
-       char     *ptr = XMALLOCNZ(char, size);
-
-       res = (ir_graph *)(ptr + additional_graph_data_size);
+       ir_graph *const res = XMALLOCZ(ir_graph);
        res->kind = k_ir_graph;
 
        /* initialize the idx->node map. */
@@ -113,13 +96,10 @@ static ir_graph *alloc_graph(void)
  */
 static void free_graph(ir_graph *irg)
 {
-       char           *ptr = (char *)irg;
-       ir_edge_kind_t  i;
-
-       for (i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
+       for (ir_edge_kind_t i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
                edges_deactivate_kind(irg, i);
        DEL_ARR_F(irg->idx_irn_map);
-       free(ptr - additional_graph_data_size);
+       free(irg);
 }
 
 void irg_set_nloc(ir_graph *res, int n_loc)
@@ -695,16 +675,6 @@ unsigned get_irg_last_idx(const ir_graph *irg)
        return irg->last_node_idx;
 }
 
-size_t register_additional_graph_data(size_t size)
-{
-       assert(!forbid_new_data && "Too late to register additional node data");
-
-       if (forbid_new_data)
-               return 0;
-
-       return additional_graph_data_size += size;
-}
-
 void add_irg_constraints(ir_graph *irg, ir_graph_constraints_t constraints)
 {
        irg->constraints |= constraints;