*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 14 Sep 2000 14:02:23 +0000 (14:02 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Thu, 14 Sep 2000 14:02:23 +0000 (14:02 +0000)
[r70]

15 files changed:
Makefile
README [new file with mode: 0644]
ir/ir/Makefile
ir/ir/irdump.c
ir/ir/irgwalk.h
ir/ir/irnode.c
ir/ir/irnode.h
ir/ir/irnode_t.h
ir/ir/irop.c
ir/ir/irop.h
ir/ir/irop_t.h [new file with mode: 0644]
ir/tr/Makefile
ir/tr/entity.c
ir/tr/type.c
ir/tr/type.h

index bc90195..8a26c20 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ clean:
 
 realclean:
        for i in $(SUBDIRS); do  $(MAKE) -C $$i realclean; done
-       rm -f libfirm.a core include/*.h
+       rm -f libfirm.a core include/*.h TAGS
 
 TAGFILES = $(shell find . -name '*.c' -o -name '*.h')
 
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..1fadbc0
--- /dev/null
+++ b/README
@@ -0,0 +1,19 @@
+
+This is a library implementing the intermediate representation
+FIRM developed at IPD Goos, Uni Karlsruhe.
+
+Call make lib to construct the library.  This creates a file
+libfirm.a and extracts all necessary header files to ./include.
+
+To test the library goto ./testprograms and make and run the
+test examples placed there:
+
+make lib
+cd testprograms
+make
+make run
+
+For more documentation see /include/firm.h.
+To generate FIRM code from a compiler frontend read the documentation
+in ./include/ircons.h.
+About Firm you can learn in UKA tech-report 1999-??.
index 9636686..9673c4d 100644 (file)
@@ -29,7 +29,7 @@ MEMBERS = $(DISTRIBMEMBERS)
 CFILES = $(MEMBERS:.m=.c)
 
 HFILES = $(MEMBERS:.m=.h)
-HFILES +=  irnode_t.h irgraph_t.h
+HFILES +=  irnode_t.h irgraph_t.h ir_op_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 ab4f12a..2a26905 100644 (file)
@@ -14,7 +14,7 @@
 # include "entity.h"
 # include <stdlib.h>
 # include "array.h"
-# include "irop.h"
+# include "irop_t.h"
 # include "tv.h"
 # include "type_or_entity.h"
 # include "irgwalk.h"
index 7dab785..b9f0019 100644 (file)
@@ -6,6 +6,9 @@
 ** traverse an ir graph
 ** - execute the pre function before recursion
 ** - execute the post function after recursion
+**
+** Uses current_ir_graph (from irgraph.h)!!! Set it to the proper
+** graph before starting the walker.
 */
 
 
index ee4d773..871551c 100644 (file)
@@ -116,7 +116,7 @@ ir_node_print (XP_PAR1, const xprintf_info *info ATTRIBUTE((unused)), XP_PARN)
     return printed;
   }
 
-  XPF1 ("%I", get_irn_opname(np));
+  XPF1 ("%I", get_irn_opident(np));
 
   switch (get_irn_opcode (np)) {       /* node label */
   case iro_Const:
@@ -247,8 +247,15 @@ get_irn_opcode (ir_node *node)
   return node->op->code;
 }
 
-inline ident *
+inline const char *
 get_irn_opname (ir_node *node)
+{
+  assert(node);
+  return id_to_str(node->op->name);
+}
+
+inline ident *
+get_irn_opident (ir_node *node)
 {
   assert(node);
   return node->op->name;
@@ -691,11 +698,16 @@ get_Call_param_arr (ir_node *node) {
 }
 
 inline int
-get_Call_arity (ir_node *node) {
+get_Call_n_params (ir_node *node)  {
   assert (node->op == op_Call);
   return (get_irn_arity(node) - CALL_PARAM_OFFSET);
 }
 
+inline int
+get_Call_arity (ir_node *node) {
+  return get_Call_n_params(node);
+}
+
 /* inline void
 set_Call_arity (ir_node *node, ir_node *arity) {
   assert (node->op == op_Call);
index f5c112f..3e9c6f0 100644 (file)
@@ -65,7 +65,8 @@ inline void          set_irn_op            (ir_node *node, ir_op *op);
 /* Get the opcode-enum of the node */
 inline opcode        get_irn_opcode        (ir_node *node);
 /* Get the ident for a string representation of the opcode */
-inline ident        *get_irn_opname        (ir_node *node);
+inline const char   *get_irn_opname        (ir_node *node);
+inline ident        *get_irn_opident       (ir_node *node);
 inline void          set_irn_visited (ir_node *node, unsigned long visited);
 inline unsigned long get_irn_visited (ir_node *node);
 inline void          set_irn_link          (ir_node *node, ir_node *link);
@@ -168,6 +169,7 @@ inline void     set_Call_mem (ir_node *node, ir_node *mem);
 inline ir_node *get_Call_ptr (ir_node *node);
 inline void     set_Call_ptr (ir_node *node, ir_node *ptr);
 inline ir_node **get_Call_param_arr (ir_node *node);
+inline int      get_Call_n_params (ir_node *node);
 inline int      get_Call_arity (ir_node *node);
 /* inline void     set_Call_arity (ir_node *node, ir_node *arity); */
 inline ir_node *get_Call_param (ir_node *node, int pos);
@@ -396,9 +398,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_opident(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_opident(X)), get_irn_node_nr(X))
 #define DDMSG3(X)    printf("%s(l.%i) %s: %p\n", __FUNCTION__, __LINE__,     \
                      print_firm_kind(X), (X))
 
