fix for firmjni
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 12 Jul 2004 09:49:31 +0000 (09:49 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Mon, 12 Jul 2004 09:49:31 +0000 (09:49 +0000)
[r3402]

firmjni/Makefile.in
firmjni/testprograms/run-results.txt
ir/ir/ircons.c
ir/ir/ircons.h
ir/ir/irnode.h

index 2c38895..762bd23 100644 (file)
@@ -68,7 +68,7 @@ FIRM_PATH_HEADERS=common/firm.h common/firm_common.h \
        ir/ircons.h ir/ircgcons.h ir/irflag.h ir/irvrfy.h ir/irdump.h \
        ir/iropt.h ir/irgopt.h ir/ircgopt.h \
        ana/irouts.h ana/irdom.h ana/irloop.h ana/cgana.h \
-       ir/irgmod.h tr/typegmod.h opt/tailrec.h stat/firmstat.h
+       ir/irgmod.h tr/typegmod.h opt/tailrec.h
 
 FIRM_SOURCE_DIR_HEADERS=$(addprefix $(SOURCE_DIR)/,$(FIRM_HEADERS))
 
index 346ee03..ab33c2a 100644 (file)
@@ -7,20 +7,20 @@ use xvcg to view this graph:
 
 Creating an IR graph: IfElseExample...
 Optimization: 3
-new Node 33
-old Node 32
+new Node 32
+old Node 31
 Optimization: 2
-new Nodes: 35,
-old Nodes: 36, 34, 35,
+new Nodes: 34,
+old Nodes: 35, 33, 34,
 Optimization: 2
-new Nodes: 20,
-old Nodes: 37, 34, 20,
+new Nodes: 19,
+old Nodes: 36, 33, 19,
 Optimization: 4
-new Nodes: 27,
-old Nodes: 42, 35,
+new Nodes: 26,
+old Nodes: 41, 34,
 Done building the graph.  Optimizing it.
 Optimization: 4
-new Nodes: 27,
-old Nodes: 42, 35,
+new Nodes: 26,
+old Nodes: 41, 34,
 use xvcg to view this graph:
 /ben/goetz/bin/xvcg GRAPHNAME
index 198380b..e455c88 100644 (file)
@@ -721,6 +721,26 @@ new_rd_SymConst (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol va
   return res;
 }
 
+ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, type *tp) {
+  symconst_symbol sym = {(type *)symbol};
+  return new_rd_SymConst_type(db, irg, irg->start_block, sym, symconst_addr_ent, tp);
+}
+
+ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, type *tp) {
+  symconst_symbol sym = {(type *)symbol};
+  return new_rd_SymConst_type(db, irg, irg->start_block, sym, symconst_addr_name, tp);
+}
+
+ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, type *symbol, type *tp) {
+  symconst_symbol sym = {symbol};
+  return new_rd_SymConst_type(db, irg, irg->start_block, sym, symconst_type_tag, tp);
+}
+
+ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *tp) {
+  symconst_symbol sym = {symbol};
+  return new_rd_SymConst_type(db, irg, irg->start_block, sym, symconst_size, tp);
+}
+
 INLINE ir_node *
 new_rd_Sync (dbg_info* db, ir_graph *irg, ir_node *block, int arity, ir_node **in)
 {
index 78355bc..26bb4f1 100644 (file)
@@ -1300,6 +1300,9 @@ ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
  *    Outputs of the node.
  *      An unsigned integer (I_u) or a pointer (P).
  *
+ *    Mention union in declaration so that the firmjni generator recognizes that
+ *    it can not cast the argument to an int.
+ *
  * @param *db     A pointer for debug information.
  * @param *irg    The ir graph the node  belongs to.
  * @param *block  The ir block the node belongs to.
@@ -1308,14 +1311,42 @@ ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
  * @param tp      The source type of the constant.
  */
 ir_node *
-new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, symconst_symbol value,
+new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
                      symconst_kind symkind, type *tp);
 
 /** Constructor for a SymConst node.
  *
  *  Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
-                         symconst_symbol value, symconst_kind symkind);
+                         union symconst_symbol value, symconst_kind symkind);
+
+/** Constructor for a SymConst addr_ent node.
+ *
+ * Same as new_rd_SymConst_type, except that the constructor is tailored for
+ * symconst_addr_ent.
+ * Adds the symconst to the start block of irg. */
+ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, type *tp);
+
+/** Constructor for a SymConst addr_name node.
+ *
+ * Same as new_rd_SymConst_type, except that the constructor is tailored for
+ * symconst_addr_ent.
+ * Adds the symconst to the start block of irg. */
+ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, type *tp);
+
+/** Constructor for a SymConst type_tag node.
+ *
+ * Same as new_rd_SymConst_type, except that the constructor is tailored for
+ * symconst_addr_ent.
+ * Adds the symconst to the start block of irg. */
+ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
+
+/** Constructor for a SymConst size node.
+ *
+ * Same as new_rd_SymConst_type, except that the constructor is tailored for
+ * symconst_addr_ent.
+ * Adds the symconst to the start block of irg. */
+ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
 
 /** Constructor for a Sel node.
  *
@@ -1975,7 +2006,7 @@ ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
  */
 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
