*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 4 Sep 2000 16:48:26 +0000 (16:48 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 4 Sep 2000 16:48:26 +0000 (16:48 +0000)
[r63]

62 files changed:
Changes
Makefile
ir/common/Makefile
ir/common/bool.h [new file with mode: 0644]
ir/common/common.h
ir/common/firm.c
ir/common/firm.h
ir/common/misc.h
ir/debug/Makefile
ir/ident/Makefile
ir/ident/ident.c
ir/ident/ident.h
ir/ident/ident_t.h [new file with mode: 0644]
ir/ir/Makefile
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irdump.c
ir/ir/irdump.h
ir/ir/irgmod.c
ir/ir/irgmod.h
ir/ir/irgopt.c
ir/ir/irgraph.c
ir/ir/irgraph.h
ir/ir/irgraph_t.h [new file with mode: 0644]
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h
ir/ir/irop.c
ir/ir/irop.h
ir/ir/iropt.c
ir/ir/iropt.h
ir/ir/iropt_t.h [new file with mode: 0644]
ir/ir/irprog.c
ir/ir/irprog.h
ir/ir/irvrfy.c
ir/tr/Makefile
ir/tr/entity_t.h
ir/tr/mangle.c
ir/tr/type.c
ir/tr/type.h
ir/tr/typewalk.c
ir/tv/Makefile
ir/tv/tv.c
ir/tv/tv.h
ir/tv/tv_t.h [new file with mode: 0644]
testprograms/Makefile
testprograms/array-heap_example.c
testprograms/array-stack_example.c
testprograms/call_str_example.c
testprograms/cond_example.c
testprograms/const_eval_example.c
testprograms/dead_block_example.c
testprograms/empty.c
testprograms/global_var_example.c
testprograms/if_else_example.c
testprograms/if_example.c
testprograms/if_while_example.c
testprograms/irr_cf_example.c
testprograms/irr_loop_example.c
testprograms/memory_example.c
testprograms/oo_program_example.c
testprograms/three_cfpred_example.c

diff --git a/Changes b/Changes
index 49fdbdf..91cc102 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+  15.8.2000 Goetz until 3.9.00
+  Separated irnode.h and many others into two files: one public
+  one private.
+  Added funcionality to extract headers for lib.
+
   23.8.2000 Goetz
   type_dump also dumps irg->ent
   if_example: corrected nr of locals
index 1305047..bc90195 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ all:  TAGS ir testprograms
 testprograms:
        $(MAKE) -C testprograms
 
-lib:
+lib:   ir
        $(MAKE) -C ir lib
 
 clean:
@@ -32,7 +32,7 @@ clean:
 
 realclean:
        for i in $(SUBDIRS); do  $(MAKE) -C $$i realclean; done
-       rm -f libfirm.a core include/*
+       rm -f libfirm.a core include/*.h
 
 TAGFILES = $(shell find . -name '*.c' -o -name '*.h')
 
index 980509e..5e13f8b 100644 (file)
@@ -29,12 +29,13 @@ CFILES = $(MEMBERS:.m=.c)
 CFILES +=  xfprintf.c xfprintf.c xfprintf.c
 
 HFILES = $(MEMBERS:.m=.h)
-HFILES +=  tune.h xp_help.h xprintf.h misc.h
+HFILES +=  tune.h xp_help.h xprintf.h misc.h bool.h
 HFILES +=  common.h debug.h entity.h gmp.h host.h ident.h irgraph.h \
           irmode.h irnode.h irop.h irprog.h label.h misc.h obst.h \
            pset.h set.h tv.h type.h xprintf.h xp_help.h
 
 DISTRIB = $(DISTRIBMEMBERS:.m=.h)
+DISTRIB += bool.h
 
 OFILES = $(MEMBERS:%.m=../objects/%.o)
 OFILES +=  ../objects/xfprintf.o \
diff --git a/ir/common/bool.h b/ir/common/bool.h
new file mode 100644 (file)
index 0000000..6098226
--- /dev/null
@@ -0,0 +1,16 @@
+/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Goetz Lindenmaier.
+**
+** bool.h: Datatype bool.
+**
+*/
+
+# ifndef _BOOL_H_
+# define _BOOL_H_
+
+
+typedef unsigned char bool;
+
+# endif /* _BOOL_H_ */
index 0471ea1..24504a2 100644 (file)
@@ -10,6 +10,8 @@
 # ifndef _COMMON_H_
 # define _COMMON_H_
 
+// GL# include <assert.h>
+
 /** Global flags.  Set these by autoconf?? **/
 
 /* There are two implementations of the Phi node construction.  The first
index be5ae51..960c82c 100644 (file)
@@ -6,11 +6,12 @@
 */
 
 # include <stdio.h>
-# include "ident.h"
+# include "ident_t.h"
 # include "firm.h"
 # include "mangle.h"
 # include "xp_help.h"
 # include "irnode_t.h"
+# include "tv_t.h"
 
 void
 init_firm (void)
index 9cc5041..b14111d 100644 (file)
 # define _FIRM_H_
 
 /* The representations */
-# include "irprog.h"
-# include "type.h"
-# include "entity.h"
+# include "irprog.h"     /* control flow and data of a program */
+# include "type.h"       /* type representation */
+# include "entity.h"     /* entity representation */
+# include "tv.h"         /* target values */
+# include "ident.h"      /* source code identificators */
 /* Functionality */
-# include "ircons.h"
-# include "irgopt.h"
-
-/* */
-# include "xprintf.h"
-
+# include "ircons.h"     /* construct ir */
+# include "irgopt.h"     /* optimize ir */
 
 /* initialize firm */
 void init_firm (void);
index 67fce7d..ae32002 100644 (file)
@@ -2,9 +2,8 @@
    Copyright (C) 1995, 1996 Markus Armbruster
    All rights reserved. */
 
-#ifndef _MISC_H
-#define _MISC_H
-
+#ifndef _MISC_H_
+#define _MISC_H_
 
 /* Declare alloca() */
 
@@ -29,7 +28,7 @@ void *alloca ();
 
 
 #include "host.h"
-
+#include "bool.h"
 
 /* Alignment of nodes, cf common/tag.h, a power of two.
 
@@ -53,7 +52,6 @@ void *alloca ();
 
 #define IS_POW2(n) ((((n)-1) & (n)) == 0)
 
-typedef unsigned char bool;
 typedef int (*cmp_fun) (const void *, const void *);
 
 
@@ -80,4 +78,4 @@ extern const char *tmalloc_tag;
 # define XMALLOC_TRACE
 #endif
 
-#endif
+#endif /* _MISC_H_ */
index d868105..53cd83a 100644 (file)
@@ -55,7 +55,7 @@ TARGET = all
 $(TARGET):      $(DFILES) $(OFILES)
 
 lib:
-       cp $(DISTRIB) ../../include/
+#      cp $(DISTRIB) ../../include/
 
 clean:
        rm -f $(OFILES) $(DFILES)
index 052130d..712ebfb 100644 (file)
@@ -27,6 +27,7 @@ MEMBERS        = $(DISTRIBMEMBERS)
 CFILES = $(MEMBERS:.m=.c)
 
 HFILES = $(MEMBERS:.m=.h)
+HFILES += ident_t.h
 HFILES += array.h cookies.h debug.h host.h misc.h set.h tune.h xprintf.h \
          xp_help.h
 
@@ -43,6 +44,8 @@ TARGET = all
 .DEFAULT: $(TARGET)
 .SILENT: $(DFILES) clean  # hides output
 
+$(TARGET):      $(DFILES) $(OFILES)
+
 %.d:    %.c
        $(SHELL) -ec '$(CXX) $(DEPENDFLAGS) $(INCLUDES) $(X_INCLUDES) $< | sed '\''s/\($*\)\.o[ :]*/\.\.\/objects\/\1.o $@ : /g'\'' > $@'
 
@@ -53,8 +56,6 @@ TARGET = all
 lib:
        cp $(DISTRIB) ../../include
 
-$(TARGET):      $(DFILES) $(OFILES)
-
 clean:
        rm -f $(OFILES) $(DFILES)
 
index e01d0b7..55bcdc8 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 #include "array.h"
 #include "tune.h"
-#include "ident.h"
+#include "ident_t.h"
 #include "xprintf.h"
 
 #define XX_USER(name) ident *id_##name;
@@ -93,3 +93,20 @@ id_init (void)
 #undef XX_USER
 #undef XX_INTERNAL
 }
