*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 1 Mar 2001 10:17:38 +0000 (10:17 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 1 Mar 2001 10:17:38 +0000 (10:17 +0000)
[r90]

40 files changed:
Changes
ir/adt/Makefile
ir/common/Makefile
ir/debug/Makefile
ir/debug/debinfo.c [new file with mode: 0644]
ir/debug/debinfo.h [new file with mode: 0644]
ir/debug/debug.h
ir/ident/Makefile
ir/ident/ident.h
ir/ident/ident_t.h
ir/ir/Makefile
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irdump.c
ir/ir/irgmod.h
ir/ir/irgopt.c
ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irgraph_t.h
ir/ir/irmode.c
ir/ir/irmode.h
ir/ir/irmode_t.h [new file with mode: 0644]
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irop.c
ir/ir/irop.h
ir/ir/iropt.c
ir/ir/irprog.c
ir/ir/irprog.h
ir/ir/irprog_t.h [new file with mode: 0644]
ir/ir/old_fctnames.h [new file with mode: 0644]
ir/tr/Makefile
ir/tr/mangle.h
ir/tr/type_or_entity.h
ir/tv/Makefile
ir/tv/tv.c
ir/tv/tv.h
testprograms/Makefile
testprograms/array-heap_example.c
testprograms/if_else_example.c

diff --git a/Changes b/Changes
index e3f5bd6..3bed2af 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,16 @@
   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
index 6a460b2..80a7600 100644 (file)
@@ -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)
index 5e13f8b..33a340d 100644 (file)
@@ -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)
index 53cd83a..66b7f30 100644 (file)
@@ -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)
diff --git a/ir/debug/debinfo.c b/ir/debug/debinfo.c
new file mode 100644 (file)
index 0000000..1437db7
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+**  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) {
+}
diff --git a/ir/debug/debinfo.h b/ir/debug/debinfo.h
new file mode 100644 (file)
index 0000000..c7ca37d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+**  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_ */
index 89c1392..cb49dd3 100644 (file)
@@ -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
index 712ebfb..dd24f78 100644 (file)
@@ -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)
index 63cbd8b..48a58f3 100644 (file)
 /* 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_ */
index 51e0e01..075d992 100644 (file)
@@ -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
index db63ae9..c6fac71 100644 (file)
@@ -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)
index d4f55e4..5b8e16f 100644 (file)
@@ -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);
index 7c79dba..b00434f 100644 (file)
@@ -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.
index baf5464..213af81 100644 (file)
@@ -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 */
 }
