Commit 1fb376a0 authored by Till Riedel's avatar Till Riedel
Browse files

init nr field for debug dump output

[r817]
parent 058835a3
......@@ -20,7 +20,7 @@
# include "typegmod_t.h"
# include "array.h"
/* All this is needed to build the constant node for methods: */
# include "irprog.h"
# include "irprog_t.h"
# include "ircons.h"
/*******************************************************************/
......@@ -94,6 +94,10 @@ new_entity (type *owner, ident *name, type *type)
res->irg = NULL;
#ifdef DEBUG_libfirm
res->nr = get_irp_new_node_nr();
#endif
res->visit = 0;
/* Remember entity in it's owner. */
......@@ -167,6 +171,17 @@ free_entity (entity *ent) {
free(ent);
}
/* Outputs a unique number for this node */
INLINE long
get_entity_nr(entity *ent) {
assert(ent);
#ifdef DEBUG_libfirm
return ent->nr;
#else
return 0;
#endif
}
INLINE const char *
get_entity_name (entity *ent) {
assert (ent);
......
......@@ -80,7 +80,12 @@ struct entity {
ir_graph *irg; /**< If (type == method_type) this is the corresponding irg.
The ir_graph constructor automatically sets this field.
Yes, it must be here. */
#ifdef DEBUG_libfirm
int nr; /**< a unique node number for each node to make output
readable. */
#endif
};
INLINE long get_entity_nr(entity *ent);
# endif /* _ENTITY_T_H_ */
......@@ -24,6 +24,10 @@
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
# include <stdlib.h>
# include <stddef.h>
......@@ -41,6 +45,11 @@
/** TYPE **/
/*******************************************************************/
#ifdef DEBUG_libfirm
/** Returns a new, unique number to number nodes or the like. */
int get_irp_new_node_nr(void);
#endif
unsigned long type_visited;
INLINE void set_master_type_visited(unsigned long val) { type_visited = val; }
INLINE unsigned long get_master_type_visited() { return type_visited; }
......@@ -78,6 +87,9 @@ new_type(tp_op *type_op, ir_mode *mode, ident* name) {
res->size = -1;
res->visit = 0;
res -> link = NULL;
#ifdef DEBUG_libfirm
res->nr = get_irp_new_node_nr();
#endif
return res;
}
......@@ -159,6 +171,17 @@ void set_type_ident(type *tp, ident* id) {
tp->name = id;
}
/* Outputs a unique number for this node */
INLINE long
get_type_nr(type *tp) {
assert(tp);
#ifdef DEBUG_libfirm
return tp->nr;
#else
return 0;
#endif
}
const char* get_type_name(type *tp) {
assert(tp && tp->kind == k_type);
return (id_to_str(tp->name));
......@@ -794,6 +817,7 @@ INLINE type *new_type_method (ident *name, int n_param, int n_res) {
res->attr.ma.n_res = n_res;
res->attr.ma.res_type = (type **) xmalloc (sizeof (type *) * n_res);
res->attr.ma.variadicity = non_variadic;
return res;
}
type *new_d_type_method (ident *name, int n_param, int n_res, dbg_info* db) {
......@@ -969,6 +993,7 @@ INLINE type *new_type_array (ident *name, int n_dimensions,
}
res->attr.aa.element_type = element_type;
new_entity(res, mangle_u(name, id_from_str("elem_ent", 8)), element_type);
return res;
}
type *new_d_type_array (ident *name, int n_dimensions,
......
......@@ -609,4 +609,9 @@ int is_atomic_type(type *tp);
*/
int is_compound_type(type *tp);
/** Outputs a unique number for this node if libfirm is compiled for
debugging, (configure with --enable-debug) else returns 0. */
INLINE long get_type_nr(type *tp);
# endif /* _TYPE_H_ */
......@@ -6,9 +6,10 @@
# ifndef _TYPE_T_H_
# define _TYPE_T_H_
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "type.h"
/**
* @file type_t.h
* This file contains the datatypes hidden in type.h.
......@@ -115,6 +116,11 @@ struct type {
unsigned long visit; /**< visited counter for walks of the type information */
void *link; /**< holds temporary data - like in irnode_t.h */
struct dbg_info* dbi; /**< A pointer to information for debug support. */
#ifdef DEBUG_libfirm
int nr; /**< a unique node number for each node to make output
readable. */
#endif
tp_attr attr; /* type kind specific fields. This must be the last
entry in this struct! Varying size! */
};
......
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