index 90ecdd1..2882e7f 100644 (file)
@@ -11,6 +11,7 @@
 
 # include "irnode.h"
 # include "xprintf.h"
+# include "irop_t.h"
 
 /** ir node attributes **/
 /* Block attributes */
index f6dc2b0..a4b356c 100644 (file)
@@ -5,7 +5,7 @@
 **
 */
 
-# include "irop.h"
+# include "irop_t.h"
 # include "irnode_t.h"
 # include "misc.h"
 
index eee223b..2b130a0 100644 (file)
@@ -30,12 +30,7 @@ typedef enum {
   iro_Proj, iro_Tuple, iro_Id, iro_Bad
 } opcode;
 
-typedef struct {
-  opcode code;
-  ident *name;
-  size_t attr_size;
-  int labeled;
-} ir_op;
+typedef struct ir_op ir_op;
 
 extern ir_op *op_Block;
 
@@ -85,14 +80,13 @@ extern ir_op *op_Proj;
 extern ir_op *op_Id;
 extern ir_op *op_Bad;
 
-/* create a new ir operation */
-ir_op * new_ir_op (opcode code, ident *name, size_t attr_size, int labeled);
-
-/* initialize the irop module */
-void init_op (void);
 
 /* returns the attribute size of the operator. */
 int get_op_attr_size (ir_op *op);
 
+/* Returns the string for the opcode. */
+const char* get_op_name (ir_op *op);
+
+
 
 # endif /* _IROP_H_ */
diff --git a/ir/ir/irop_t.h b/ir/ir/irop_t.h
new file mode 100644 (file)
index 0000000..00d1a5a
--- /dev/null
@@ -0,0 +1,20 @@
+
+# ifndef _IROP_T_H_
+# define _IROP_T_H_
+
+# include "irop.h"
+
+struct ir_op {
+  opcode code;
+  ident *name;
+  size_t attr_size;
+  int labeled;
+};
+
+/* create a new ir operation */
+ir_op * new_ir_op (opcode code, ident *name, size_t attr_size, int labeled);
+
+/* initialize the irop module */
+void init_op (void);
+
+#endif
index a5cf1a3..cc762e0 100644 (file)
@@ -34,6 +34,7 @@ HFILES +=  common.h debug.h gmp.h host.h ident.h irgraph.h  \
            obst.h pset.h set.h tv.h xprintf.h xp_help.h entity_t.h
 
 DISTRIB = $(DISTRIBMEMBERS:.m=.h)
+DISTRIB += type_or_entity.h
 
 OFILES = $(MEMBERS:%.m=../objects/%.o)
 
index 1c056e2..6b9ad6b 100644 (file)
@@ -57,17 +57,11 @@ new_entity (type *owner, ident *name, type *type)
   return res;
 }
 
-#if 0
-inline char *
+inline const char *
 get_entity_name (entity *ent) {
   assert (ent);
   return id_to_str(get_entity_ident(ent));
-  /* GL:
-     entity.c:52: warning: return discards `const' from pointer target type
-     -- ned so guud
-  */
 }
-#endif
 
 ident *
 get_entity_ident    (entity *ent) {
index 12fe92a..d1d6dc4 100644 (file)
@@ -258,6 +258,12 @@ void   set_method_name  (type_method *method, char *name);
 void   set_method_ident (type_method *method, ident* ident);
 */
 
+
+inline int
+get_method_n_params (type_method *method) {
+  return method->arity;
+}
+
 inline int
 get_method_arity (type_method *method) {
   return method->arity;
index b111a74..a7facd0 100644 (file)
@@ -183,8 +183,6 @@ or lowering phases.
 # include "common.h"
 # include "ident.h"
 # include "irmode.h"
-/*CS*/
-//# include "entity.h"
 
 #ifndef _ENTITY_TYPEDEF_
 #define _ENTITY_TYPEDEF_
@@ -310,6 +308,7 @@ ident       *get_method_ident (type_method *method);
 void   set_method_name  (type_method *method, char *name);
 void   set_method_ident (type_method *method, ident* ident); */
 
+inline int   get_method_n_params (type_method *method);
 inline int   get_method_arity (type_method *method);
 /*inline void  set_method_arity (type_method *method, int arity);*/
 inline type *get_method_param_type(type_method *method, int pos);