+
+
+#if 1
+inline ident *id_from_str (char *str, int len) {
+  assert (len > 0);
+  return  (const set_entry *)set_hinsert (id_set, (str), (len), ID_HASH ((str), (len)));
+}
+
+inline const char *id_to_str   (ident *id) {
+  return ((const char *)&(id)->dptr[0]);
+}
+
+inline int id_to_strlen(ident *id) {
+  return ((id)->size);
+}
+
+#endif
index fb8edda..63cbd8b 100644 (file)
 # ifndef _IDENT_H_
 # define _IDENT_H_
 
-#include <assert.h>
-#include <stddef.h>
-#include "misc.h"
-#include "debug.h"
-#include "set.h"
-
-# include "xprintf.h"
-# include "xp_help.h"
+# include "assert.h"
 
 /* Identifiers */
 typedef const struct set_entry ident;
 
-/* Caution: strings _not_ zero-terminated! */
-#define ID_FROM_STR(str, len) \
-  (assert ((len) > 0), \
-   (const set_entry *)set_hinsert (id_set, (str), (len), ID_HASH ((str), (len))))
-#define ID_TO_STR(id) ((const char *)&(id)->dptr[0])
-#define ID_TO_STRLEN(id) ((id)->size)
-#define ID_TO_HASH(id) ((long)(id) + (id)->hash)
-
-ident *new_id_derived (const char *pfx, ident *);
-ident *new_id_internal (void);
-bool id_is_internal (ident *);
-void id_init (void);
-
-#ifdef NDEBUG
-# define ID_VRFY(id) ((void)0)
-# 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
-# define id_stats() ((void)0)
-#endif
-
-/* Private */
-
-/* @@@ tune */
-#define ID_HASH(str, len) \
-  (((  ((unsigned char *)(str))[0] * 33 \
-     + ((unsigned char *)(str))[(len)>>1]) * 31 \
-    + ((unsigned char *)(str))[(len)-1]) * 9 \
-   + (len))
-
-extern set *id_set;
-
-
-# define id_from_str  ID_FROM_STR
-# define id_to_str    ID_TO_STR
-# define id_to_strlen ID_TO_STRLEN
-
-
-int ident_print (XP_PAR1, const xprintf_info *, XP_PARN);
+inline ident      *id_from_str (char *str, int len);
+inline const char *id_to_str   (ident *id);
+inline int         id_to_strlen(ident *id);
 
 # endif /* _IDENT_H_ */
diff --git a/ir/ident/ident_t.h b/ir/ident/ident_t.h
new file mode 100644 (file)
index 0000000..51e0e01
--- /dev/null
@@ -0,0 +1,73 @@
+/* Declarations for ident.
+   Copyright (C) 1995, 1996 Markus Armbruster */
+
+/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Martin Trapp, Christian Schaefer
+*/
+
+# ifndef _IDENT_T_H_
+# define _IDENT_T_H_
+
+#include <assert.h>
+#include <stddef.h>
+#include "misc.h"
+#include "debug.h"
+#include "set.h"
+#include "ident.h"
+
+# include "xprintf.h"
+# include "xp_help.h"
+
+/* Caution: strings _not_ zero-terminated! */
+#define ID_FROM_STR(str, len) \
+  (assert ((len) > 0), \
+   (const set_entry *)set_hinsert (id_set, (str), (len), ID_HASH ((str), (len))))
+#define ID_TO_STR(id) ((const char *)&(id)->dptr[0])
+#define ID_TO_STRLEN(id) ((id)->size)
+#define ID_TO_HASH(id) ((long)(id) + (id)->hash)
+
+ident *new_id_derived (const char *pfx, ident *);
+ident *new_id_internal (void);
+bool id_is_internal (ident *);
+void id_init (void);
+
+#ifdef NDEBUG
+# define ID_VRFY(id) ((void)0)
+# 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
+# define id_stats() ((void)0)
+#endif
+
+/* Private */
+
+/* @@@ tune */
+#define ID_HASH(str, len) \
+  (((  ((unsigned char *)(str))[0] * 33 \
+     + ((unsigned char *)(str))[(len)>>1]) * 31 \
+    + ((unsigned char *)(str))[(len)-1]) * 9 \
+   + (len))
+
+extern set *id_set;
+
+#if 0
+# define id_from_str  ID_FROM_STR
+# define id_to_str    ID_TO_STR
+# define id_to_strlen ID_TO_STRLEN
+#endif
+
+int ident_print (XP_PAR1, const xprintf_info *, XP_PARN);
+
+# endif /* _IDENT_T_H_ */
index 3714f4f..9636686 100644 (file)
@@ -22,13 +22,14 @@ X_INCLUDES  =
 SHELL       = /bin/sh
 MAKE        = /usr/bin/make
 
-DISTRIBMEMBERS  = ircons.m irdump.m irflag.m irgmod.m irgraph.m irgopt.m \
+DISTRIBMEMBERS = ircons.m irdump.m irflag.m irgmod.m irgraph.m irgopt.m \
            irgwalk.m irmode.m irnode.m irop.m iropt.m irprog.m irvrfy.m
 MEMBERS = $(DISTRIBMEMBERS)
 
 CFILES = $(MEMBERS:.m=.c)
 
 HFILES = $(MEMBERS:.m=.h)
