Commit 5baeb7ad authored by Christoph Mallon's avatar Christoph Mallon
Browse files

irgraph: Remove the unused facility to register space /in front of/ a graph.

parent f645052c
...@@ -507,36 +507,6 @@ FIRM_API void assure_irg_properties(ir_graph *irg, ir_graph_properties_t props); ...@@ -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); 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" #include "end.h"
......
...@@ -53,18 +53,6 @@ ...@@ -53,18 +53,6 @@
/** Suffix that is added to every frame type. */ /** Suffix that is added to every frame type. */
#define FRAME_TP_SUFFIX "frame_tp" #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 *current_ir_graph;
ir_graph *get_current_ir_graph(void) ir_graph *get_current_ir_graph(void)
{ {
...@@ -82,7 +70,6 @@ static ident *frame_type_suffix = NULL; ...@@ -82,7 +70,6 @@ static ident *frame_type_suffix = NULL;
void firm_init_irgraph(void) void firm_init_irgraph(void)
{ {
frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX); frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
forbid_new_data = 1;
} }
/** /**
...@@ -94,11 +81,7 @@ void firm_init_irgraph(void) ...@@ -94,11 +81,7 @@ void firm_init_irgraph(void)
*/ */
static ir_graph *alloc_graph(void) static ir_graph *alloc_graph(void)
{ {
ir_graph *res; ir_graph *const res = XMALLOCZ(ir_graph);
size_t size = sizeof(ir_graph) + additional_graph_data_size;
char *ptr = XMALLOCNZ(char, size);
res = (ir_graph *)(ptr + additional_graph_data_size);
res->kind = k_ir_graph; res->kind = k_ir_graph;
/* initialize the idx->node map. */ /* initialize the idx->node map. */
...@@ -113,13 +96,10 @@ static ir_graph *alloc_graph(void) ...@@ -113,13 +96,10 @@ static ir_graph *alloc_graph(void)
*/ */
static void free_graph(ir_graph *irg) static void free_graph(ir_graph *irg)
{ {
char *ptr = (char *)irg; for (ir_edge_kind_t i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
ir_edge_kind_t i;
for (i = EDGE_KIND_FIRST; i < EDGE_KIND_LAST; ++i)
edges_deactivate_kind(irg, i); edges_deactivate_kind(irg, i);
DEL_ARR_F(irg->idx_irn_map); 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) void irg_set_nloc(ir_graph *res, int n_loc)
...@@ -695,16 +675,6 @@ unsigned get_irg_last_idx(const ir_graph *irg) ...@@ -695,16 +675,6 @@ unsigned get_irg_last_idx(const ir_graph *irg)
return irg->last_node_idx; 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) void add_irg_constraints(ir_graph *irg, ir_graph_constraints_t constraints)
{ {
irg->constraints |= constraints; irg->constraints |= constraints;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment