Commit 978e0407 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

Implemented debug support.

Optimization sitll looses information.

[r372]
parent b28fc936
......@@ -27,7 +27,7 @@ LN_S := @LN_S@
# profiling enabled?
ifeq (@enable_profile_libfirm@,yes)
LDFLAGS += -g -pg
LDFLAGS += # -g -pg GL: geht bei mir nicht: unrecognised option
endif
AR := @AR@
......
......@@ -21,7 +21,7 @@ include $(topdir)/MakeRules
CPPFLAGS += -I$(top_srcdir)/ir/common -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr \
-I$(top_srcdir)/ir/adt -I$(top_srcdir)/ir/tv -I$(top_srcdir)/ir/ir \
-I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st
-I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st -I$(top_srcdir)/ir/debug
include $(top_srcdir)/MakeTargets
......
......@@ -17,24 +17,43 @@
# include <config.h>
#endif
#include "dbginfo.h"
#include "dbginfo_t.h"
#include "irnode_t.h"
inline void
set_irn_dbg_info(ir_node *n, struct dbg_info* db) {
n->dbi = db;
dbg_info_merge_pair(ir_node *nw, ir_node *old, ident *info) {
set_irn_dbg_info(nw, get_irn_dbg_info(old));
}
inline struct dbg_info *
get_irn_dbg_info(ir_node *n) {
return n->dbi;
inline void
dbg_info_merge_sets(ir_node **new_nodes, ir_node **old_nodes, ident *info) {
}
inline void
dbg_info_copy(ir_node *nw, ir_node *old, ident *info) {
set_irn_dbg_info(new, get_irn_dbg_info(old));
void (*__dbg_info_merge_pair)(ir_node *nw, ir_node *old, ident *info)
= &dbg_info_merge_pair;
void (*__dbg_info_merge_sets)(ir_node **new_nodes, ir_node **old_nodes,
ident *info)
= &dbg_info_merge_sets;
void dbg_init( void (merge_pair)(ir_node *nw, ir_node *old, ident *info) ,
void (merge_sets)(ir_node **new_nodes, ir_node **old_nodes,
ident *info)
) {
__dbg_info_merge_pair = merge_pair;
__dbg_info_merge_sets = merge_sets;
}
inline void
dbg_info_merge(ir_node **new_nodes, ir_node **old_nodes, ident *info) {
set_irn_dbg_info(ir_node *n, struct dbg_info* db) {
n->dbi = db;
}
inline struct dbg_info *
get_irn_dbg_info(ir_node *n) {
return n->dbi;
}
......@@ -20,7 +20,6 @@
# ifndef _DBGINFO_H_
# define _DBGINFO_H_
#include "irnode.h"
#include "ident.h"
#ifndef _IR_NODE_TYPEDEF_
......@@ -30,6 +29,27 @@ typedef struct ir_node ir_node;
/* A datastructure containing information for debugging. */
typedef struct dbg_info dbg_info;
/* Sets the functions called by libfirm when changing the IR.
The following routines are called by firm optmizations. The optimization
passes an ident representing a string that describes the optimization
performed.
- dbg_info_merge_pair() is called in the following situation:
The optimization replaced the old node by the new one. The new node
might be a recent allocated node not containing any debug information,
or just another node from somewhere in the graph with the same
semantics.
- dbg_info_merge_sets() is called in the following situation:
The optimization replaced a subgraph by another subgraph. There is no
obviouse mapping between single nodes in both subgraphs. The optimization
simply passes two lists to the debug module, one containing the nodes in
the old subgraph, the other containing the nodes in the new subgraph.
*/
void dbg_init( void (merge_pair)(ir_node *nw, ir_node *old, ident *info),
void (merge_sets)(ir_node **new_nodes, ir_node **old_nodes,
ident *info)
);
/* Every Firm node contains a reference to a dbg_info struct. This reference
can be accessed by the debug support module by
dbg_info *get_irn_dbg_info(irnode *n);
......@@ -37,25 +57,8 @@ typedef struct dbg_info dbg_info;
The module may not touch or change anything else in the Firm data structure.
*/
inline void set_irn_dbg_info(ir_node *n, dbg_info* db);
inline dbg_info *get_irn_dbg_info(ir_node *n);
/** The following routines are called by firm optmizations. The optimization
passes an ident representing a string that describes the optimization
performed. **/
/* dbg_info_copy() is called in the following situation:
The optimization replaced the old node by the new one. The new node
might be a recent allocated node not containing any debug information,
or just another node from somewhere in the graph with the same
semantics. */
void dbg_info_copy(ir_node *nw, ir_node *old, ident *info);
/* dbg_info_merge() is called in the following situation:
The optimization replaced a subgraph by another subgraph. There is no
obviouse mapping between single nodes in both subgraphs. The optimization
simply passes two lists to the debug module, one containing the nodes in
the old subgraph, the other containing the nodes in the new subgraph. */
void dbg_info_merge(ir_node **new_nodes, ir_node **old_nodes, ident *info);
inline dbg_info *get_irn_dbg_info(ir_node *n);
......
......@@ -51,7 +51,7 @@ new_rd_Block (dbg_info* db, ir_graph *irg, int arity, ir_node **in)
{
ir_node *res;
res = new_ir_node (irg, NULL, op_Block, mode_R, arity, in);
res = new_ir_node (db, irg, NULL, op_Block, mode_R, arity, in);
set_Block_matured(res, 1);
set_Block_block_visited(res, 0);
......@@ -66,7 +66,7 @@ new_rd_Start (dbg_info* db, ir_graph *irg, ir_node *block)
{
ir_node *res;
res = new_ir_node (irg, block, op_Start, mode_T, 0, NULL);
res = new_ir_node (db, irg, block, op_Start, mode_T, 0, NULL);
irn_vrfy (res);
return res;
......@@ -77,7 +77,7 @@ new_rd_End (dbg_info* db, ir_graph *irg, ir_node *block)
{
ir_node *res;
res = new_ir_node (irg, block, op_End, mode_X, -1, NULL);
res = new_ir_node (db, irg, block, op_End, mode_X, -1, NULL);
irn_vrfy (res);
return res;
......@@ -93,7 +93,7 @@ new_rd_Phi (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in
assert( get_Block_matured(block) );
assert( get_irn_arity(block) == arity );
res = new_ir_node (irg, block, op_Phi, mode, arity, in);
res = new_ir_node (db, irg, block, op_Phi, mode, arity, in);
res = optimize (res);
irn_vrfy (res);
......@@ -109,7 +109,7 @@ ir_node *
new_rd_Const (dbg_info* db, ir_graph *irg, ir_node *block, ir_mode *mode, tarval *con)
{
ir_node *res;
res = new_ir_node (irg, block, op_Const, mode, 0, NULL);
res = new_ir_node (db, irg, block, op_Const, mode, 0, NULL);
res->attr.con = con;
res = optimize (res);
irn_vrfy (res);
......@@ -126,7 +126,7 @@ new_rd_Id (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *val, ir_mode *m
{
ir_node *in[1] = {val};
ir_node *res;
res = new_ir_node (irg, block, op_Id, mode, 1, in);
res = new_ir_node (db, irg, block, op_Id, mode, 1, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -138,7 +138,7 @@ new_rd_Proj (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *arg, ir_mode
{
ir_node *in[1] = {arg};
ir_node *res;
res = new_ir_node (irg, block, op_Proj, mode, 1, in);
res = new_ir_node (db, irg, block, op_Proj, mode, 1, in);
res->attr.proj = proj;
assert(res);
......@@ -169,7 +169,7 @@ new_rd_Conv (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *op, ir_mode *
{
ir_node *in[1] = {op};
ir_node *res;
res = new_ir_node (irg, block, op_Conv, mode, 1, in);
res = new_ir_node (db, irg, block, op_Conv, mode, 1, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -181,7 +181,7 @@ new_rd_Tuple (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **
{
ir_node *res;
res = new_ir_node (irg, block, op_Tuple, mode_T, arity, in);
res = new_ir_node (db, irg, block, op_Tuple, mode_T, arity, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -193,7 +193,7 @@ new_rd_Add (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Add, mode, 2, in);
res = new_ir_node (db, irg, block, op_Add, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -205,7 +205,7 @@ new_rd_Sub (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Sub, mode, 2, in);
res = new_ir_node (db, irg, block, op_Sub, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -217,7 +217,7 @@ new_rd_Minus (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[1] = {op};
ir_node *res;
res = new_ir_node (irg, block, op_Minus, mode, 1, in);
res = new_ir_node (db, irg, block, op_Minus, mode, 1, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -229,7 +229,7 @@ new_rd_Mul (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Mul, mode, 2, in);
res = new_ir_node (db, irg, block, op_Mul, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -241,7 +241,7 @@ new_rd_Quot (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[3] = {memop, op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Quot, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_Quot, mode_T, 3, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -253,7 +253,7 @@ new_rd_DivMod (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[3] = {memop, op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_DivMod, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_DivMod, mode_T, 3, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -265,7 +265,7 @@ new_rd_Div (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[3] = {memop, op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Div, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_Div, mode_T, 3, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -277,7 +277,7 @@ new_rd_Mod (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[3] = {memop, op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Mod, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_Mod, mode_T, 3, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -289,7 +289,7 @@ new_rd_And (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_And, mode, 2, in);
res = new_ir_node (db, irg, block, op_And, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -301,7 +301,7 @@ new_rd_Or (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Or, mode, 2, in);
res = new_ir_node (db, irg, block, op_Or, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -313,7 +313,7 @@ new_rd_Eor (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Eor, mode, 2, in);
res = new_ir_node (db, irg, block, op_Eor, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -325,7 +325,7 @@ new_rd_Not (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[1] = {op};
ir_node *res;
res = new_ir_node (irg, block, op_Not, mode, 1, in);
res = new_ir_node (db, irg, block, op_Not, mode, 1, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -337,7 +337,7 @@ new_rd_Shl (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op, k};
ir_node *res;
res = new_ir_node (irg, block, op_Shl, mode, 2, in);
res = new_ir_node (db, irg, block, op_Shl, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -349,7 +349,7 @@ new_rd_Shr (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op, k};
ir_node *res;
res = new_ir_node (irg, block, op_Shr, mode, 2, in);
res = new_ir_node (db, irg, block, op_Shr, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -361,7 +361,7 @@ new_rd_Shrs (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op, k};
ir_node *res;
res = new_ir_node (irg, block, op_Shrs, mode, 2, in);
res = new_ir_node (db, irg, block, op_Shrs, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -373,7 +373,7 @@ new_rd_Rot (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op, k};
ir_node *res;
res = new_ir_node (irg, block, op_Rot, mode, 2, in);
res = new_ir_node (db, irg, block, op_Rot, mode, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -385,7 +385,7 @@ new_rd_Abs (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[1] = {op};
ir_node *res;
res = new_ir_node (irg, block, op_Abs, mode, 1, in);
res = new_ir_node (db, irg, block, op_Abs, mode, 1, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -397,7 +397,7 @@ new_rd_Cmp (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {op1, op2};
ir_node *res;
res = new_ir_node (irg, block, op_Cmp, mode_T, 2, in);
res = new_ir_node (db, irg, block, op_Cmp, mode_T, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -408,7 +408,7 @@ new_rd_Jmp (dbg_info* db, ir_graph *irg, ir_node *block)
{
ir_node *in[0] = {};
ir_node *res;
res = new_ir_node (irg, block, op_Jmp, mode_X, 0, in);
res = new_ir_node (db, irg, block, op_Jmp, mode_X, 0, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -419,7 +419,7 @@ new_rd_Cond (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *c)
{
ir_node *in[1] = {c};
ir_node *res;
res = new_ir_node (irg, block, op_Cond, mode_T, 1, in);
res = new_ir_node (db, irg, block, op_Cond, mode_T, 1, in);
res->attr.c.kind = dense;
res->attr.c.default_proj = 0;
res = optimize (res);
......@@ -441,7 +441,7 @@ new_rd_Call (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
r_in[1] = callee;
memcpy (&r_in[2], in, sizeof (ir_node *) * arity);
res = new_ir_node (irg, block, op_Call, mode_T, r_arity, r_in);
res = new_ir_node (db, irg, block, op_Call, mode_T, r_arity, r_in);
assert(is_method_type(type));
set_Call_type(res, type);
......@@ -462,7 +462,7 @@ new_rd_Return (dbg_info* db, ir_graph *irg, ir_node *block,
NEW_ARR_A (ir_node *, r_in, r_arity);
r_in[0] = store;
memcpy (&r_in[1], in, sizeof (ir_node *) * arity);
res = new_ir_node (irg, block, op_Return, mode_X, r_arity, r_in);
res = new_ir_node (db, irg, block, op_Return, mode_X, r_arity, r_in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -473,7 +473,7 @@ new_rd_Raise (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_no
{
ir_node *in[2] = {store, obj};
ir_node *res;
res = new_ir_node (irg, block, op_Raise, mode_T, 2, in);
res = new_ir_node (db, irg, block, op_Raise, mode_T, 2, in);
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -485,7 +485,7 @@ new_rd_Load (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[2] = {store, adr};
ir_node *res;
res = new_ir_node (irg, block, op_Load, mode_T, 2, in);
res = new_ir_node (db, irg, block, op_Load, mode_T, 2, in);
res = optimize (res);
irn_vrfy (res);
......@@ -498,7 +498,7 @@ new_rd_Store (dbg_info* db, ir_graph *irg, ir_node *block,
{
ir_node *in[3] = {store, adr, val};
ir_node *res;
res = new_ir_node (irg, block, op_Store, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_Store, mode_T, 3, in);
res = optimize (res);
......@@ -512,7 +512,7 @@ new_rd_Alloc (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
{
ir_node *in[2] = {store, size};
ir_node *res;
res = new_ir_node (irg, block, op_Alloc, mode_T, 2, in);
res = new_ir_node (db, irg, block, op_Alloc, mode_T, 2, in);
res->attr.a.where = where;
res->attr.a.type = alloc_type;
......@@ -528,7 +528,7 @@ new_rd_Free (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store,
{
ir_node *in[3] = {store, ptr, size};
ir_node *res;
res = new_ir_node (irg, block, op_Free, mode_T, 3, in);
res = new_ir_node (db, irg, block, op_Free, mode_T, 3, in);
res->attr.f = free_type;
......@@ -550,7 +550,7 @@ new_rd_Sel (dbg_info* db, ir_graph *irg, ir_node *block, ir_node *store, ir_node
r_in[0] = store;
r_in[1] = objptr;
memcpy (&r_in[2], in, sizeof (ir_node *) * arity);
res = new_ir_node (irg, block, op_Sel, mode_p, r_arity, r_in);
res = new_ir_node (db, irg, block, op_Sel, mode_p, r_arity, r_in);
res->attr.s.ltyp = static_linkage;
res->attr.s.ent = ent;
......@@ -571,7 +571,7 @@ new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, type_or_id_p value
mode = mode_p;
else
mode = mode_I;
res = new_ir_node (irg, block, op_SymConst, mode, 0, in);
res = new_ir_node (db, irg, block, op_SymConst, mode, 0, in);
res->attr.i.num = symkind;
if (symkind == linkage_ptr_info) {
......@@ -592,7 +592,7 @@ new_rd_Sync (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **i
{
ir_node *res;
res = new_ir_node (irg, block, op_Sync, mode_M, arity, in);
res = new_ir_node (db, irg, block, op_Sync, mode_M, arity, in);
res = optimize (res);
irn_vrfy (res);
......@@ -788,7 +788,7 @@ new_d_Start (dbg_info* db)
{
ir_node *res;
res = new_ir_node (current_ir_graph, current_ir_graph->current_block,
res = new_ir_node (db, current_ir_graph, current_ir_graph->current_block,
op_Start, mode_T, 0, NULL);
res = optimize (res);
......@@ -800,7 +800,7 @@ ir_node *
new_d_End (dbg_info* db)
{
ir_node *res;
res = new_ir_node (current_ir_graph, current_ir_graph->current_block,
res = new_ir_node (db, current_ir_graph, current_ir_graph->current_block,
op_End, mode_X, -1, NULL);
res = optimize (res);
irn_vrfy (res);
......@@ -862,7 +862,7 @@ inline ir_node *
new_rd_Phi0 (ir_graph *irg, ir_node *block, ir_mode *mode)
{
ir_node *res;
res = new_ir_node (irg, block, op_Phi, mode, 0, NULL);
res = new_ir_node (NULL, irg, block, op_Phi, mode, 0, NULL);
irn_vrfy (res);
return res;
}
......@@ -920,7 +920,7 @@ alloc_or_pop_from_Phi_in_stack(ir_graph *irg, ir_node *block, ir_mode *mode,
if (pos == 0) {
/* We need to allocate a new node */
res = new_ir_node (irg, block, op_Phi, mode, arity, in);
res = new_ir_node (db, irg, block, op_Phi, mode, arity, in);
} else {
/* reuse the old node and initialize it again. */
res = stack[pos-1];
......@@ -978,7 +978,7 @@ new_rd_Phi_in (ir_graph *irg, ir_node *block, ir_mode *mode,
#if USE_EXPLICIT_PHI_IN_STACK
res = known = alloc_or_pop_from_Phi_in_stack(irg, block, mode, ins, in);
#else
res = known = new_ir_node (irg, block, op_Phi, mode, ins, in);
res = known = new_ir_node (NULL, irg, block, op_Phi, mode, ins, in);
#endif
/* The in-array can contain NULLs. These were returned by
get_r_value_internal if it reached the same block/definition on a
......@@ -1202,7 +1202,7 @@ new_rd_Phi_in (ir_graph *irg, ir_node *block, ir_mode *mode,
/* Allocate a new node on the obstack. The allocation copies the in
array. */
res = new_ir_node (irg, block, op_Phi, mode, ins, in);
res = new_ir_node (NULL, irg, block, op_Phi, mode, ins, in);
/* This loop checks whether the Phi has more than one predecessor.
If so, it is a real Phi node and we break the loop. Else the
......@@ -1913,7 +1913,7 @@ ir_node *new_d_immBlock (dbg_info* db) {
assert(get_irg_phase_state (current_ir_graph) == phase_building);
/* creates a new dynamic in-array as length of in is -1 */
res = new_ir_node (current_ir_graph, NULL, op_Block, mode_R, -1, NULL);
res = new_ir_node (db, current_ir_graph, NULL, op_Block, mode_R, -1, NULL);
current_ir_graph->current_block = res;
res->attr.block.matured = 0;
res->attr.block.exc = exc_normal;
......
......@@ -150,7 +150,8 @@ copy_node (ir_node *n, void *env) {
new_arity = get_irn_arity(n);
}
}
nn = new_ir_node(current_ir_graph,
nn = new_ir_node(get_irn_dbg_info(n),
current_ir_graph,
block,
get_irn_op(n),
get_irn_mode(n),
......@@ -236,7 +237,8 @@ copy_graph () {
oe = get_irg_end(current_ir_graph);
/* copy the end node by hand, allocate dynamic in array! */
ne = new_ir_node(current_ir_graph,
ne = new_ir_node(get_irn_dbg_info(oe),
current_ir_graph,
NULL,
op_End,
mode_X,
......
......@@ -98,7 +98,7 @@ new_ir_graph (entity *ent, int n_loc)
res->start_block = new_immBlock ();
res->start = new_Start ();
res->bad = new_ir_node (res, res->start_block, op_Bad, mode_T, 0, NULL);
res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
/* Proj results of start node */
projX = new_Proj (res->start, mode_X, pns_initial_exec);
......@@ -149,7 +149,7 @@ ir_graph *new_const_code_irg() {
res->end_block = new_immBlock ();
res->end = new_End ();
mature_block(get_cur_block());
res->bad = new_ir_node (res, res->start_block, op_Bad, mode_T, 0, NULL);
res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
res->start = new_Start ();
/* Proj results of start node */
projX = new_Proj (res->start, mode_X, pns_initial_exec);
......
......@@ -77,7 +77,7 @@ init_irnode (void)
/* some incoming irnodes */
/* this constructor is used in every specified irnode constructor */
inline ir_node *
new_ir_node (ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode,
new_ir_node (dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode,
int arity, ir_node **in)
{
ir_node *res;
......@@ -97,6 +97,7 @@ new_ir_node (ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode,
memcpy (&res->in[1], in, sizeof (ir_node *) * arity);
}
res->in[0] = block;
set_irn_dbg_info(res, db);
res->out = NULL;
#ifdef DEBUG_libfirm
......
......@@ -18,6 +18,7 @@
# include "irmode.h"
# include "tv.h"
# include "type.h"
# include "dbginfo.h"
/* The typedefiniton of ir_node is also in irgraph.h to resolve
recursion between irnode.h and irgraph.h */
......@@ -108,7 +109,8 @@ inline long get_irn_node_nr(ir_node *node);
/* If arity is negative, a node with a dynamic array is created. */
inline ir_node *
new_ir_node (ir_graph *irg,
new_ir_node (dbg_info *db,
ir_graph *irg,
ir_node *block,
ir_op *op,
ir_mode *mode,
......
......@@ -16,6 +16,7 @@
# include "irop_t.h"
# include "common_t.h"
# include "irdom_t.h" /* For size of struct dom_info. */
# include "dbginfo.h"
# include "exc.h"
......@@ -116,6 +117,7 @@ struct ir_node {
shall replace a node. */
/** Fields for optimizations / analysis information **/
struct ir_node **out; /* array of out edges */
struct dbg_info* dbi; /* A pointer to information for debug support. */
/** For debugging **/
#ifdef DEBUG_libfirm
int node_nr; /* a unique node number for each node to make output
......