index 02531c6..36c4fd8 100644 (file)
@@ -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
index cc67a35..a68c20e 100644 (file)
@@ -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);
-      for (i = 0; i < get_Return_n_res(n); i++)
-       set_Return_res(n, i, get_new_node(get_Return_res(n, i)));
-      res = new_r_Return (current_ir_graph,
-                         get_new_node(get_nodes_Block(n)),
-                         get_new_node(get_Return_mem(n)),
-                         get_Return_n_res(n), in);
-    }
-    break;
-  case iro_Raise:
-    res = new_r_Raise (current_ir_graph,
-                      get_new_node(get_nodes_Block(n)),
-                      get_new_node(get_Raise_mem(n)),
-                      get_new_node(get_Raise_exo_ptr(n)));
-    break;
-  case iro_Const:
-    res = new_r_Const (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                      get_irn_mode(n), get_Const_tarval(n));
-    break;
-  case iro_SymConst:
-    {
-      type_or_id_p value = NULL;
-
-      if ((get_SymConst_kind(n)==type_tag) || (get_SymConst_kind(n)==size))
-       {
-
-          value = (type_or_id_p) get_SymConst_type(n);
-       }
-      else
-       {
-         if (get_SymConst_kind(n)==linkage_ptr_info)
-         {
-           value = (type_or_id_p) get_SymConst_ptrinfo(n);
-         }
-       }
-    res = new_r_SymConst (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                         value, get_SymConst_kind (n));
-    }
-    break;
-  case iro_Sel:
-    {
-      ir_node **in = get_Sel_index_arr(n);
-      for (i = 0; i < get_Sel_n_index(n); i++)
-       set_Sel_index(n, i, get_new_node(get_Sel_index(n, i)));
-      res = new_r_Sel (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                      get_new_node(get_Sel_mem(n)),
-                      get_new_node(get_Sel_ptr(n)), get_Sel_n_index(n),
-                      in, get_Sel_entity(n));
-    }
-    break;
-  case  iro_Call:
-    {
-      ir_node **in;
-      in = get_Call_param_arr(n);
-
-      for (i = 0; i < get_Call_arity(n); i++)
-       set_Call_param(n, i, get_new_node(get_Call_param(n, i)));
-      res = new_r_Call (current_ir_graph,
-                       get_new_node(get_nodes_Block(n)),
-                       get_new_node(get_Call_mem(n)),
-                       get_new_node(get_Call_ptr(n)),
-                       get_Call_arity(n), in,
-                       get_Call_type (n));
-    }
-    break;
-  case iro_Add:
-    res = new_r_Add (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(a), get_new_node(b), get_irn_mode(n));
-    break;
-  case iro_Sub:
-    {
-      res = new_r_Sub (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                       get_new_node(a), get_new_node(b), get_irn_mode(n));
-    }
-    break;
-  case iro_Minus:
-    res = new_r_Minus (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                      get_new_node(a), get_irn_mode(n));
-    break;
-  case iro_Mul:
-    res = new_r_Mul (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(a), get_new_node(b), get_irn_mode(n));
-    break;
-  case iro_Quot:
-    res = new_r_Quot (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Quot_mem(n)), get_new_node(a),
-                     get_new_node(b));
-    break;
-  case iro_DivMod:
-    res = new_r_DivMod (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                       get_new_node(get_DivMod_mem(n)), get_new_node(a),
-                       get_new_node(b));
-    break;
-  case iro_Div:
-    res = new_r_Div (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Div_mem(n)), get_new_node(a),
-                    get_new_node(b));
-    break;
-  case iro_Mod:
-    res = new_r_Mod (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Mod_mem(n)), get_new_node(a),
-                    get_new_node(b));
-    break;
-  case iro_Abs:
-    res = new_r_Abs (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Abs_op(n)), get_irn_mode(n));
-    break;
-  case iro_And:
-    res = new_r_And (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(a), get_new_node(b), get_irn_mode(n));
-    break;
-  case iro_Or:
-    res = new_r_Or (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                   get_new_node(a), get_new_node(b), get_irn_mode(n));
-    break;
-  case iro_Eor:
-    res = new_r_Eor (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(a), get_new_node(b), get_irn_mode(n));
-    break;
-  case iro_Not:
-    res = new_r_Not (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Not_op(n)), get_irn_mode(n));
-    break;
-  case iro_Cmp:
-    res = new_r_Cmp (current_ir_graph,
-                    get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Cmp_left(n)),
-                    get_new_node(get_Cmp_right(n)));
-    break;
-  case iro_Shl:
-    res = new_r_Shl (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Shl_left(n)),
-                    get_new_node(get_Shl_right(n)), get_irn_mode(n));
-    break;
-  case iro_Shr:
-    res = new_r_Shr (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Shr_left(n)),
-                    get_new_node(get_Shr_right(n)), get_irn_mode(n));
-    break;
-  case iro_Shrs:
-    res = new_r_Shrs (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Shrs_left(n)),
-                     get_new_node(get_Shrs_right(n)), get_irn_mode(n));
-    break;
-  case iro_Rot:
-    res = new_r_Rot (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                    get_new_node(get_Rot_left(n)),
-                    get_new_node(get_Rot_right(n)), get_irn_mode(n));
-    break;
-  case iro_Conv:
-    res = new_r_Conv (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Conv_op(n)),
-                     get_irn_mode(n));
-    break;
-  case iro_Phi:
-    {
-      res = get_new_node(n);
-      for (i = 0; i < get_Phi_n_preds(n); i++)
-       set_Phi_pred(res, i, get_new_node(get_Phi_pred(n, i)));
-      set_nodes_Block(res, get_new_node(get_nodes_Block(n)));
-    }
-    break;
-  case iro_Load:
-    res = new_r_Load (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Load_mem(n)),
-                     get_new_node(get_Load_ptr(n)));
-    break;
-  case iro_Store:
-    res = new_r_Store (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                      get_new_node(get_Store_mem(n)),
-                      get_new_node(get_Store_ptr(n)),
-                      get_new_node(get_Store_value(n)));
-    break;
-  case iro_Alloc:
-    res = new_r_Alloc (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                      get_new_node(get_Alloc_mem(n)),
-                      get_new_node(get_Alloc_size(n)),
-                      get_Alloc_type(n), get_Alloc_where(n));
-
-    break;
-  case iro_Free:
-    res = new_r_Free (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Free_mem(n)),
-                     get_new_node(get_Free_ptr(n)),
-                     get_new_node(get_Free_size(n)), get_Free_type(n));
-    break;
-  case iro_Sync:
-    {
-      ir_node **in = get_Sync_preds_arr(n);
-      for (i = 0; i < get_Sync_n_preds(n); i++)
-       set_Sync_pred(n, i, get_new_node(get_Sync_pred(n, i)));
-      res = new_r_Sync (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                       get_Sync_n_preds(n), in);
-    }
-    break;
-  case iro_Proj: {
-    res = new_r_Proj (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                     get_new_node(get_Proj_pred(n)), get_irn_mode(n),
-                     get_Proj_proj(n));
-  }
-    break;
-  case iro_Tuple:
-    {
-      ir_node **in = get_Tuple_preds_arr(n);
-      for (i = 0; i < get_Tuple_n_preds(n); i++)
-       set_Tuple_pred(n, i, get_new_node(get_Tuple_pred(n, i)));
-      res = new_r_Tuple (current_ir_graph, get_new_node(get_nodes_Block(n)),
-                        get_Tuple_n_preds(n), in);
-    }
-    break;
-  case iro_Id:
-    res = get_new_node(get_Id_pred(n));
-    break;
-  case iro_Bad:
-    res = new_r_Bad ();
-    break;
-  }
-  /* @@@ Here we could call optimize()!! Not necessary, called in constructor anyways. */
-  set_new_node(n, res);
-  printf(" "); DDMSG2(res);
-}
-
-void
-copy_graph2 () {
-  ir_node *old_node, *new_node, *projX;
-  ir_graph *irg = current_ir_graph;
-
-  /*CS*/
-  printf("Before starting the DEAD NODE ELIMINATION !\n");
-
-  /* Copy nodes remembered in irg fields first.
-     The optimization contains tests against these fields, e.g., not
-     to optimize the start block away.  Therefore these fields have to
-     be fixed first.
-     Further setting these fields in copy_node would impose additional
-     tests for all nodes of a kind.
-     Predict the visited flag the walker will use! */
-  /* Copy the start Block node.  Get the ProjX of the Start node, that is
-     predecessor of the start Block.  We have to break the cycle and fix it
-     later.  We use the old in array as placeholder. */
-  old_node = irg->start_block;
-  new_node = new_r_Block (current_ir_graph, get_Block_n_cfgpreds(old_node),
-                         get_Block_cfgpred_arr(old_node));
-  /* new_r_Block calls no optimization --> save */
-  projX = get_Block_cfgpred(old_node, 0);
-  irg->start_block = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-  /* Copy the Start node */
-  old_node = irg->start;
-  new_node = new_r_Start (current_ir_graph, irg->start_block);
-  irg->start = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-  /* Copy the Bad node */
-  old_node = irg->bad;
-  new_node = new_ir_node (irg, irg->start_block, op_Bad, mode_T, 0, NULL);
-  irg->bad = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-  /* Copy the Projs for the Start's results. */
-  old_node = projX;
-  new_node = new_r_Proj (irg, irg->start_block, irg->start, mode_X, pns_initial_exec);
-  set_Block_cfgpred(irg->start_block, 0, new_node);
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-
-  old_node = irg->frame;
-  new_node = new_r_Proj (irg, irg->start_block, irg->start, mode_p, pns_frame_base);
-  irg->frame = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-
-  old_node = irg->globals;
-  new_node = new_r_Proj (irg, irg->start_block, irg->start, mode_p, pns_globals);
-  irg->globals = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-
-  old_node = irg->args;
-  new_node = new_r_Proj (irg, irg->start_block, irg->start, mode_T, pns_args);
-  irg->args = new_node;
-  set_new_node (old_node, new_node);
-  set_irn_visited (old_node, get_irg_visited(current_ir_graph)+1);
-
-  /* Walks the graph once, and at the recursive way do the copy thing.
-     all reachable nodes will be copied to a new obstack. */
-  irg_walk(irg->end, create_dummy, copy_node2, NULL);
-
-  /*CS*/
-  printf("After DEAD NODE ELIMINATION !\n");
-}
-#endif
index c075a11..249fdb5 100644 (file)
@@ -31,7 +31,7 @@ Phi_in_stack *new_Phi_in_stack();
    and optimization.
 */
 ir_graph *
