allow specification of names for in parameters in spec file
[libfirm] / ir / ana2 / pto_comp.c
index ee4e661..108394c 100644 (file)
@@ -1,17 +1,31 @@
 /* -*- c -*- */
 
 /*
-   Project:     libFIRM
-   File name:   ir/ana2/pto_comp.c
-   Purpose:     Main Implementation of PTO
-   Author:      Florian
-   Modified by:
-   Created:     Sat Nov 13 19:35:27 CET 2004
-   CVS-ID:      $Id$
-   Copyright:   (c) 1999-2004 Universität Karlsruhe
-   Licence:     This file is protected by the GPL -  GNU GENERAL PUBLIC LICENSE.
-*/
-
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief   Main Implementation of PTO
+ * @author  Florian
+ * @date    Sat Nov 13 19:35:27 CET 2004
+ * @version $Id$
+ */
 # ifdef HAVE_CONFIG_H
 #  include "config.h"
 # endif
@@ -29,7 +43,7 @@
 # include "pto_mod.h"
 
 # include "irnode_t.h"
-# include "irprog.h"
+# include "irprog_t.h"
 # include "xmalloc.h"
 # include "irmemwalk.h"
 
@@ -72,7 +86,7 @@ static void pto_end_block (ir_node*, pto_env_t*);
 static int add_graph_args (ir_graph *graph, ir_node *call, pto_env_t *env)
 {
   int change = FALSE;
-  type *meth = get_entity_type (get_irg_entity (graph));
+  ir_type *meth = get_entity_type (get_irg_entity (graph));
   ir_node **args = get_irg_proj_args (graph);
   int i, n_args;
 
@@ -113,7 +127,7 @@ static int add_graph_args (ir_graph *graph, ir_node *call, pto_env_t *env)
 /* Transfer the actual arguments to the formal arguments */
 static void set_graph_args (ir_graph *graph, ir_node *call, pto_env_t *env)
 {
-  type *meth = get_entity_type (get_irg_entity (graph));
+  ir_type *meth = get_entity_type (get_irg_entity (graph));
   ir_node **args = get_irg_proj_args (graph);
   int i, n_args;
 
@@ -143,7 +157,7 @@ static void set_graph_args (ir_graph *graph, ir_node *call, pto_env_t *env)
 /* Transfer the graph's result to the call */
 static int set_graph_result (ir_graph *graph, ir_node *call)
 {
-  type *tp = get_entity_type (get_irg_entity (graph));
+  ir_type *tp = get_entity_type (get_irg_entity (graph));
   ir_node *end_block;
   pto_t *ret_pto, *call_pto;
   int change;
@@ -187,8 +201,7 @@ static int set_graph_result (ir_graph *graph, ir_node *call)
 static pto_t *get_pto_proj (ir_node *proj, pto_env_t *env)
 {
   ir_node *proj_in = get_Proj_pred (proj);
-  const long proj_proj = get_Proj_proj (proj);
-  const opcode in_op = get_irn_opcode (proj_in);
+  const ir_opcode in_op = get_irn_opcode (proj_in);
   pto_t *in_pto = NULL;
   pto_t *proj_pto = NULL; /* get_node_pto (proj); */
 
@@ -200,7 +213,7 @@ static pto_t *get_pto_proj (ir_node *proj, pto_env_t *env)
 
     return (NULL);
   case (iro_Proj): {            /* ProjT (Start), ProjT (Call) */
-    opcode in_in_op;
+    ir_opcode in_in_op;
     long proj_in_proj;
 
     proj_in_in = get_Proj_pred (proj_in);
@@ -234,7 +247,7 @@ static pto_t *get_pto_proj (ir_node *proj, pto_env_t *env)
   }
 
   case (iro_Load):              /* ProjV (Load) */
-    assert (pn_Load_res == proj_proj);
+    assert (pn_Load_res == get_Proj_proj(proj));
     /* FALLTHROUGH */
   case (iro_Call):              /* ProjT (Call) */
     /* FALLTHROUGH */
@@ -321,7 +334,7 @@ static pto_t *get_pto_ret (ir_node *ret, pto_env_t *env)
 /* Dispatch to propagate PTO values */
 static pto_t *get_pto (ir_node *node, pto_env_t *env)
 {
-  const opcode op = get_irn_opcode (node);
+  const ir_opcode op = get_irn_opcode (node);
 
   DBGPRINT (2, (stdout, "%s (%s[%li])\n",
                 __FUNCTION__,
@@ -360,7 +373,7 @@ static pto_t *get_pto (ir_node *node, pto_env_t *env)
 static void pto_load (ir_node *load, pto_env_t *pto_env)
 {
   ir_node *ptr;
-  entity *ent;
+  ir_entity *ent;
 
   /* perform load */
   DBGPRINT (2, (stdout, "%s (%s[%li]): pto = 0x%08x\n",
@@ -391,7 +404,7 @@ static void pto_load (ir_node *load, pto_env_t *pto_env)
 static void pto_store (ir_node *store, pto_env_t *pto_env)
 {
   ir_node *ptr, *val;
-  entity *ent;
+  ir_entity *ent;
   pto_t *ptr_pto, *val_pto;
 
   /* perform store */
@@ -454,7 +467,7 @@ static void pto_method (ir_node *call, pto_env_t *pto_env)
 /* Perform the appropriate action on the given node */
 static void pto_node_node(ir_node *node, pto_env_t *pto_env)
 {
-  opcode op = get_irn_opcode (node);
+  ir_opcode op = get_irn_opcode (node);
 
   DBGPRINT (1, (stdout, "%s (%s[%li])\n",
                 __FUNCTION__, OPNAME (node), OPNUM (node)));
@@ -542,7 +555,7 @@ static void pto_call (ir_graph *graph, ir_node *call, pto_env_t *pto_env)
   int change = FALSE;
 
   /* only for debugging stuff: */
-  entity *ent = get_irg_entity (graph);
+  ir_entity *ent = get_irg_entity (graph);
   const char *ent_name = (char*) get_entity_name (ent);
   const char *own_name = (char*) get_type_name (get_entity_owner (ent));
 
@@ -607,14 +620,14 @@ static void pto_call (ir_graph *graph, ir_node *call, pto_env_t *pto_env)
       DBGEXE (1, pto_print_pto (get_irg_end_block (graph)));
 
     if (rec_change) {
-      DBGPRINT (0, (stdout, "%s: change args", __FUNCTION__));
+      DBGPRINT (0, (stdout, "%s: change args\n", __FUNCTION__));
     }
 
     rec_change |= set_graph_result (graph, call);
 
     if (rec_change) {
-      DBGPRINT (0, (stdout, "%s: return out:", __FUNCTION__));
-      DBGEXE (0, pto_print_pto (get_irg_end_block (graph)));
+      DBGPRINT (1, (stdout, "%s: return out:", __FUNCTION__));
+      DBGEXE (1, pto_print_pto (get_irg_end_block (graph)));
     }
 
 # if 0
@@ -640,7 +653,7 @@ static void pto_raise (ir_node *raise, pto_env_t *pto_env)
 static void pto_end_block (ir_node *end_block, pto_env_t *pto_env)
 {
   /* perform end block */
-  type *tp = get_entity_type (get_irg_entity (get_irn_irg (end_block)));
+  ir_type *tp = get_entity_type (get_irg_entity (get_irn_irg (end_block)));
   pto_t *end_pto;
   int i, n_ins;
 
@@ -650,7 +663,7 @@ static void pto_end_block (ir_node *end_block, pto_env_t *pto_env)
 
   tp = get_method_res_type (tp, 0);
 
-  if (mode_P != get_type_mode (tp)) {
+  if (! mode_is_reference(get_type_mode (tp))) {
     return;
   }
 
@@ -756,6 +769,22 @@ pto_t *get_alloc_pto (ir_node *alloc)
 \f
 /*
   $Log$
+  Revision 1.21  2007/03/22 10:39:33  matze
+  a bunch of fixes to make firm work with NDEBUG and without DEBUG_libfirm
+
+  Revision 1.20  2007/01/16 15:45:42  beck
+  renamed type opcode to ir_opcode
+
+  Revision 1.19  2006/12/13 19:46:47  beck
+  rename type entity into ir_entity
+
+  Revision 1.18  2006/01/13 22:57:41  beck
+  renamed all types 'type' to 'ir_type'
+  used mode_is_reference instead of != mode_P test
+
+  Revision 1.17  2005/02/25 16:48:21  liekweg
+  fix typo
+
   Revision 1.16  2005/01/27 15:51:19  liekweg
   whitespace change