*/
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"
/** 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)
{
void firm_init_irgraph(void)
{
frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
- forbid_new_data = 1;
}
/**
*/
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. */
*/
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)
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;