-new_ir_graph (entity *ent, int params)
+new_ir_graph (entity *ent, int n_loc)
 {
   ir_graph *res;
   ir_node *first_block;
@@ -43,7 +43,7 @@ new_ir_graph (entity *ent, int params)
 
   /** Internal information for graph construction either held in the graph or
   *** initialized for each graph. **/
-  res->params = params + 1;  /* number of local variables that are never
+  res->n_loc = n_loc + 1;  /* number of local variables that are never
                                 dereferenced in this graph plus one for
                                the store. This is not the number of parameters
                                 to the procedure!  */
@@ -232,15 +232,15 @@ set_irg_ent (ir_graph *irg, entity *ent)
 }
 
 int
-get_irg_params (ir_graph *irg)
+get_irg_n_loc (ir_graph *irg)
 {
-  return irg->params;
+  return irg->n_loc;
 }
 
 void
-set_irg_params (ir_graph *irg, int params)
+set_irg_n_loc (ir_graph *irg, int n_loc)
 {
-  irg->params = params;
+  irg->n_loc = n_loc;
 }
 
 unsigned long
index bbd0cd4..af47542 100644 (file)
@@ -27,10 +27,13 @@ typedef struct ir_graph ir_graph;
    optimizations. */
 extern ir_graph *current_ir_graph;
 
-/* create a new ir graph.  Automatically sets the field irg of
-   entity to the new ir graph. */
-ir_graph *new_ir_graph (entity *ent, int params);
-
+/* Create a new ir graph to built ir for a procedure.
+   ent is the entity representing this procedure, i.e., the type of the
+   entity must be type_method.  The constructor automatically sets the
+   field irg of the entity to the new ir graph.
+   n_loc is the number of local variables in this procedure including
+   the procedure parameters. */
+ir_graph *new_ir_graph (entity *ent, int n_loc);
 
 /* access routines for all ir_graph attributes */
 ir_node *get_irg_start_block (ir_graph *irg);
@@ -67,8 +70,9 @@ void     set_irg_current_block (ir_graph *irg, ir_node *node);
 entity  *get_irg_ent (ir_graph *irg);
 void     set_irg_ent (ir_graph *irg, entity *ent);
 
-int      get_irg_params (ir_graph *irg);
-void     set_irg_params (ir_graph *irg, int params);
+/* Use not encouraged, internal of Phi construction algorithm. */
+int      get_irg_n_loc (ir_graph *irg);
+void     set_irg_n_loc (ir_graph *irg, int n_loc);
 
 /* increments visited by one */
 void     inc_irg_visited(ir_graph *irg);
