+/** contains the suffix for frame type names */
+static ident *frame_type_suffix = NULL;
+
+/** The default firm calling convention mask. */
+static unsigned firm_default_cc_mask = 0;
+
+/* initialize the IR graph module */
+void firm_init_irgraph(unsigned default_cc_mask) {
+ frame_type_suffix = new_id_from_str(FRAME_TP_SUFFIX);
+ forbid_new_data = 1;
+ firm_default_cc_mask = default_cc_mask;
+}
+
+/* Gets the default calling convention for new constructed graphs. */
+unsigned get_firm_default_calling_convention(void) {
+ return firm_default_cc_mask;
+}
+
+/* Sets the default calling convention for new constructed graphs. */
+void set_firm_default_calling_convention(unsigned cc_mask) {
+ firm_default_cc_mask = cc_mask;
+}
+
+/**
+ * Allocate a new IR graph.
+ * This function respects the registered graph data. The only reason for
+ * this function is, that there are two locations, where graphs are
+ * allocated (new_r_ir_graph, new_const_code_irg).
+ * @return Memory for a new graph.
+ */
+static ir_graph *alloc_graph(void) {
+ size_t size = sizeof(ir_graph) + additional_graph_data_size;
+ char *ptr = xmalloc(size);
+ memset(ptr, 0, size);
+
+ return (ir_graph *) (ptr + additional_graph_data_size);
+}
+
+/**
+ * Frees an allocated IR graph
+ */
+static void free_graph(ir_graph *irg) {
+ char *ptr = (char *)irg;
+ free(ptr - additional_graph_data_size);