+HFILES +=  irnode_t.h irgraph_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
index fa689ca..1843209 100644 (file)
@@ -9,6 +9,8 @@
 **   by Goetz Lindenmaier
 */
 
+# include "irgraph_t.h"
+# include "irnode_t.h"
 # include "ircons.h"
 # include "common.h"
 # include "irvrfy.h"
 # include "array.h"
 /* memset belongs to string.h */
 # include "string.h"
-# include "irnode_t.h"
 
 #if USE_EXPICIT_PHI_IN_STACK
 /* A stack needed for the automatic Phi node construction in constructor
-   Phi_in. */
+   Phi_in. Redefinition in irgraph.c!! */
 struct Phi_in_stack {
   ir_node **stack;
   int       pos;
 };
+typedef struct Phi_in_stack Phi_in_stack;
 #endif
 
 /*********************************************** */
 /** privat interfaces, for professional use only */
 
 /* Constructs a Block with a fixed number of predecessors.
-   Does not set current_block. */
-
+   Does not set current_block.  Can not be used with automatic
+   Phi node construction. */
 inline ir_node *
 new_r_Block (ir_graph *irg,  int arity, ir_node **in)
 {
@@ -42,6 +44,7 @@ new_r_Block (ir_graph *irg,  int arity, ir_node **in)
 
   res = new_ir_node (irg, NULL, op_Block, mode_R, arity, in);
   set_Block_matured(res, 1);
+  set_Block_block_visited(res, 0);
 
   irn_vrfy (res);
   return res;
@@ -602,30 +605,35 @@ new_End (void)
   return res;
 }
 
+#if 0
+/* Constructs a Block with a fixed number of predecessors.
+   Does set current_block.  Can be used with automatic Phi
+   node construction. */
 ir_node *
-new_Block (void)
+new_Block (int arity, ir_node **in)
 {
   ir_node *res;
 
-  res = new_ir_node (current_ir_graph, NULL, op_Block, mode_R, -1, NULL);
+  res = new_r_Block (arity, in);
   current_ir_graph->current_block = res;
-  res->attr.block.matured = 0;
-  set_Block_block_visited(res, 0);
 
-  /* forget this optimization. use this only if mature !!!!
-  res = optimize (res); */
-  irn_vrfy (res);
-
-  /** create a new dynamic array, which stores all parameters in irnodes */
-  /** using the same obstack as the whole irgraph */
+  /* 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);
-
-  /** initialize the parameter array */
   memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->params);
 
+  res = optimize (res);
+  irn_vrfy (res);
+
   return res;
 }
+#else
+ir_node *
+new_Block (void)
+{
+  return new_immBlock();
+}
+#endif
 
 /*************************************************************************/
 /* Methods necessary for automatic Phi node creation                     */
@@ -1502,7 +1510,31 @@ new_Bad (void)
 /*************************************************************************/
 /* Comfortable interface with automatic Phi node construction.           */
 /* (Uses also constructors of ?? interface, except new_Block.            */
-/* add an adge to a jmp node */
+/*************************************************************************/
+
+/** Block construction **/
+/* immature Block without predecessors */
+ir_node *new_immBlock (void) {
+  ir_node *res;
+
+  /* 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);
+  current_ir_graph->current_block = res;
+  res->attr.block.matured = 0;
+  set_Block_block_visited(res, 0);
+
+  /* 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);
+
+  /* Immature block may not be optimized! */
+  irn_vrfy (res);
+
+  return res;
+}
+
+/* add an adge to a jmp/control flow node */
 void
 add_in_edge (ir_node *block, ir_node *jmp)
 {
index 5c14644..75150fa 100644 (file)
 # include "entity.h"
 # include "tv.h"
 # include "type.h"
-# include "pdeq.h"
-
-#if USE_EXPICIT_PHI_IN_STACK
-/* A stack needed for the automatic Phi node construction in constructor
-   Phi_in. */
-typedef struct Phi_in_stack Phi_in_stack;
-#endif
 
 /***************************************************************************/
 /* The raw interface                                                       */
+/***************************************************************************/
 
+/* Constructs a Block with a fixed number of predecessors.
+   Does not set current_block.  Can not be used with automatic
+   Phi node construction. */
 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node **in);
 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
 ir_node *new_r_End    (ir_graph *irg, ir_node *block);
@@ -1179,6 +1176,7 @@ ir_node *new_r_Bad    ();
 
 /*************************************************************************/
 /* The block oriented interface                                          */
+/*************************************************************************/
 
 /* Sets the current block in which the following constructors place the
    nodes they construct. */
@@ -1189,6 +1187,9 @@ void switch_block (ir_node *target);
    and add a new one so dass das dann so aussieht:
    passe die Beispeilprogramme an! */
 #if 0
+/* Constructs a Block with a fixed number of predecessors.
+   Does set current_block.  Can be used with automatic Phi
+   node construction. */
 ir_node *new_Block(int arity, ir_node **in);     /* creates mature Block */
 #else
 ir_node *new_Block  (void);
@@ -1243,6 +1244,7 @@ ir_node *new_Bad    (void);
 /* Supports automatic Phi node construction.                           */
 /* All routines of the block oriented interface except new_Block are   */
 /* needed also.                                                        */
+/***********************************************************************/
 
 /** Block construction **/
 /* immature Block without predecessors */
@@ -1252,7 +1254,7 @@ ir_node *new_immBlock (void);
 void add_in_edge (ir_node *immblock, ir_node *jmp);
 
 /* fixes the number of predecessors of a block. */
-void     mature_block (ir_node *block);
+void mature_block (ir_node *block);
 
 /** Parameter administration **/
 /* Read a value from the array with the local variables.  Use this
@@ -1272,15 +1274,9 @@ ir_node *get_store (void);
 /* Write a store. */
 void set_store (ir_node *store);
 
-/* This function is for internal use only.  It is visible as it is needed
-   in irgraph.c to create the stack that is needed for automatic Phi
-   construction. */
-#if USE_EXPICIT_PHI_IN_STACK
-Phi_in_stack *new_Phi_in_stack();
-#endif
-
-/**************************************************************************/
-/* initialize ir construction                                             */
+/***********************************************************************/
+/* initialize ir construction                                          */
+/***********************************************************************/
 void init_cons (void);
 
 
index 9b216e5..1e0ee25 100644 (file)
@@ -6,9 +6,9 @@
 ** irdump.h: dumping of an intermediate representation graph
 */
 
-# include <assert.h>
-# include "irdump.h"
 # include "irnode_t.h"