-                       symconst_symbol value, symconst_kind symkind);
+                        union symconst_symbol value, symconst_kind symkind);
 
 /** Constructor for a Sel node.
  *
@@ -2682,12 +2713,12 @@ ir_node *new_d_Const  (dbg_info* db, ir_mode *mode, tarval *con);
  * @param tp      The source type of the constant.
  *
  */
-ir_node *new_d_SymConst_type (dbg_info* db, symconst_symbol value, symconst_kind kind, type* tp);
+ir_node *new_d_SymConst_type (dbg_info* db, union symconst_symbol value, symconst_kind kind, type* tp);
 
 /** Constructor for a SymConst node.
  *
  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
-ir_node *new_d_SymConst (dbg_info* db, symconst_symbol value, symconst_kind kind);
+ir_node *new_d_SymConst (dbg_info* db, union symconst_symbol value, symconst_kind kind);
 
 /** Constructor for a simpleSel node.
  *
@@ -3393,7 +3424,7 @@ ir_node *new_Const  (ir_mode *mode, tarval *con);
  * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
  *
  */
-ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
+ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
 
 /** Constructor for a simpelSel node.
  *
index 0f4d84a..6070fbc 100644 (file)
@@ -426,10 +426,6 @@ type    *get_SymConst_type (ir_node *node);
 void     set_SymConst_type (ir_node *node, type *tp);
 
 /** Only to access SymConst of kind addr_name.  Else assertion: */
-/* old:
-ident   *get_SymConst_ptrinfo (ir_node *node);
-void     set_SymConst_ptrinfo (ir_node *node, ident *ptrinfo);
-*/
 #define get_SymConst_ptrinfo get_SymConst_name
 #define set_SymConst_ptrinfo set_SymConst_name
 ident   *get_SymConst_name (ir_node *node);
@@ -441,10 +437,10 @@ void     set_SymConst_entity (ir_node *node, entity *ent);
 
 /** Sets both: type and ptrinfo.  Needed to treat the node independent of
    its semantics.  Does a memcpy for the memory sym points to. */
-#define get_SymConst_type_or_id get_SymConst_symbol
-#define set_SymConst_type_or_id set_SymConst_symbol
-symconst_symbol get_SymConst_symbol (ir_node *node);
-void            set_SymConst_symbol (ir_node *node, symconst_symbol sym);
+/* write 'union': firmjni then does not create a method... */
+union symconst_symbol get_SymConst_symbol (ir_node *node);
+void                  set_SymConst_symbol (ir_node *node,
+                                          union symconst_symbol sym);
 
 ir_node *get_Sel_mem (ir_node *node);
 void     set_Sel_mem (ir_node *node, ir_node *mem);