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

*** empty log message ***

[r90]
parent da7cc0f7
27.2.2001 Goetz
Moved struct from irprog.h to irprog_t.h
Moved struct from irprog.h to irprog_t.h, same for irmode.h.
Added a module deb_info in debug.h. Adapted makefile. Added example
use in iropt.h.
Removed use of debug.h in ident.c. Now debug.c|h can be moved to
/adt/.
Removed inabled code for dead node elimination in irgopt.h.
Renamed some missnamed access routines (_of_). Macros with old names
are in old_fctnames.h.
Edited makefiles to remove #* and *.flc.
??.2.2001 Goetz
Some minor bugfixes...
25.1.2001 Goetz
After compacting of in arrays in dead_node_elimination
......
......@@ -61,7 +61,8 @@ clean:
rm -f $(OFILES) $(DFILES)
realclean: clean
rm -f $(TARGET) *.flc TAGS
rm -f $(TARGET) *.flc TAGS \#*
rm -rf auto/
-include $(DFILES)
......@@ -67,6 +67,7 @@ clean:
rm -f $(OFILES) $(DFILES)
realclean: clean
rm -f $(TARGET) *.flc TAGS
rm -f $(TARGET) *.flc TAGS \#*
rm -rf auto/
-include $(DFILES)
......@@ -15,7 +15,7 @@ DEPENDFLAGS = -M
LIBPATH =
LIBS =
X_LIBS =
INCLUDES = -I../adt -I../common -I../debug
INCLUDES = -I../adt -I../common -I../debug -I../ir
X_INCLUDES =
AR = ar rcs
......@@ -24,7 +24,7 @@ SHELL = /bin/sh
MAKE = /usr/bin/make
DISTRIBMEMBERS =
MEMBERS = $(DISTRIBMEMBERS) debug.m
MEMBERS = $(DISTRIBMEMBERS) debug.m debinfo.m
CFILES = $(MEMBERS:.m=.c)
......@@ -61,6 +61,7 @@ clean:
rm -f $(OFILES) $(DFILES)
realclean: clean
rm -f $(TARGET) *.flc TAGS
rm -f $(TARGET) *.flc TAGS \#*
rm -rf auto/
-include $(DFILES)
/*
** Copyright (C) 2001 by Universitaet Karlsruhe
** All rights reserved.
**
** Authors: Goetz Lindenmaier
**
** debinfo: This is a empty implementation of the Firm interface to
** debugging support. It only guarantees that the Firm library compiles
** and runs without any real debugging support.
** The functions herein are declared weak so that they can be overriden
** by a real implementation.
*/
#include "debinfo.h"
void deb_info_copy(ir_node *new, ir_node *old, ident *info) {
}
void deb_info_merge(ir_node **new_nodes, ir_node **old_nodes, ident *info) {
}
/*
** Copyright (C) 2001 by Universitaet Karlsruhe
** All rights reserved.
**
** Authors: Goetz Lindenmaier
**
** debinfo: This is the Firm interface to debugging support. Firm requires
** a debugging module fulfilling this interface.
** The interface requires a datatype representing the debugging information.
** Firm supports administrating a reference to the debug information
** in every firm node. Further Firm optimizations call routines to
** propagate debug information from old nodes to new nodes if the optimization
** replaces the old ones by the new ones.
**
** This file does not belong to the interface of the firm library.
*/
# ifndef _DEBINFO_H_
# define _DEBINFO_H_
#include "irnode.h"
#include "ident.h"
/* A datastructure containing information for debugging. */
typedef struct deb_info deb_info;
/* Every Firm node contains a reference to a deb_info struct. This reference
can be accessed by the debug support module by
deb_info *get_irn_deb_info(irnode *n);
void set_irn_deb_info(irnode *n, deb_info *d);.
The module may not touch or change anything else in the Firm data structure.
*/
/** The following routines are called by firm optmizations. The optimization
passes an ident representing a string that describes the optimization
performed. **/
/* deb_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 deb_info_copy(ir_node *new, ir_node *old, ident *info);
/* deb_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 deb_info_merge(ir_node **new_nodes, ir_node **old_nodes, ident *info);
#endif /* _DEBINFO_H_ */
......@@ -6,9 +6,9 @@
#define _DEBUG_H_
void d_init (int nflags);
int d_ (int flag, unsigned level);
int d_level (int flag);
int d_set_level (int flag, unsigned level);
int d_ (int flag, unsigned level);
int d_level (int flag);
int d_set_level (int flag, unsigned level);
void d_parse (const char *s);
#ifdef DEBUG
......
......@@ -60,6 +60,7 @@ clean:
rm -f $(OFILES) $(DFILES)
realclean: clean
rm -f $(TARGET) *.flc TAGS
rm -f $(TARGET) *.flc TAGS \#*
rm -rf auto/
-include $(DFILES)
......@@ -15,8 +15,13 @@
/* Identifiers */
typedef const struct set_entry ident;
/* Stores a string in the ident module and returns a handle for
the string. */
inline ident *id_from_str (char *str, int len);
/* Returns the string represented by id. This string is not Null
terminated! */
inline const char *id_to_str (ident *id);
/* Returns the length of the string represented by id. */
inline int id_to_strlen(ident *id);
# endif /* _IDENT_H_ */
......@@ -13,7 +13,6 @@
#include <assert.h>
#include <stddef.h>
#include "misc.h"
#include "debug.h"
#include "set.h"
#include "ident.h"
......@@ -33,18 +32,17 @@ ident *new_id_internal (void);
bool id_is_internal (ident *);
void id_init (void);
#ifdef NDEBUG
/* Vormals Debugunterstuetzung, entfernt (debug.h). */
# define ID_VRFY(id) ((void)0)
#ifdef NDEBUG
# define IDS_VRFY(id) ((void)0)
#else
# define ID_VRFY(id) \
assert ( (id) \
&& ( !d_ (df_vrfy_level, 1) \
|| (ID_FROM_STR (ID_TO_STR((id)), ID_TO_STRLEN((id))) == (id))))
# define IDS_VRFY(id) ids_vrfy ((id))
void ids_vrfy (ident **id);
#endif
#ifdef STATS
# define id_stats() set_stats (id_set)
#else
......
......@@ -29,12 +29,13 @@ MEMBERS = $(DISTRIBMEMBERS)
CFILES = $(MEMBERS:.m=.c)
HFILES = $(MEMBERS:.m=.h)
HFILES += irnode_t.h irgraph_t.h irop_t.h
HFILES += irnode_t.h irgraph_t.h ir_prog.h irop_t.h irmode_t.h
HFILES += array.h common.h cookies.h debug.h entity.h gmp.h \
host.h ident.h label.h misc.h obst.h pdeq.h pset.h \
set.h tune.h tv.h type.h xprintf.h xp_help.h irnode2.h
DISTRIB = $(DISTRIBMEMBERS:.m=.h)
DISTRIB += old_fctnames.h
OFILES = $(MEMBERS:%.m=../objects/%.o)
......@@ -66,6 +67,7 @@ clean:
rm -f $(OFILES) $(DFILES)
realclean: clean
rm -f $(TARGET) *.flc TAGS
rm -f $(TARGET) *.flc TAGS \#*
rm -rf auto/
-include $(DFILES)
......@@ -11,6 +11,7 @@
# include "irgraph_t.h"
# include "irnode_t.h"
# include "irmode_t.h"
# include "ircons.h"
# include "common.h"
# include "irvrfy.h"
......@@ -619,8 +620,8 @@ new_Block (int arity, ir_node **in)
/* Create and initialize array for Phi-node construction. */
res->attr.block.graph_arr = NEW_ARR_D (ir_node *, current_ir_graph->obst,
current_ir_graph->params);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->params);
current_ir_graph->n_loc);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
res = optimize (res);
irn_vrfy (res);
......@@ -1525,8 +1526,8 @@ ir_node *new_immBlock (void) {
/* Create and initialize array for Phi-node construction. */
res->attr.block.graph_arr = NEW_ARR_D (ir_node *, current_ir_graph->obst,
current_ir_graph->params);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->params);
current_ir_graph->n_loc);
memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc);
/* Immature block may not be optimized! */
irn_vrfy (res);
......
......@@ -1251,11 +1251,12 @@ void mature_block (ir_node *block);
/** Parameter administration **/
/* Read a value from the array with the local variables. Use this
function to obtain the last definition of the value associated with
pos. */
pos. Pos may not exceed the value passed as n_loc to new_ir_graph. */
ir_node *get_value (int pos, ir_mode *mode);
/* Write a value in the array with the local variables. Use this function
to remember a new definition of the value associated with pos. */
to remember a new definition of the value associated with pos. Pos may
not exceed the value passed as n_loc to new_ir_graph. */
void set_value (int pos, ir_node *value);
/* Read a store.
......
......@@ -60,7 +60,7 @@ dump_node_opcode (ir_node *n)
}
/* all others */
} else {
xfprintf (F, "%I", n->op->name);
xfprintf (F, "%I", get_irn_opident(n));
}
}
......@@ -84,7 +84,7 @@ dump_node_mode (ir_node *n)
case iro_Shr:
case iro_Abs:
case iro_Cmp:
xfprintf (F, "%I", n->mode->name);
xfprintf (F, "%I", get_mode_ident(n->mode));
break;
default:
}
......@@ -107,7 +107,7 @@ dump_node_nodeattr (ir_node *n)
xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
/* xdoesn't work for some reason.
fprintf (F, "\"%I %I\" ", n->op->name, n->attr.s.ent); */
fprintf (F, "\"%I %I\" ", get_irn_opident(n), n->attr.s.ent); */
break;
default:
} /* end switch */
......@@ -163,123 +163,123 @@ dump_ir_node (ir_node *n)
switch (n->op->code) { /* node label */
case iro_Start:
xfprintf (F, "\"%I\" color: blue ", n->op->name);
xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_End:
xfprintf (F, "\"%I\" color: blue ", n->op->name);
xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Block:
xfprintf (F, "\"%I\" color: lightyellow ", n->op->name);
xfprintf (F, "\"%I\" color: lightyellow ", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Phi:
xfprintf (F, "\"%I%I\" color: green", n->op->name, n->mode->name);
if (n->mode->code == irm_M)
xfprintf (F, "\"%I%I\" color: green", get_irn_opident(n), get_irn_modeident(n));
if (get_irn_modecode(n) == irm_M)
xfprintf (F, DEFAULT_NODE_ATTR " color: green");
else
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Const:
xfprintf (F, "\"%v%I\" color: yellow ", n->attr.con, n->mode->name);
xfprintf (F, "\"%v%I\" color: yellow ", n->attr.con, get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Id:
xfprintf (F, "\"%I%I\" ", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Proj:
if (n->in[1]->op->code == iro_Cmp) {
xfprintf (F, "\"%I%I %s\" color: yellow", n->op->name, n->mode->name,
xfprintf (F, "\"%I%I %s\" color: yellow", get_irn_opident(n), get_irn_modeident(n),
get_pnc_string(n->attr.proj));
} else {
xfprintf (F, "\"%I%I %ld\"", n->op->name, n->mode->name, n->attr.proj);
xfprintf (F, "\"%I%I %ld\"", get_irn_opident(n), get_irn_modeident(n), n->attr.proj);
}
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Conv:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Tuple:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Add:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Sub:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Mul:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Quot:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_DivMod:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Div:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Mod:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_And:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Or:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Eor:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Shl:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Shr:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Abs:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Cmp:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Jmp:
xfprintf (F, "\"%I\"", n->op->name);
xfprintf (F, "\"%I\"", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Cond:
xfprintf (F, "\"%I\"", n->op->name);
xfprintf (F, "\"%I\"", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Call:
xfprintf (F, "\"%I\"", n->op->name);
xfprintf (F, "\"%I\"", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Return:
xfprintf (F, "\"%I\"", n->op->name);
xfprintf (F, "\"%I\"", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Raise:
xfprintf (F, "\"%I%I\"", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Load:
......@@ -288,15 +288,15 @@ dump_ir_node (ir_node *n)
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Alloc:
xfprintf (F, "\"%I\" ", n->op->name);
xfprintf (F, "\"%I\" ", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Sel:
assert(get_kind(get_Sel_entity(n)) == k_entity);
xfprintf (F, "\"%I ", n->op->name);
xfprintf (F, "\"%I ", get_irn_opident(n));
xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
/* xdoesn't work for some reason.
fprintf (F, "\"%I %I\" ", n->op->name, get_entity_ident(get_Sel_entity(n))); */
fprintf (F, "\"%I %I\" ", get_irn_opident(n), get_entity_ident(get_Sel_entity(n))); */
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_SymConst:
......@@ -318,15 +318,15 @@ dump_ir_node (ir_node *n)
xfprintf (F, DEFAULT_NODE_ATTR);
break;
case iro_Sync:
xfprintf (F, "\"%I\" ", n->op->name);
xfprintf (F, "\"%I\" ", get_irn_opident(n));
xfprintf (F, DEFAULT_NODE_ATTR " color: green");
break;
case iro_Bad:
xfprintf (F, "\"%I%I\" ", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
xfprintf (F, DEFAULT_NODE_ATTR);
break;
default:
xfprintf (F, "\"%I%I\" ", n->op->name, n->mode->name);
xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
}
xfprintf (F, "}\n"); /* footer */
}
......
......@@ -11,7 +11,7 @@
# include "irnode.h"
/* Turns a node into a "useless" Tuple. The Tuple just forms a tuple
/* Turns a node into a "useless" Tuple. The Tuple node just forms a tuple
from several inputs. The predecessors of the tuple have to be
set by hand.
This is useful if a node returning a tuple is removed, but the Projs
......
......@@ -127,7 +127,7 @@ copy_node (ir_node *n, void *env) {
Spare the Bad predecessors of Phi and Block nodes. */
inline void
copy_preds (ir_node *n, void *env) {
ir_node *nn, *block, *on;
ir_node *nn, *block/*, *on*/;
int i, j;
nn = get_new_node(n);
......@@ -241,384 +241,3 @@ dead_node_elimination(ir_graph *irg) {
current_ir_graph = rem;
}
#if 0 /* An old implementation */
/* To break the recursion of the graph walk if there are loops in
the graph we have to allocate new nodes for Phis and blocks
before descending. Here we use the old predecessors for the
new nodes. These are replaced by the proper predecessors in
copy_node.
It turned out that it is not sufficient to just break loops
for Phi and Block nodes, as the walker can hit visited but
not copied nodes at any point in the graph.
A simple fix would be allocating Id's for every node and then
exchanging them, but this will cause new dead nodes on the new
obstack.
So now there is a different implementation more based on the
view on the graph as a graph than as a represented program. */
void
create_dummy (ir_node *n, void *env) {
assert (n);
/* Assure link is set to NULL so we can test whether there is a
new node by checking link.
set_irn_link(n, NULL); */
switch (get_irn_opcode(n)) {
case iro_Block:
set_new_node(n, new_ir_node(current_ir_graph, NULL, op_Block, mode_R,
get_irn_arity(n), get_irn_in(n)));
break;
case iro_Phi:
set_new_node(n, new_ir_node(current_ir_graph, NULL, op_Phi,
get_irn_mode(n),
get_irn_arity(n), get_irn_in(n)));
break;
default: {}
} /* end switch (get_irn_opcode(n)) */
}
/* Create a copy of this node on a new obstack. */
void
copy_node2 (ir_node *n, void *env) {
ir_node *res = NULL;
ir_node *a = NULL;
ir_node *b = NULL;
int i = 0;
assert (n);
DDMSG2(n);
if (is_binop(n)) {
a = get_binop_left(n);
b = get_binop_right(n);
} else if (is_unop(n)) {
a = get_unop_op(n);
}
switch (get_irn_opcode(n)) {
case iro_Block:
{
res = get_new_node(n);
assert(res);
for (i = 0; i < get_Block_n_cfgpreds(n); i++)
set_Block_cfgpred(res, i, get_new_node(get_Block_cfgpred(n, i)));
set_Block_matured(res, 1);
}
break;
case iro_Start:
res = new_r_Start (current_ir_graph, get_new_node(get_nodes_Block(n)));
break;
case iro_End:
res = new_r_End (current_ir_graph, get_new_node(get_nodes_Block(n)));
current_ir_graph -> end = res;
current_ir_graph -> end_block = get_nodes_Block(res);
break;
case iro_Jmp:
res = new_r_Jmp (current_ir_graph, get_new_node(get_nodes_Block(n)));
break;
case iro_Cond:
res = new_r_Cond (current_ir_graph, get_new_node(get_nodes_Block(n)),
get_new_node(get_Cond_selector(n)));
break;
case iro_Return:
{
ir_node **in;
in = get_Return_res_arr(n);