+# include "irgraph_t.h"
+# include "irdump.h"
 # include "panic.h"
 # include <string.h>
 # include "entity.h"
index b54811f..4a89a6c 100644 (file)
@@ -32,6 +32,6 @@ void dump_cfg (ir_graph *irg);
 void dump_type_graph (ir_graph *irg);
 
 /* dumps a graph and the type inforamtion. */
-   void dump_ir_graph_w_types (ir_graph *irg);
+void dump_ir_graph_w_types (ir_graph *irg);
 
 # endif /* _IRDUMP_H_ */
index 3e00e6a..a4a381f 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 # include "irnode_t.h"
+# include "irgraph_t.h"
 # include "irgmod.h"
 # include "array.h"
 
index 7ec6d82..21c6546 100644 (file)
@@ -11,7 +11,6 @@
 
 # include "irnode.h"
 
-
 /* Turns a node into a "useless" Tuple.  The Tuple just forms a tuple
    from several inputs.  The tuples predecessors have to be
    set by hand.
index 95ffbcb..4f3e30f 100644 (file)
@@ -6,12 +6,15 @@
 ** Optimizations for a whole ir graph, i.e., a procedure.
 */
 
+# include <assert.h>
+
 # include "irgopt.h"
 # include "irnode_t.h"
+# include "irgraph_t.h"
 # include "iropt.h"
 # include "irgwalk.h"
-# include "irgraph.h"
 # include "ircons.h"
+# include "misc.h"
 
 /********************************************************************/
 /* apply optimizations of iropt to all nodes.                       */
index 1cae21a..a433ad0 100644 (file)
@@ -7,14 +7,20 @@
 */
 
 # include "ircons.h"
-# include "irgraph.h"
+# include "irgraph_t.h"
 # include "irprog.h"
-# include "iropt.h"
+# include "iropt_t.h"
 # include "array.h"
 # include "irgmod.h"
 
 ir_graph *current_ir_graph;
 
+#if USE_EXPICIT_PHI_IN_STACK
+/* really defined in ircons.c */
+typedef struct Phi_in_stack Phi_in_stack;
+Phi_in_stack *new_Phi_in_stack();
+#endif
+
 /* Allocates a list of nodes:
     - The start block containing a start node and Proj nodes for it's four
       results (X, M, P, Tuple).
index 9a0e415..bbd0cd4 100644 (file)
@@ -8,10 +8,7 @@
 
 # ifndef _IRGRAPH_H_
 # define _IRGRAPH_H_
-
-# include "obst.h"
 # include "tv.h"
-# include "pset.h"
 
 /* to resolve recursion between irnode.h and irgraph.h */
 #ifndef _IR_NODE_TYPEDEF_
 typedef struct ir_node ir_node;
 #endif
 
-/* ir_graph holds all information for a procedure */
-struct ir_graph {
-  struct entity  *ent;               /* The entity of this procedure, i.e.,
-                                       the type of the procedure and the
-                                       class it belongs to. */
-  struct ir_node *start_block;       /* block the start node will belong to */
-  struct ir_node *start;            /* start node of this ir_graph */
-  struct ir_node *end_block;         /* block the end node will belong to */
-  struct ir_node *end;              /* end node of this ir_graph */
-  struct ir_node *cstore;           /* constant store -- no more needed!! */
-  struct ir_node *frame;             /* method's frame */
-  struct ir_node *globals;           /* pointer to the data segment containing all
-                                       globals as well as global procedures. */
-  struct ir_node *args;              /* methods arguments */
-  struct ir_node *bad;              /* bad node of this ir_graph, the one and
-                                        only in this graph */
-  struct obstack *obst;                     /* obstack where all of the ir_nodes live */
-#if USE_EXPICIT_PHI_IN_STACK
-  struct Phi_in_stack *Phi_in_stack; /* needed for automatic Phi construction */
-#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. */
-  pset *value_table;                 /* value table for global value numbering
-                                       for optimizing use in iropt.c */
-  unsigned long visited;             /* this flag is an identifier for
-                                       ir walk. it will be incremented,
-                                       every time, someone walk through
-                                       the graph */
-  unsigned long block_visited;       /* same as visited, for a
-                                       complete block */
-};
-
 /* to resolve recursion between entity.h and irgraph.h */
 #ifndef _IR_GRAPH_TYPEDEF_
 #define _IR_GRAPH_TYPEDEF_
@@ -77,9 +39,6 @@ void     set_irg_start_block (ir_graph *irg, ir_node *node);
 ir_node *get_irg_start (ir_graph *irg);
 void     set_irg_start (ir_graph *irg, ir_node *node);
 
-ir_node *get_start_of_irgraph (ir_graph *irg);
-void     set_start_of_irgraph(ir_graph *irg, ir_node *node);
-
 ir_node *get_irg_end_block (ir_graph *irg);
 void     set_irg_end_block (ir_graph *irg, ir_node *node);
 
@@ -102,11 +61,6 @@ void     set_irg_args (ir_graph *irg, ir_node *node);
 ir_node *get_irg_bad (ir_graph *irg);
 void     set_irg_bad (ir_graph *irg, ir_node *node);
 
-/* not implemented yet
-struct obstack *get_obst_of_irgraph (ir_graph *irg);
-void set_obst_of_irgraph (ir_graph *irg, struct obstack *obst);
-*/
-
 ir_node *get_irg_current_block (ir_graph *irg);
 void     set_irg_current_block (ir_graph *irg, ir_node *node);
 
@@ -126,7 +80,4 @@ void     inc_irg_block_visited(ir_graph *irg);
 unsigned long get_irg_block_visited (ir_graph *irg);
 void     set_irg_block_visited(ir_graph *irg, unsigned long i);
 
-int      get_params_of_irgraph (ir_graph *irg);
-void     set_params_of_irgraph (ir_graph *irg, int params);
-
 # endif /* _IRGRAPH_H_ */