index 4f14bcc..98ffced 100644 (file)
@@ -34,9 +34,8 @@ struct ir_graph {
 #endif
   struct ir_node *current_block;     /* block for newly gen_*()-erated
                                        ir_nodes */
-  int params;                        /* number of local variable in this
-                                       procedure; should be n_loc or so,
-                                       params is ambiguous. */
+  int n_loc;                         /* number of local variable in this
+                                       procedure including procedure parameters. */
   pset *value_table;                 /* value table for global value numbering
                                        for optimizing use in iropt.c */
   unsigned long visited;             /* this flag is an identifier for
index f0440a6..1901632 100644 (file)
@@ -5,7 +5,7 @@
 **
 */
 
-# include "irmode.h"
+# include "irmode_t.h"
 # include <malloc.h>
 # include <stddef.h>
 # include "tv.h"
@@ -31,7 +31,6 @@ ir_mode *mode_M;
 ir_mode *mode_R;
 ir_mode *mode_Z;
 
-
 void
 init_mode (void)
 {
@@ -204,10 +203,12 @@ init_mode (void)
   mode_S->fsigned = 0;
   mode_S->ffloat = 0;
 
+  /* Execution */
   mode_X->name = id_from_str ("X", 1);
   mode_X->fsigned = 0;
   mode_X->ffloat = 0;
 
+  /* Memory */
   mode_M->name = id_from_str ("M", 1);
   mode_M->fsigned = 0;
   mode_M->ffloat = 0;
@@ -219,20 +220,19 @@ init_mode (void)
   mode_Z->name = id_from_str ("Z", 1);
   mode_Z->fsigned = 1;
   mode_Z->ffloat = 0;
-
 }
 
 /* Functions for the direct access to all attributes od a ir_mode */
 
 modecode
-get_modecode_of_mode (ir_mode *mode)
+get_mode_modecode (ir_mode *mode)
 {
   return mode->code;
 }
 
 /*
 inline void
-set_modecode_of_mode (ir_mode *mode, modecode code)
+set_mode_modecode (ir_mode *mode, modecode code)
 {
   mode->code = code;
 }
@@ -246,104 +246,111 @@ get_mode_ident (ir_mode *mode)
 
 /*
 inline void
-set_ident_of_mode (ir_mode *mode, ident *name)
+set_mode_ident (ir_mode *mode, ident *name)
 {
   mode->name = name;
 }
 */
 
+inline const char *
+get_mode_name       (ir_mode *mode) {
+  assert(mode);
+  return id_to_str(mode->name);
+}
+/* void  set_mode_name       (ir_mode *mode, char *name);    */
+
 int
-get_size_of_mode (ir_mode *mode)
+get_mode_size (ir_mode *mode)
 {
   return mode->size;
 }
 /*
 inline void
-set_size_of_mode (ir_mode *mode, int size)
+set_mode_size (ir_mode *mode, int size)
 {
   mode->size = size;
 }
 */
 
 int
-get_ld_align_of_mode (ir_mode *mode)
+get_mode_ld_align (ir_mode *mode)
 {
   return mode->ld_align;
 }
 
 /*
 inline void
-set_ld_align_of_mode (ir_mode *mode, int ld_align)
+set_mode_ld_align (ir_mode *mode, int ld_align)
 {
   mode->ld_align = ld_align;
 }
 */
 
 tarval *
-get_min_of_mode (ir_mode *mode)
+get_mode_min (ir_mode *mode)
 {
   return mode->min;
 }
 
 /*
 inline void
-set_min_of_mode (ir_mode *mode, struct tarval *min)
+set_mode_min (ir_mode *mode, tarval *min)
 {
 mode->min = min;
 }
 */
 
 tarval *
-get_max_of_mode (ir_mode *mode)
+get_mode_max (ir_mode *mode)
 {
   return mode->max;
 }
 
 /*
 inline void
-set_max_of_mode (ir_mode *mode, struct tarval *max)
+set_mode_max (ir_mode *mode, tarval *max)
 {
   mode->max = max;
 }
 */
 
 tarval *
-get_null_of_mode (ir_mode *mode)
+get_mode_null (ir_mode *mode)
 {
   return mode->null;
 }
 
 /*
 inline void
-set_null_of_mode (ir_mode *mode, struct tarval *null)
+set_mode_null (ir_mode *mode, tarval *null)
 {
   mode->null = null;
 }
 */
 
 unsigned
-get_fsigned_of_mode (ir_mode *mode)
+get_mode_fsigned (ir_mode *mode)
 {
   return mode->fsigned;
 }
 
 /*
 inline voida
-set_fsigned_of_mode (ir_mode *mode, unsigned fsigned)
+set_mode_fsigned (ir_mode *mode, unsigned fsigned)
 {
   mode->fsigned = fsigned;
 }
 */
 
 unsigned
-get_ffloat_of_mode (ir_mode *mode)
+get_mode_ffloat (ir_mode *mode)
 {
   return mode->ffloat;
 }
 
 /*
 inline void
-set_ffloat_of_mode (ir_mode *mode, unsigned ffloat)
+set_mode_ffloat (ir_mode *mode, unsigned ffloat)
 {
   mode->ffloat = ffloat;
 }
@@ -391,7 +398,7 @@ mode_is_signed (ir_mode *mode)
 {
    int res;
    unsigned fsigned;
-   fsigned = get_fsigned_of_mode (mode);
+   fsigned = get_mode_fsigned (mode);
    if (fsigned == 1) {
      res = 1;
     }
@@ -406,7 +413,7 @@ mode_is_float (ir_mode *mode)
 {
    int res;
    unsigned ffloat;
-   ffloat = get_ffloat_of_mode (mode);
+   ffloat = get_mode_ffloat (mode);
    if (ffloat == 1) {
       res = 1;
     }
@@ -422,7 +429,7 @@ mode_is_int (ir_mode *mode)
 {
    int res;
    modecode code;
-   code = get_modecode_of_mode (mode);
+   code = get_mode_modecode (mode);
    if ((code >= irm_c) &&  (code <= irm_L)) {
       res = 1;
     }
@@ -451,7 +458,7 @@ mode_is_data (ir_mode *mode)
 {
   int res;
   modecode code;
-  code = get_modecode_of_mode (mode);
+  code = get_mode_modecode (mode);
   if (mode_is_num (mode) || code == irm_p) {
     res = 1;
   }
@@ -466,7 +473,7 @@ mode_is_datab (ir_mode *mode)
 {
   int res;
   modecode code;
-  code = get_modecode_of_mode (mode);
+  code = get_mode_modecode (mode);
   if (mode_is_data (mode) || code == irm_b || code == irm_B) {
     res = 1;
   }
@@ -481,7 +488,7 @@ mode_is_dataM (ir_mode *mode)
 {
   int res;
   modecode code;
-  code = get_modecode_of_mode (mode);
+  code = get_mode_modecode (mode);
   if (mode_is_data (mode) || code == irm_M) {
     res = 1;
   }
index d6d492c..09a1eca 100644 (file)
@@ -23,6 +23,11 @@ of the tarval module.
 
 # define NUM_MODES 20
 
+#ifndef _TARVAL_TYPEDEF_
+#define _TARVAL_TYPEDEF_
+typedef struct tarval tarval;
+#endif
+
 typedef enum { /* irm is short for `ir mode' */
   irm_T,                        /* former irm_N */
   irm_f, irm_d,
@@ -45,17 +50,7 @@ typedef enum { /* irm is short for `ir mode' */
   irm_max */
 } modecode;
 
-typedef struct {
-  modecode code;
-  ident *name;            /* Name of this mode */
-  int    size;            /* size of the mode in Bytes. */
-  int    ld_align;        /* ld means log2 */
-  struct tarval *min;     /* largest value to be represented by this mode */
-  struct tarval *max;     /* smallest value to be represented by this mode */
-  struct tarval *null;    /* Representation of zero in this mode */
-  unsigned fsigned:1;     /* signedness of this mode */
-  unsigned ffloat:1;      /* true if this is a float */
-} ir_mode;
+typedef struct ir_mode ir_mode;
 
 extern ir_mode *mode_T; /* tuple (none) */
 extern ir_mode *mode_f; /* signed float */
@@ -81,29 +76,48 @@ extern ir_mode *mode_R; /* block */
 extern ir_mode *mode_Z; /* infinit integers */ /* oblivious */
 extern ir_mode *mode_T; /* tuple (none) */
 
-void init_mode (void);
-
-modecode get_modecode_of_mode (ir_mode *mode);
-/* void set_modecode_of_mode (ir_mode *mode, modecode code); */
-ident *get_ident_of_mode (ir_mode *mode);
-ident *get_mode_ident (ir_mode *mode);
-
-/* void set_ident_of_mode (ir_mode *mode, ident *name); */
-int get_size_of_mode (ir_mode *mode);
-/* void set_size_of_mode (ir_mode *mode, int size); */
-int get_ld_align_of_mode (ir_mode *mode);
-/* void set_ld_align_of_mode (ir_mode *mode, int ld_align); */
-struct tarval *get_min_of_mode (ir_mode *mode);
-/* void set_min_of_mode (ir_mode *mode, struct tarval *min); */
-struct tarval *get_max_of_mode (ir_mode *mode);
-/* void set_max_of_mode (ir_mode *mode, struct tarval *max); */
-struct tarval *get_null_of_mode (ir_mode *mode);
-/* void set_null_of_mode (ir_mode *mode, struct tarval *null); */
-unsigned get_fsigned_of_mode (ir_mode *mode);
-/* void set_fsigned_of_mode (ir_mode *mode, unsigned fsigned); */
-unsigned get_ffloat_of_mode (ir_mode *mode);
-/* void set_ffloat_of_mode (ir_mode *mode, unsigned ffloat); */
+/* An enum for this mode */
+modecode get_mode_modecode (ir_mode *mode);
+/* void  set_mode_modecode (ir_mode *mode, modecode code);  */
+
+/* The ident of this mode */
+ident   *get_mode_ident    (ir_mode *mode);
+/* void  set_mode_ident    (ir_mode *mode, ident *id);    */
+
+/* The name of this mode */
+const char *get_mode_name  (ir_mode *mode);
+/* void  set_mode_name     (ir_mode *mode, char *name);    */
+
+/* The size of values of the mode in bytes. */
+int      get_mode_size     (ir_mode *mode);
+/* void  set_mode_size     (ir_mode *mode, int size);       */
+
+/* The alignment of values of the mode. */
+int      get_mode_ld_align (ir_mode *mode);
+/* void  set_mode_ld_align (ir_mode *mode, int ld_align); */
+
+/* The smallest representable value */
+tarval  *get_mode_min      (ir_mode *mode);
+/* void  set_mode_min      (ir_mode *mode, tarval *min); */
+
+/* The biggest representable value */
+tarval  *get_mode_max      (ir_mode *mode);
+/* void  set_mode_max      (ir_mode *mode, tarval *max); */
+
+/* The value Zero represented in this mode */
+tarval  *get_mode_null     (ir_mode *mode);
+/* void  set_mode_null     (ir_mode *mode, tarval *null); */
+
+/* Returns 1 if mode is signed, else 0. */
+unsigned get_mode_fsigned  (ir_mode *mode);
+/* void  set_mode_fsigned  (ir_mode *mode, unsigned fsigned); */
+
+/* Returns 1 if mode is float, else 0. */
+unsigned get_mode_ffloat   (ir_mode *mode);
+/* void  set_mode_ffloat   (ir_mode *mode, unsigned ffloat); */
+
 
+/* Test for a certain class of modes. */
 int mode_is_signed (ir_mode *mode);
 int mode_is_float (ir_mode *mode);
 int mode_is_int (ir_mode *mode);
diff --git a/ir/ir/irmode_t.h b/ir/ir/irmode_t.h
new file mode 100644 (file)
index 0000000..a019e75
--- /dev/null
@@ -0,0 +1,22 @@
+
+# ifndef _IRMODE_T_H_
+# define _IRMODE_T_H_
+
+# include "irmode.h"
+
+struct ir_mode {
+  modecode code;
+  ident *name;            /* Name of this mode */
+  int    size;            /* size of the mode in Bytes. */
+  int    ld_align;        /* ld means log2 */
+  tarval *min;            /* largest value to be represented by this mode */
+  tarval *max;            /* smallest value to be represented by this mode */
+  tarval *null;           /* Representation of zero in this mode */
+  unsigned fsigned:1;     /* signedness of this mode */
+  unsigned ffloat:1;      /* true if this is a float */
+};
+
+
+void init_mode (void);
+
+#endif
index 0aec48f..a9fccc2 100644 (file)
@@ -8,6 +8,7 @@
 #include "irnode_t.h"
 #include "irgraph_t.h"
 #include "ident_t.h"
+#include "irmode_t.h"
 #include "array.h"
 
 #ifdef DEBUG_libfirm
@@ -219,7 +220,7 @@ get_irn_modecode (ir_node *node)
 
 
 inline ident *
-get_irn_modename (ir_node *node)
+get_irn_modeident (ir_node *node)
 {
   assert(node);
   return node->mode->name;
index 328d419..353de84 100644 (file)
@@ -58,7 +58,7 @@ inline ir_mode      *get_irn_mode          (ir_node *node);
 /* Get the mode-enum modecode */
 inline modecode      get_irn_modecode      (ir_node *node);
 /* Get the ident for a string representation of the mode */
-inline ident        *get_irn_modename      (ir_node *node);
+inline ident        *get_irn_modeident     (ir_node *node);
 /* Access the opcode struct of the node */
 inline ir_op        *get_irn_op            (ir_node *node);
 inline void          set_irn_op            (ir_node *node, ir_op *op);
index 033f0fa..da6f27d 100644 (file)
@@ -127,16 +127,20 @@ init_op(void)
   op_Bad   = new_ir_op (iro_Bad,   id_from_str ("Bad", 3), 0, 0);
 }
 
-/* returns the attribute size of the operator. */
+/* Returns the string for the opcode. */
+const char  *get_op_name      (ir_op *op) {
+  return id_to_str(op->name);
+}
 
 opcode get_op_code (ir_op *op){
   return op->code;
 }
 
-ident *get_op_name(ir_op *op){
+ident *get_op_ident(ir_op *op){
   return op->name;
 }
 
+/* returns the attribute size of the operator. */
 int get_op_attr_size (ir_op *op) {
   return op->attr_size;
 }
index 9dc564e..6ad92f6 100644 (file)
@@ -82,10 +82,16 @@ extern ir_op *op_Bad;
 
 
 /* Returns the string for the opcode. */
+const char *get_op_name      (ir_op *op);
 
-opcode get_op_code (ir_op *op);
-ident *get_op_name(ir_op *op);
-int get_op_attr_size (ir_op *op);
+/* Returns the enum for the opcode */
+opcode get_op_code      (ir_op *op);
 
+/* Returns the ident for the opcode name */
+ident *get_op_ident     (ir_op *op);
+
+/* Returns the attribute size of the opcode.
+   Use not encouraged, internal feature. */
+int    get_op_attr_size (ir_op *op);
 
 # endif /* _IROP_H_ */
index b4d8e8f..742e6a8 100644 (file)
@@ -14,7 +14,7 @@
 # include "irvrfy.h"
 # include "tv.h"
 # include "tune.h"
-
+# include "debinfo.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
@@ -993,7 +993,9 @@ optimize_in_place (ir_node *n)
       tv = computed_value (n);
       if (tv != NULL) {
         /* evaluation was succesful -- replace the node. */
-       return new_Const (get_tv_mode (tv), tv);
+       n = new_Const (get_tv_mode (tv), tv);
+       deb_info_copy(n, old_n, id_from_str("const_eval", 10));
+       return n;
         /* xprintf("* optimize: computed node %I\n", n->op->name);*/
       }
     }
index ab56985..f7355f2 100644 (file)
@@ -6,7 +6,7 @@
 ** irprog.c: ir representation of a program
 */
 
-# include "irprog.h"
+# include "irprog_t.h"
 # include "array.h"
 # include "obst.h"
 
index 70eb657..ea3fc01 100644 (file)
 # include "irnode.h"
 # include "type.h"
 
-struct ir_prog {
-  firm_kind kind;
-  ir_graph *main_irg;              /* entry point to the compiled program */
-                  /* or a list, in case we compile a library or the like? */
-  ir_graph **graphs;               /* all graphs in the ir */
-  type_class *glob_type;           /* global type.  Class as it can have
-                                     fields and procedures.  Does this work?
-                                     Better name??? @@@ */
-  type **types;                    /* all types in the ir */
-  /*struct obstack *obst;          * @@@ Should we place all types and
-                                      entities on an obstack, too? */
-#ifdef DEBUG_libfirm
-  long max_node_nr;                /* to generate unique numbers for nodes. */
-#endif
-};
 
 typedef struct ir_prog ir_prog;
 
diff --git a/ir/ir/irprog_t.h b/ir/ir/irprog_t.h
new file mode 100644 (file)
index 0000000..d34b2b5
--- /dev/null
@@ -0,0 +1,23 @@
+
+# ifndef _IRPROG_T_H_
+# define _IRPROG_T_H_
+
+#include "irprog.h"
+
+struct ir_prog {
+  firm_kind kind;
+  ir_graph *main_irg;              /* entry point to the compiled program */
+                  /* or a list, in case we compile a library or the like? */
+  ir_graph **graphs;               /* all graphs in the ir */
+  type_class *glob_type;           /* global type.  Class as it can have
+                                     fields and procedures.  Does this work?
+                                     Better name??? @@@ */
+  type **types;                    /* all types in the ir */
+  /*struct obstack *obst;          * @@@ Should we place all types and
+                                      entities on an obstack, too? */
+#ifdef DEBUG_libfirm
+  long max_node_nr;                /* to generate unique numbers for nodes. */
+#endif
+};
+
+#endif /* ifndef _IRPROG_T_H_ */
diff --git a/ir/ir/old_fctnames.h b/ir/ir/old_fctnames.h
new file mode 100644 (file)
index 0000000..a7b61b4
--- /dev/null
@@ -0,0 +1,29 @@
+
+/* Copyright (C) 2001 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Goetz Lindenmaier
+**
+** Some makros supporting old function names.
+*/
+
+
+/* irgraph */
+#define get_irg_params     get_irg_n_loc
+#define set_irg_params     set_irg_n_loc
+
+
+/* irmode.h */
+#define get_ident_of_mode     get_mode_ident
+#define get_size_of_mode      get_mode_size
+#define get_ld_align_of_mode  get_mode_ld_align
+#define get_min_of_mode              get_mode_min
+#define get_max_of_mode              get_mode_max
+#define get_null_of_mode      get_mode_null
+#define get_fsigned_of_mode   get_mode_fsigned
+#define get_ffloat_of_mode    get_mode_ffloat
+
+
+
+#define
+#define
index cc762e0..4618bd8 100644 (file)
@@ -63,6 +63,7 @@ clean:
        rm -f $(OFILES) $(DFILES)
 
 realclean:     clean
-       rm -f $(TARGET) *.flc TAGS
+       rm -f $(TARGET) *.flc TAGS \#*
+       rm -rf auto/
 
 -include $(DFILES)
index c1f1b33..38a507e 100644 (file)
 
 void init_mangle (void);
 
+/* Computes a definite name for this entity by concatenating
+   the name of the owner type and the name of the entity with
+   a separating "_". f*/
 ident *mangle_entity (entity *ent);
-ident *mangle_type (type *type);
+
+/* Sorry, I'm not sure what this does... */
+ident *mangle_type   (type *type);
index 96566e5..2173e5a 100644 (file)
@@ -12,7 +12,7 @@
 # define _TYPE_OR_ENTITY_H_
 
 typedef union {
-  type *typ;
+  type   *typ;
   entity *ent;
 } type_or_ent;
 
index 7cd59dd..68e0c4b 100644 (file)
@@ -62,6 +62,7 @@ clean:
        rm -f $(OFILES) $(DFILES)
 
 realclean:     clean
-       rm -f $(TARGET) *.flc TAGS
+       rm -f $(TARGET) *.flc TAGS \#*
+       rm -rf auto/
 
 -include $(DFILES)
index 8c95696..a4c40f6 100644 (file)
@@ -43,8 +43,8 @@
 #include "tune.h"
 #include "ident_t.h"
 #include "tv_t.h"
-
-# include "entity_t.h"
+#include "entity_t.h"
+#include "irmode.h"
 
 static struct obstack tv_obst; /* obstack for all the target values */
 static pset *tarvals;          /* pset containing pointers to _all_ tarvals */
@@ -138,9 +138,10 @@ tv_val_s (tarval *tv)
 static inline bool
 chil_overflow (tarval_chil chil, ir_mode *mode)
 {
-  assert (is_chilCHIL(mode->code));
-  return (mode->min && mode->max  /* only valid after firm initialization */
-         && (chil < tv_val_chil (mode->min) || tv_val_chil (mode->max) < chil));
+  assert (is_chilCHIL(get_mode_modecode(mode)));
+  return (get_mode_min(mode) && get_mode_max(mode)  /* only valid after firm initialization */
+         && (chil < tv_val_chil (get_mode_min(mode))
+             || tv_val_chil (get_mode_max(mode)) < chil));
 }
 
 
@@ -148,9 +149,9 @@ chil_overflow (tarval_chil chil, ir_mode *mode)
 static inline bool
 CHIL_overflow (tarval_CHIL CHIL, ir_mode *mode)
 {
-  assert (is_chilCHIL(mode->code));
-  return (mode->max   /* only valid after firm initialization */
-         && tv_val_CHIL (mode->max) < CHIL);
+  assert (is_chilCHIL(get_mode_modecode(mode)));
+  return (get_mode_max(mode)   /* only valid after firm initialization */
+         && tv_val_CHIL (get_mode_max(mode)) < CHIL);
 }
 
 
@@ -159,7 +160,7 @@ void
 _tarval_vrfy (const tarval *val)
 {
   assert (val);
-  switch (val->mode->code) {
+  switch (get_mode_modecode(val->mode)) {
     /* floating */
   case irm_f:
   case irm_d:
@@ -232,9 +233,10 @@ tarval_cmp (const void *p, const void *q)
   TARVAL_VRFY (b);
 
   if (a == b) return 0;
-  if (a->mode - b->mode) return a->mode - b->mode;
+  if ((void *)a->mode - (void *)b->mode)
+    return (void *)a->mode - (void *)b->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f:
     return memcmp (&a->u.f, &b->u.f, sizeof (a->u.f));
@@ -281,8 +283,8 @@ tarval_hash (tarval *tv)
 {
   unsigned h;
 
-  h = tv->mode->code * 0x421u;
-  switch (tv->mode->code) {
+  h = get_mode_modecode(tv->mode) * 0x421u;
+  switch (get_mode_modecode(tv->mode)) {
   case irm_T:
     h = 0x94b527ce; break;
   case irm_f:
@@ -607,7 +609,7 @@ tarval_from_long (ir_mode *m, long val)
   tv = (tarval *)obstack_alloc (&tv_obst, sizeof (tarval));
 
   tv->mode = m;
-  switch (m->code) {
+  switch (get_mode_modecode(m)) {
     /* floating */
   case irm_f:
     tv->u.f = val; break;
@@ -728,7 +730,7 @@ tarval_finish_as (ir_mode *m)
   p = (unsigned char *)tv + sizeof (tarval);
   tv->mode = m;
 
-  switch (m->code) {
+  switch (get_mode_modecode(m)) {
   case irm_C:
     tv->u.CHIL = ch;
     break;
@@ -777,7 +779,7 @@ tarval_convert_to (tarval *src, ir_mode *m)
   tv = (tarval *)obstack_alloc (&tv_obst, sizeof (tarval));
   tv->mode = m;
 
-  switch (src->mode->code) {
+  switch (get_mode_modecode(src->mode)) {
 
   case irm_d:
     if (m != mode_f) goto fail;
@@ -785,7 +787,7 @@ tarval_convert_to (tarval *src, ir_mode *m)
     break;
 
   case irm_Z:
-    switch (m->code) {
+    switch (get_mode_modecode(m)) {
 
     case irm_C: case irm_H: case irm_I: case irm_L:
       if (mpz_cmp_si (&src->u.Z, 0) < 0) goto fail;
@@ -813,7 +815,7 @@ tarval_convert_to (tarval *src, ir_mode *m)
     break;
 
   case irm_c: case irm_h: case irm_i: case irm_l:
-    switch (m->code) {
+    switch (get_mode_modecode(m)) {
     case irm_c: case irm_h: case irm_i: case irm_l:
       tv->u.chil = src->u.chil;
       if (chil_overflow (tv->u.chil, m)) goto fail;
@@ -836,7 +838,7 @@ tarval_convert_to (tarval *src, ir_mode *m)
     }
 
   case irm_C: case irm_H: case irm_I: case irm_L:
-    switch (m->code) {
+    switch (get_mode_modecode(m)) {
     case irm_c: case irm_h: case irm_i: case irm_l:
       tv->u.chil = src->u.CHIL;
       if (chil_overflow (tv->u.chil, m)) goto fail;
@@ -860,7 +862,7 @@ tarval_convert_to (tarval *src, ir_mode *m)
     break;
 
   case irm_b:
-    switch (m->code) {
+    switch (get_mode_modecode(m)) {
     case irm_c: case irm_h: case irm_i: case irm_l:
       tv->u.chil = src->u.b;
       break;
@@ -893,13 +895,13 @@ tarval_neg (tarval *a)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = -a->u.f; break;
   case irm_d: tv->u.d = -a->u.d; break;
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
-    tv->u.CHIL = -a->u.CHIL & tv_val_CHIL (a->mode->max);
+    tv->u.CHIL = -a->u.CHIL & tv_val_CHIL (get_mode_max(a->mode));
     break;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
@@ -935,7 +937,7 @@ tarval_comp (tarval *a, tarval *b)
 
   assert (a->mode == b->mode);
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: return (  a->u.f == b->u.f ? irpn_Eq
                      : a->u.f > b->u.f ? irpn_Gt
@@ -989,13 +991,13 @@ tarval_add (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = a->u.f + b->u.f; break;        /* @@@ overflow etc */
   case irm_d: tv->u.d = a->u.d + b->u.d; break; /* @@@ dto. */
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
-    tv->u.CHIL = (a->u.CHIL + b->u.CHIL) & tv_val_CHIL (a->mode->max);
+    tv->u.CHIL = (a->u.CHIL + b->u.CHIL) & tv_val_CHIL (get_mode_max(a->mode));
     break;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
@@ -1032,13 +1034,13 @@ tarval_sub (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = a->u.f - b->u.f; break;        /* @@@ overflow etc */
   case irm_d: tv->u.d = a->u.d - b->u.d; break; /* @@@ dto. */
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
-    tv->u.CHIL = (a->u.CHIL - b->u.CHIL) & tv_val_CHIL (a->mode->max);
+    tv->u.CHIL = (a->u.CHIL - b->u.CHIL) & tv_val_CHIL (get_mode_max(a->mode));
     break;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
@@ -1075,13 +1077,13 @@ tarval_mul (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = a->u.f * b->u.f; break;        /* @@@ overflow etc */
   case irm_d: tv->u.d = a->u.d * b->u.d; break; /* @@@ dto. */
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
-    tv->u.CHIL = (a->u.CHIL * b->u.CHIL) & tv_val_CHIL (a->mode->max);
+    tv->u.CHIL = (a->u.CHIL * b->u.CHIL) & tv_val_CHIL (get_mode_max(a->mode));
     break;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
@@ -1115,7 +1117,7 @@ tarval_quo (tarval *a, tarval *b)
   TARVAL_VRFY (a); TARVAL_VRFY (b);
   assert (a->mode == b->mode);
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f:
     tv = (tarval *)obstack_alloc (&tv_obst, sizeof (tarval));
@@ -1150,7 +1152,7 @@ tarval_div (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = floor (a->u.f / b->u.f); break; /* @@@ overflow etc */
   case irm_d: tv->u.d = floor (a->u.d / b->u.d); break; /* @@@ dto. */
@@ -1162,7 +1164,7 @@ tarval_div (tarval *a, tarval *b)
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
     if (   !b->u.chil
-       || ((b->u.chil == -1) && (a->u.chil == tv_val_chil (a->mode->max) ))) {
+       || ((b->u.chil == -1) && (a->u.chil == tv_val_chil (get_mode_max(a->mode)) ))) {
     fail:
       obstack_free (&tv_obst, tv);
       return NULL;
@@ -1196,7 +1198,7 @@ tarval_mod (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* floating */
   case irm_f: tv->u.f = fmod (a->u.f, b->u.f); break; /* @@@ overflow etc */
   case irm_d: tv->u.d = fmod (a->u.d, b->u.d); break; /* @@@ dto */
@@ -1241,7 +1243,7 @@ tarval_and (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
     tv->u.CHIL = a->u.CHIL & b->u.CHIL; break;
@@ -1274,7 +1276,7 @@ tarval_or (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
     tv->u.CHIL = a->u.CHIL | b->u.CHIL; break;
@@ -1311,7 +1313,7 @@ tarval_eor (tarval *a, tarval *b)
 
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
     tv->u.CHIL = a->u.CHIL ^ b->u.CHIL; break;
@@ -1346,14 +1348,14 @@ tarval_shl (tarval *a, tarval *b)
   shift = tarval_ord (b, &b_is_huge);
   if (   b_is_huge
       || (shift < 0)
-      || ((shift >= mode_l->size*target_bits) && (a->mode != mode_Z))) {
+      || ((shift >= get_mode_size(mode_l)*target_bits) && (a->mode != mode_Z))) {
     return NULL;
   }
 
   tv = (tarval *)obstack_alloc (&tv_obst, sizeof (tarval));
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
     tv->u.CHIL = a->u.CHIL << shift;
@@ -1386,14 +1388,14 @@ tarval_shr (tarval *a, tarval *b)
   shift = tarval_ord (b, &b_is_huge);
   if (   b_is_huge
       || (shift < 0)
-      || ((shift >= mode_l->size*target_bits) && (a->mode != mode_Z))) {
+      || ((shift >= get_mode_size(mode_l)*target_bits) && (a->mode != mode_Z))) {
     return NULL;
   }
 
   tv = (tarval *)obstack_alloc (&tv_obst, sizeof (tarval));
   tv->mode = a->mode;
 
-  switch (a->mode->code) {
+  switch (get_mode_modecode(a->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
     tv->u.CHIL = a->u.CHIL >> shift;
@@ -1424,19 +1426,19 @@ tarval_classify (tarval *tv)
 
   TARVAL_VRFY (tv);
 
-  switch (tv->mode->code) {
+  switch (get_mode_modecode(tv->mode)) {
     /* floating */
   case irm_f: case irm_d:
     return 2;
     /* unsigned */
   case irm_C:
-    return (long)((tv->u.CHIL+1) & tv_val_CHIL (mode_C->max)) - 1;
+    return (long)((tv->u.CHIL+1) & tv_val_CHIL (get_mode_max(mode_C))) - 1;
   case irm_H:
-    return (long)((tv->u.CHIL+1) & tv_val_CHIL (mode_H->max)) - 1;
+    return (long)((tv->u.CHIL+1) & tv_val_CHIL (get_mode_max(mode_H))) - 1;
   case irm_I:
-    return (long)((tv->u.CHIL+1) & tv_val_CHIL (mode_I->max)) - 1;
+    return (long)((tv->u.CHIL+1) & tv_val_CHIL (get_mode_max(mode_I))) - 1;
   case irm_L:
-    return (long)((tv->u.CHIL+1) & tv_val_CHIL (mode_L->max)) - 1;
+    return (long)((tv->u.CHIL+1) & tv_val_CHIL (get_mode_max(mode_L))) - 1;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
     return tv->u.chil;
@@ -1475,18 +1477,18 @@ tarval_ord (tarval *tv, int *fail)
 {
   TARVAL_VRFY (tv);
 
-  switch (tv->mode->code) {
+  switch (get_mode_modecode(tv->mode)) {
     /* unsigned */
   case irm_C: case irm_H: case irm_I: case irm_L:
-    *fail = tv->u.CHIL > tv_val_CHIL (mode_l->max);
+    *fail = tv->u.CHIL > tv_val_CHIL (get_mode_max(mode_l));
     return tv->u.CHIL;
     /* signed */
   case irm_c: case irm_h: case irm_i: case irm_l:
     *fail = 0;
     return tv->u.chil;
   case irm_Z:
-    *fail = (   (mpz_cmp_si (&tv->u.Z, tv_val_chil(mode_l->max)) > 0)
-            || (mpz_cmp_si (&tv->u.Z, tv_val_chil(mode_l->min)) < 0));
+    *fail = (   (mpz_cmp_si (&tv->u.Z, tv_val_chil(get_mode_max(mode_l))) > 0)
+            || (mpz_cmp_si (&tv->u.Z, tv_val_chil(get_mode_max(mode_l))) < 0));
     return mpz_get_si (&tv->u.Z);
     /* strange */
   case irm_b:
@@ -1508,7 +1510,7 @@ tarval_print (XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
 
   TARVAL_VRFY (val);
 
-  switch (val->mode->code) {
+  switch (get_mode_modecode(val->mode)) {
 
   case irm_T:                  /* none */
     printed = XPSR ("<bad>");
index 6f18186..0ae4c03 100644 (file)
@@ -8,7 +8,10 @@
 # include "entity.h"
 # include "bool.h"
 
+#ifndef _TARVAL_TYPEDEF_
+#define _TARVAL_TYPEDEF_
 typedef struct tarval tarval;
+#endif
 
 /* #include <gmp.h> Eli can't find gmp.h if it's available in a local
    search path but not in a standard one known to gcc. */
@@ -17,9 +20,9 @@ typedef struct tarval tarval;
 /* #include "deftab.h" */
 
 /* how to represent target types on host */
-typedef float tarval_f;
+typedef float  tarval_f;
 typedef double tarval_d;
-typedef long tarval_chil;
+typedef long   tarval_chil;
 typedef unsigned long tarval_CHIL;
 typedef MP_INT tarval_Z;
 typedef struct {
@@ -145,7 +148,7 @@ tarval_chil tv_val_chil (tarval *tv);
 tarval_CHIL tv_val_CHIL (tarval *tv);
 tarval_Z tv_val_Z (tarval *tv);
 tarval_p tv_val_p (tarval *tv);
-bool tv_val_b (tarval *tv);
+bool     tv_val_b (tarval *tv);
 tarval_B tv_val_B (tarval *tv);
 tarval_s tv_val_s (tarval *tv);
 
index 5ef9df0..7c94721 100644 (file)
@@ -30,6 +30,8 @@ clean:
        *.o *.vcg core
 
 realclean:     clean
+       rm -f \#* *.flc
+       rm -rf auto/
 
 run:
        ./empty;                \
index a635b32..4698219 100644 (file)
@@ -104,7 +104,7 @@ main(void)
   if (! (elt_type->kind == k_type_primitive)) printf(" do something else\n");
   elt_type_mode = get_primitive_mode(elt_type);
   /*   better: read bounds out of array type information */
-  size = (U_BOUND - L_BOUND + 1) * elt_type_mode->size;
+  size = (U_BOUND - L_BOUND + 1) * get_mode_size(elt_type_mode);
   /*   make constant representing the size */
   arr_size  = new_Const(mode_I, tarval_from_long (mode_I, size));
   /*   allocate and generate the Proj nodes. */
index 21543c4..224f6ea 100644 (file)
@@ -122,6 +122,7 @@ int main(int argc, char **argv)
 
   printf("Optimizing ...\n");
   //dead_node_elimination(irg);
+  local_optimize_graph(irg);
 
   /* verify the graph */
   irg_vrfy(irg);