add an get_irg_idx
[libfirm] / ir / ir / irgraph.c
index f16a830..c20c61f 100644 (file)
@@ -255,6 +255,7 @@ ir_graph *new_r_ir_graph(ir_entity *ent, int n_loc) {
        add_immBlock_pred(start_block, projX);
        set_store(initial_mem);
 
+       res->index       = get_irp_new_irg_idx();
 #ifdef DEBUG_libfirm
        res->graph_nr    = get_irp_new_node_nr();
 #endif
@@ -412,14 +413,15 @@ int
        return _is_ir_graph(thing);
 }
 
-/* Outputs a unique number for this node */
-long get_irg_graph_nr(ir_graph *irg) {
-       assert(irg);
 #ifdef DEBUG_libfirm
+/* Outputs a unique number for this node */
+long get_irg_graph_nr(const ir_graph *irg) {
        return irg->graph_nr;
-#else
-       return (long)PTR_TO_INT(irg);
+}
 #endif
+
+int get_irg_idx(const ir_graph *irg) {
+       return irg->index;
 }
 
 ir_node *