diff --git a/ir/ir/irgraph_t.h b/ir/ir/irgraph_t.h
new file mode 100644 (file)
index 0000000..4f14bcc
--- /dev/null
@@ -0,0 +1,49 @@
+/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Martin Trapp, Christian Schaefer
+**
+** irgraph.h: ir graph construction
+*/
+
+# ifndef _IRGRAPH_T_H_
+# define _IRGRAPH_T_H_
+# include "obst.h"
+# include "pset.h"
+# include "irgraph.h"
+
+/* ir_graph holds all information for a procedure */
+struct ir_graph {
+  struct entity  *ent;               /* The entity of this procedure, i.e.,
+                                       the type of the procedure and the
+                                       class it belongs to. */
+  struct ir_node *start_block;       /* block the start node will belong to */
+  struct ir_node *start;            /* start node of this ir_graph */
+  struct ir_node *end_block;         /* block the end node will belong to */
+  struct ir_node *end;              /* end node of this ir_graph */
+  struct ir_node *cstore;           /* constant store -- no more needed!! */
+  struct ir_node *frame;             /* method's frame */
+  struct ir_node *globals;           /* pointer to the data segment containing all
+                                       globals as well as global procedures. */
+  struct ir_node *args;              /* methods arguments */
+  struct ir_node *bad;              /* bad node of this ir_graph, the one and
+                                        only in this graph */
+  struct obstack *obst;                     /* obstack where all of the ir_nodes live */
+#if USE_EXPICIT_PHI_IN_STACK
+  struct Phi_in_stack *Phi_in_stack; /* needed for automatic Phi construction */
+#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. */
+  pset *value_table;                 /* value table for global value numbering
+                                       for optimizing use in iropt.c */
+  unsigned long visited;             /* this flag is an identifier for
+                                       ir walk. it will be incremented,
+                                       every time, someone walk through
+                                       the graph */
+  unsigned long block_visited;       /* same as visited, for a
+                                       complete block */
+};
+# endif /* _IRGRAPH_T_H_ */
index f1d3d68..ee4d773 100644 (file)
@@ -6,6 +6,8 @@
 */
 
 #include "irnode_t.h"
+#include "irgraph_t.h"
+#include "ident_t.h"
 #include "array.h"
 
 #ifdef DEBUG_libfirm
index 9a946b1..d0fb5b4 100644 (file)
@@ -396,9 +396,9 @@ int is_fragile_op(ir_node *node);
 
 #define DDMSG        printf("%s(l.%i)\n", __FUNCTION__, __LINE__)
 #define DDMSG1(X)    printf("%s(l.%i) %s\n", __FUNCTION__, __LINE__,         \
-                            ID_TO_STR(get_irn_opname(X)))
+                            id_to_str(get_irn_opname(X)))
 #define DDMSG2(X)    printf("%s(l.%i) %s: %ld\n", __FUNCTION__, __LINE__,     \
-                     ID_TO_STR(get_irn_opname(X)), get_irn_node_nr(X))
+                     id_to_str(get_irn_opname(X)), get_irn_node_nr(X))
 
 #endif
 
index ad8ad0f..90ecdd1 100644 (file)
@@ -10,6 +10,7 @@
 # define _IRNODE_T_H_
 
 # include "irnode.h"
+# include "xprintf.h"
 
 /** ir node attributes **/
 /* Block attributes */
index b3c77ce..f6dc2b0 100644 (file)
@@ -7,6 +7,7 @@
 
 # include "irop.h"
 # include "irnode_t.h"
+# include "misc.h"
 
 ir_op *op_Block;
 
index 5f6ed7d..eee223b 100644 (file)
@@ -14,6 +14,7 @@
 # ifndef _IROP_H_
 # define _IROP_H_
 
+# include <stddef.h>
 # include "ident.h"
 
 typedef enum {
@@ -44,7 +45,6 @@ extern ir_op *op_Jmp;
 extern ir_op *op_Cond;
 extern ir_op *op_Return;
 extern ir_op *op_Raise;
-
 extern ir_op *op_Sel;
 
 extern ir_op *op_Const;
index 2eb0c73..4fef58e 100644 (file)
@@ -7,7 +7,8 @@
 */
 
 # include "irnode_t.h"
-# include "iropt.h"
+# include "irgraph_t.h"
+# include "iropt_t.h"
 # include "ircons.h"
 # include "irgmod.h"
 # include "irvrfy.h"
index 20dc04d..6e13480 100644 (file)
@@ -12,7 +12,6 @@
 # include "irnode.h"
 # include "irgraph.h"
 # include "irflag.h"
-# include "pset.h"
 # include "tune.h"
 
 /* optimize_in_place (n) may change the contents of the ir_node itself,
@@ -26,9 +25,6 @@
 
 tarval *computed_value (ir_node *n);
 
-pset *new_identities (void);
-void del_identities (pset *value_table);
-
 ir_node *optimize (ir_node *n);
 ir_node *optimize_in_place (ir_node *n);
 
diff --git a/ir/ir/iropt_t.h b/ir/ir/iropt_t.h
new file mode 100644 (file)
index 0000000..68e4795
--- /dev/null
@@ -0,0 +1,18 @@
+/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Martin Trapp, Christian Schaefer
+**
+** Declarations for optimizations intertwined with IR construction.
+*/
+
+# ifndef _IROPT_T_H_
+# define _IROPT_T_H_
+
+# include "pset.h"
+# include "iropt.h"
+
+pset *new_identities (void);
+void del_identities (pset *value_table);
+
+# endif /* _IROPT_T_H_ */
index 934ed8b..d1b3ff5 100644 (file)
@@ -8,6 +8,7 @@
 
 # include "irprog.h"
 # include "array.h"
+# include "obst.h"
 
 #define GLOBAL_TYPE_NAME "GlobalType"
 
index 99c4157..117abbd 100644 (file)
@@ -20,7 +20,6 @@
 
 # include "irnode.h"
 # include "type.h"
-/*# include "obst.h"*/
 
 struct ir_prog {
   firm_kind kind;
index aae4229..d82c9c5 100644 (file)
@@ -6,6 +6,7 @@
 **
 */
 
+# include "irgraph_t.h"
 # include "irvrfy.h"
 # include "irgwalk.h"
 
@@ -25,9 +26,6 @@ irn_vrfy (ir_node *n)
   mymode = get_irn_mode (n);
   in = get_irn_in (n);
 
-//  IR_OP_VRFY (opcode);
-//  IR_MODE_VRFY (mymode);
-
   switch (opcode) {
 
   case iro_Start:
index 492818d..a5cf1a3 100644 (file)
@@ -46,6 +46,8 @@ TARGET = all
 .DEFAULT: $(TARGET)
 .SILENT: $(DFILES) clean  # hides output
 
+$(TARGET):      $(DFILES) $(OFILES)
+
 %.d:    %.c
        $(SHELL) -ec '$(CXX) $(DEPENDFLAGS) $(INCLUDES) $(X_INCLUDES) $< | sed '\''s/\($*\)\.o[ :]*/\.\.\/objects\/\1.o $@ : /g'\'' > $@'
 
@@ -56,9 +58,6 @@ TARGET = all
 lib:
        cp $(DISTRIB) ../../include
 
-
-$(TARGET):      $(DFILES) $(OFILES)
-
 clean:
        rm -f $(OFILES) $(DFILES)
 
index 570c4b7..6c08cfd 100644 (file)
@@ -29,8 +29,7 @@
 # ifndef _ENTITY_T_H_
 # define _ENTITY_T_H_
 
-# include "ident.h"
-# include "type.h"
+# include "entity.h"
 
 #ifndef _IR_GRAPH_TYPEDEF_
 #define _IR_GRAPH_TYPEDEF_
index e366ff2..03f91c1 100644 (file)
@@ -10,6 +10,7 @@
 # include "obst.h"
 # include "entity.h"
 # include <stdlib.h>
+# include "ident_t.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
index d13ba61..9e77730 100644 (file)
@@ -46,10 +46,10 @@ new_type_class (ident *name)//, int members)
 }
 
 /* manipulate fields of type_class */
-char *
+const char *
 get_class_name  (type_class *class) {
   assert(class);
-  return ID_TO_STR(class->name);
+  return id_to_str(class->name);
 }
 
 /* field: ident */
index 23f4aed..cd748c5 100644 (file)
@@ -227,7 +227,7 @@ type_class *new_type_class (ident *name);
 
 /* manipulate fields of type_class */
 
-char  *get_class_name  (type_class *class);
+const char  *get_class_name  (type_class *class);
 ident *get_class_ident (type_class *class);
 
 /* Not necessary now!
index 3c0f314..36bfb5f 100644 (file)
@@ -9,6 +9,7 @@
 ** - execute the post function after recursion
 */
 
+#include "stdio.h"
 #include "irgwalk.h"
 #include "irgraph.h"
 #include "irnode.h"
@@ -166,7 +167,7 @@ void type_walk(ir_graph *irg,
   type_env->env = env;
 
   ++type_visited;
-  irg_walk(irg->end, start_type_walk, NULL, type_env);
+  irg_walk(get_irg_end(irg), start_type_walk, NULL, type_env);
 
   type_walk_2((type_or_ent *)get_irg_ent(irg), pre, post, env);
 
index 4e636ba..7cd59dd 100644 (file)
@@ -27,6 +27,7 @@ MEMBERS        =  $(DISTRIBMEMBERS)
 CFILES = $(MEMBERS:.m=.c)
 
 HFILES = $(MEMBERS:.m=.h)
+HFILES += tv_t.h
 HFILES += ieee754.h
 
 HFILES += common.h debug.h entity.h gmp.h ident.h irmode.h obst.h \
@@ -45,6 +46,8 @@ TARGET = all
 .DEFAULT: $(TARGET)
 .SILENT: $(DFILES) clean  # hides output
 
+$(TARGET):      $(DFILES) $(OFILES)
+
 %.d:    %.c
        $(SHELL) -ec '$(CXX) $(DEPENDFLAGS) $(INCLUDES) $(X_INCLUDES) $< | sed '\''s/$*\\.o[ :]*/& $@/g'\'' > $@'
 
@@ -55,8 +58,6 @@ TARGET = all
 lib:
        cp $(DISTRIB) ../../include
 
-$(TARGET):      $(DFILES) $(OFILES)
-
 clean:
        rm -f $(OFILES) $(DFILES)
 
index ca28ccc..8c95696 100644 (file)
@@ -28,6 +28,7 @@
 # include <config.h>
 #endif
 
+# include "xprintf.h"
 #include <assert.h>
 #include <limits.h>
 #include <math.h>
@@ -40,8 +41,8 @@
 #include "obst.h"
 #include "ieee754.h"
 #include "tune.h"
-#include "ident.h"
-#include "tv.h"
+#include "ident_t.h"
+#include "tv_t.h"
 
 # include "entity_t.h"
 
index 5c3805f..f246e4b 100644 (file)
@@ -6,7 +6,7 @@
 
 # include "irmode.h"
 # include "entity.h"
-# include "xprintf.h"
+# include "bool.h"
 
 typedef struct tarval tarval;
 
@@ -132,7 +132,8 @@ tarval *tarval_shr (tarval *, tarval *);
 long tarval_classify (tarval *);
 long tarval_ord (tarval *, int *fail);
 
-int tarval_print (XP_PAR1, const xprintf_info *, XP_PARN);
+/* moved to tv_t.h
+   int tarval_print (XP_PAR1, const xprintf_info *, XP_PARN); */
 
 /* return a mode-specific value */
 
diff --git a/ir/tv/tv_t.h b/ir/tv/tv_t.h
new file mode 100644 (file)
index 0000000..aff58fa
--- /dev/null
@@ -0,0 +1,13 @@
+/* Declarations for Target Values.
+   Copyright (C) 1995, 1996 Christian von Roques */
+
+#ifndef _TV_T_H
+#define _TV_T_H
+
+# include "tv.h"
+# include "misc.h"
+
+int tarval_print (XP_PAR1, const xprintf_info *, XP_PARN);
+
+
+#endif
index e306906..588cfed 100644 (file)
@@ -1,6 +1,5 @@
-
 DIRS = adt common debug ident ir tr tv
-INCDIRS = $(DIRS:%=-I../ir/%) -I../ir/include
+INCDIRS = -I../include
 
 LIBDIRS=-L.. -L/usr/public/lib/gmp/
 LIBS=-lfirm -lgmp -lm
@@ -8,9 +7,6 @@ LIBS=-lfirm -lgmp -lm
 %.o:   %.c
        gcc -c $(INCDIRS) -g $<
 
-orb:
-       ls
-
 all: empty const_eval_example                                  \
      if_example if_else_example if_while_example cond_example  \
      call_str_example memory_example array-stack_example       \
index 1e2a8d2..a635b32 100644 (file)
@@ -135,11 +135,11 @@ main(void)
 
      x = new_Return (get_store (), 1, in);
   }
-  mature_block (main_irg->current_block);
+  mature_block (get_irg_current_block(main_irg));
 
   /* complete the end_block */
-  add_in_edge (main_irg->end_block, x);
-  mature_block (main_irg->end_block);
+  add_in_edge (get_irg_end_block(main_irg), x);
+  mature_block (get_irg_end_block(main_irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(main_irg);
index 1e3100d..4280e6f 100644 (file)
@@ -98,7 +98,7 @@ main(void)
 
   /* Now the "real" program: */
   /* Select the array from the stack frame.  */
-  array_ptr = new_simpleSel(get_store(), main_irg->frame, array_ent);
+  array_ptr = new_simpleSel(get_store(), get_irg_frame(main_irg), array_ent);
   /* Load element 3 of the array. For this first generate the pointer
      to this the element by a select node.  (Alternative: increase
      array pointer by (three * elt_size), but this complicates some
@@ -121,11 +121,11 @@ main(void)
 
      x = new_Return (get_store (), 1, in);
   }
-  mature_block (main_irg->current_block);
+  mature_block (get_irg_current_block(main_irg));
 
   /* complete the end_block */
-  add_in_edge (main_irg->end_block, x);
-  mature_block (main_irg->end_block);
+  add_in_edge (get_irg_end_block(main_irg), x);
+  mature_block (get_irg_end_block(main_irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(main_irg);
index 74397a5..cfac7a3 100644 (file)
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
   /* this is how a pointer to be fixed by the linker is represented after
      lowering a Sel node. */
 #define FUNCTIONNAME "f"
-  proc_ptr = new_SymConst ((type_or_id_p)ID_FROM_STR (FUNCTIONNAME, strlen(FUNCTIONNAME)),
+  proc_ptr = new_SymConst ((type_or_id_p)id_from_str (FUNCTIONNAME, strlen(FUNCTIONNAME)),
                           linkage_ptr_info);
 
   /* call procedure set_a, first built array with parameters */
@@ -95,13 +95,13 @@ int main(int argc, char **argv)
   }
   /* Now we generated all instructions for this block and all its predecessor blocks
    * so we can mature it. */
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* This adds the in edge of the end block which originates at the return statement.
    * The return node passes controlflow to the end block.  */
-  add_in_edge (irg->end_block, x);
+  add_in_edge (get_irg_end_block(irg), x);
   /* Now we can mature the end block as all it's predecessors are known. */
-  mature_block (irg->end_block);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index e1e5264..fa840be 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
   irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
 
   /* get the first argument a of method main - see irgraph.h */
-  arg1 = new_Proj(irg->args, mode_i, 0);
+  arg1 = new_Proj(get_irg_args(irg), mode_i, 0);
 
   /* arg1 as first first local variable - makes things simple */
   set_value(0, arg1);
@@ -84,7 +84,7 @@ int main(int argc, char **argv)
   f = new_Proj (x, mode_X, 0); /* if condition is false */
   t = new_Proj (x, mode_X, 1); /* if condition is true */
 
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* generate and fill the then block */
   b = new_Block ();
@@ -107,13 +107,13 @@ int main(int argc, char **argv)
   }
   /* Now generate all instructions for this block and all its predecessor blocks
    * so we can mature it. */
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* This adds the in edge of the end block which originates at the
      return statement. The return node passes controlflow to the end block.*/
-  add_in_edge (irg->end_block, x);
+  add_in_edge (get_irg_end_block(irg), x);
   /* Now we can mature the end block as all it's predecessors are known. */
-  mature_block (irg->end_block);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index 1ca5c77..a8e1635 100644 (file)
@@ -50,7 +50,7 @@ main(void)
   b = new_Const (mode_i, tarval_from_long (mode_i, 5));
 
   x = new_Jmp ();
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /*  To test const eval on DivMod
   c = new_DivMod(get_store(), a, b);
@@ -74,8 +74,8 @@ main(void)
      x = new_Return (get_store (), 2, in);
   }
 
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index c0b7c5b..6f329fb 100644 (file)
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
   cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   /* end block to add jmps */
   endBlock = new_Block();
@@ -120,10 +120,10 @@ int main(int argc, char **argv)
     get_store();
     x = new_Return (get_store(), 1, in);
   }
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   local_optimize_graph (irg);
index b958cfe..f00430d 100644 (file)
@@ -75,13 +75,13 @@ int main(int argc, char **argv)
   }
   /* Now generate all instructions for this block and all its predecessor blocks
    * so we can mature it. */
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* This adds the in edge of the end block which originates at the return statement.
    * The return node passes controlflow to the end block.  */
-  add_in_edge (irg->end_block, x);
+  add_in_edge (get_irg_end_block(irg), x);
   /* Now we can mature the end block as all it's predecessors are known. */
-  mature_block (irg->end_block);
+  mature_block (get_irg_end_block(irg));
 
   /* verify the graph */
   irg_vrfy(irg);
index 3b2afb1..33da68c 100644 (file)
@@ -97,13 +97,13 @@ int main(int argc, char **argv)
   }
   /* Now generate all instructions for this block and all its predecessor blocks
    * so we can mature it. */
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* This adds the in edge of the end block which originates at the return statement.
    * The return node passes controlflow to the end block.  */
-  add_in_edge (irg->end_block, x);
+  add_in_edge (get_irg_end_block(irg), x);
   /* Now we can mature the end block as all it's predecessors are known. */
-  mature_block (irg->end_block);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index 113c485..8f50d6f 100644 (file)
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
   f = new_Proj (x, mode_X, 0); /* if condition is false */
   t = new_Proj (x, mode_X, 1); /* if condition is true */
 
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* generate and fill the then block */
   b = new_Block ();
@@ -111,14 +111,14 @@ int main(int argc, char **argv)
   }
   /* Now generate all instructions for this block and all its predecessor
      blocks so we can mature it. */
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* This adds the in edge of the end block which originates at the
      return statement.  The return node passes control flow to the
      end block.  */
-  add_in_edge (irg->end_block, x);
+  add_in_edge (get_irg_end_block(irg), x);
   /* Now we can mature the end block as all it's predecessors are known. */
-  mature_block (irg->end_block);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index 811ef2f..47828f4 100644 (file)
@@ -33,7 +33,6 @@ main(void)
   type_primitive *typ;
   ir_node *x, *r, *t, *f, *a, *cmp;
   int a_pos, b_pos;
-  FILE *outfile;
 
   printf("\nCreating an IR graph: IF_EXAMPLE...\n");
 
@@ -52,7 +51,7 @@ main(void)
                     (type *)proc_main);
 
 #define RES_NAME "int"
-  typ = new_type_primitive(ID_FROM_STR(RES_NAME, strlen(RES_NAME)), mode_i);
+  typ = new_type_primitive(id_from_str(RES_NAME, strlen(RES_NAME)), mode_i);
   set_method_param_type(proc_main, 0, (type*)typ);
   set_method_res_type(proc_main, 0, (type*)typ);
 
@@ -67,7 +66,7 @@ main(void)
   set_value (a_pos, new_Proj (get_irg_args(irg), mode_i, 0));
   /*set_value (a_pos, new_Const (mode_i, tarval_from_long (mode_i, 0)));*/
   set_value (b_pos, new_Const (mode_i, tarval_from_long (mode_i, 2)));
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* Generate a conditional branch */
   cmp = new_Cmp(get_value(a_pos, mode_i), get_value(b_pos, mode_i));
@@ -100,8 +99,8 @@ main(void)
   }
 
   /* finalize the end block generated in new_ir_graph() */
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
 
   printf("Optimizing ...\n");
index a7020bf..d336bf1 100644 (file)
@@ -62,7 +62,7 @@ main(void)
   /* Generate two constants */
   set_value (0, new_Const (mode_I, tarval_from_long (mode_i, 0)));
   set_value (1, new_Const (mode_I, tarval_from_long (mode_i, 1)));
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* Generate a conditional branch */
   x = new_Cond (new_Proj(new_Cmp(new_Const (mode_I, tarval_from_long (mode_i, 0)),
@@ -122,8 +122,8 @@ main(void)
   }
 
   /* finalize the end block generated in new_ir_graph() */
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index dd439a0..6002f65 100644 (file)
@@ -87,42 +87,42 @@ int main(int argc, char **argv)
   cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   new_Block();
-  add_in_edge(irg->current_block, t);
+  add_in_edge(get_irg_current_block(irg), t);
   jmp = new_Jmp();
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   new_Block();
-  add_in_edge(irg->current_block, f);
+  add_in_edge(get_irg_current_block(irg), f);
   cond = new_Cond(new_Proj(new_Cmp(expr, c2), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   new_Block();
-  add_in_edge(irg->current_block, t);
-  add_in_edge(irg->current_block, jmp);
+  add_in_edge(get_irg_current_block(irg), t);
+  add_in_edge(get_irg_current_block(irg), jmp);
   jmp = new_Jmp();
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   new_Block();
-  add_in_edge(irg->current_block, f);
+  add_in_edge(get_irg_current_block(irg), f);
   t = new_Jmp();
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   new_Block();
-  add_in_edge(irg->current_block, t);
-  add_in_edge(irg->current_block, jmp);
+  add_in_edge(get_irg_current_block(irg), t);
+  add_in_edge(get_irg_current_block(irg), jmp);
   {
     ir_node *in[0]; /* this is the array containing the return parameters */
     x = new_Return (get_store(), 0, in);
   }
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index ae2070d..c0bdd94 100644 (file)
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
   cond = new_Cond(new_Proj(new_Cmp(expr, c1), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   loopBlock1 = new_Block();
   add_in_edge(loopBlock1, t);
@@ -102,16 +102,16 @@ int main(int argc, char **argv)
   mature_block(loopBlock2);
 
   new_Block();
-  add_in_edge(irg->current_block, f_l2);
-  add_in_edge(irg->current_block, f_l1);
+  add_in_edge(get_irg_current_block(irg), f_l2);
+  add_in_edge(get_irg_current_block(irg), f_l1);
   {
     ir_node *in[0];
     x = new_Return (get_store(), 0, in);
   }
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index d2a5292..aa447f6 100644 (file)
@@ -88,7 +88,7 @@ main(void)
 
   /* finish this first block */
   x = new_Jmp ();
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* a loop body */
   r = new_Block ();
@@ -133,8 +133,8 @@ main(void)
      x = new_Return (new_Proj(x, mode_M, 0), 1, in);
   }
   mature_block (r);
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);
index 1c35a90..325bce5 100644 (file)
@@ -133,11 +133,11 @@ main(void)
 
      x = new_Return (get_store (), 1, in);
   }
-  mature_block (main_irg->current_block);
+  mature_block (get_irg_current_block(main_irg));
 
   /* complete the end_block */
-  add_in_edge (main_irg->end_block, x);
-  mature_block (main_irg->end_block);
+  add_in_edge (get_irg_end_block(main_irg), x);
+  mature_block (get_irg_end_block(main_irg));
 
   irg_vrfy(main_irg);
 
@@ -148,8 +148,8 @@ main(void)
   set_a_irg = new_ir_graph (proc_set_e, 4);
 
   /* get the procedure parameter */
-  self = new_Proj(set_a_irg->args, mode_p, 0);
-  par1 = new_Proj(set_a_irg->args, mode_I, 1);
+  self = new_Proj(get_irg_args(set_a_irg), mode_p, 0);
+  par1 = new_Proj(get_irg_args(set_a_irg), mode_I, 1);
   /* Create and select the entity to set */
   class_langint = new_type_class(id_from_str ("Int", 3));
   a_e = new_entity((type *)class_prima, id_from_str ("a", 1),
@@ -160,11 +160,11 @@ main(void)
 
   /* return nothing */
   x = new_Return (get_store (), 0, NULL);
-  mature_block (set_a_irg->current_block);
+  mature_block (get_irg_current_block(set_a_irg));
 
   /* complete the end_block */
-  add_in_edge (set_a_irg->end_block, x);
-  mature_block (set_a_irg->end_block);
+  add_in_edge (get_irg_end_block(set_a_irg), x);
+  mature_block (get_irg_end_block(set_a_irg));
 
   irg_vrfy(set_a_irg);
 
@@ -175,8 +175,8 @@ main(void)
   c_irg = new_ir_graph (proc_c_e, 4);
 
   /* get the procedure parameter */
-  self = new_Proj(c_irg->args, mode_p, 0);
-  par1 = new_Proj(c_irg->args, mode_I, 1);
+  self = new_Proj(get_irg_args(c_irg), mode_p, 0);
+  par1 = new_Proj(get_irg_args(c_irg), mode_I, 1);
 
   /* Select the entity and load the value */
   a_ptr = new_simpleSel(get_store(), self, a_e);
@@ -191,23 +191,18 @@ main(void)
 
     x = new_Return (get_store (), 1, in);
   }
-  mature_block (c_irg->current_block);
+  mature_block (get_irg_current_block(c_irg));
 
   /* complete the end_block */
-  add_in_edge (c_irg->end_block, x);
-  mature_block (c_irg->end_block);
+  add_in_edge (get_irg_end_block(c_irg), x);
+  mature_block (get_irg_end_block(c_irg));
 
   /* verify the graph */
   irg_vrfy(main_irg);
 
   printf("Optimizing ...\n");
-  /*
   for (i = 0; i < get_irp_n_irgs(); i++)
     dead_node_elimination(get_irp_irg(i));
-  */
-  dead_node_elimination(main_irg );
-  dead_node_elimination(c_irg    );
-  dead_node_elimination(set_a_irg);
 
   /****************************************************************************/
 
index 80cf94f..0a48157 100644 (file)
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
   set_value(0, new_Const (mode_i, tarval_from_long (mode_i, 6)));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   /* end block to add jmps */
   endBlock = new_Block();
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
   cond = new_Cond(new_Proj(new_Cmp(c1, get_value(1, mode_i)), mode_b, Eq));
   f = new_Proj(cond, mode_X, 0);
   t = new_Proj(cond, mode_X, 1);
-  mature_block(irg->current_block);
+  mature_block(get_irg_current_block(irg));
 
   /* Block 2 */
   Block2 = new_Block();
@@ -135,11 +135,11 @@ int main(int argc, char **argv)
     in[0] = get_value(0, mode_i);
     x = new_Return (get_store(), 1, in);
   }
-  mature_block (irg->current_block);
+  mature_block (get_irg_current_block(irg));
 
   /* finish the Block with the end node */
-  add_in_edge (irg->end_block, x);
-  mature_block (irg->end_block);
+  add_in_edge (get_irg_end_block(irg), x);
+  mature_block (get_irg_end_block(irg));
 
   printf("Optimizing ...\n");
   dead_node_elimination(irg);