Fix inconsistency between reg_req and ins of Push: reg_req expected the stack in...
[libfirm] / ir / ir / ircgcons.c
index d1181f7..d1fff05 100644 (file)
@@ -1,23 +1,37 @@
 /*
- * Project:     libFIRM
- * File name:   ir/ir/ircgcons.c
- * Purpose:     Construction and removal of interprocedural representation
- *              (explicit interprocedural dependencies).
- * Author:      Hubert Schmid
- * Modified by:
- * Created:     09.06.2002
- * CVS-ID:      $Id$
- * Copyright:   (c) 2002-2003 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2008 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   Construction and removal of interprocedural representation
+ *          (explicit interprocedural dependencies).
+ * @author  Hubert Schmid
+ * @date    09.06.2002
+ * @version $Id$
  */
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
+#ifdef INTERPROCEDURAL_VIEW
 
+#include <string.h>
 #include <stdbool.h>
 #include "ircgcons.h"
 
@@ -164,7 +178,6 @@ static void collect_phicallproj(void) {
      * auch wenn sie nicht im intraprozeduralen Graphen erreichbar
      * sind. */
     link(start, get_irg_frame(irg));
-    link(start, get_irg_globals(irg));
     /* walk */
     irg_walk_graph(irg, firm_clear_link, (irg_walk_func *) collect_phicallproj_walker, &end);
 
@@ -258,9 +271,9 @@ static void prepare_irg(ir_graph * irg, irg_data_t * data) {
     }
   }
   /* Globle Einträge für ersetzte Operationen korrigieren. */
-  set_irg_frame      (irg, skip_Id(get_irg_frame(irg)));
-  set_irg_globals    (irg, skip_Id(get_irg_globals(irg)));
-  set_irg_initial_mem(irg, skip_Id(get_irg_initial_mem(irg)));
+  set_irg_initial_exec(irg, skip_Id(get_irg_initial_exec(irg)));
+  set_irg_frame       (irg, skip_Id(get_irg_frame(irg)));
+  set_irg_initial_mem (irg, skip_Id(get_irg_initial_mem(irg)));
 
   /* Unbekannten Aufrufer sofort eintragen. */
   if (data->open) {
@@ -454,11 +467,13 @@ static void move_nodes(ir_node * from_block, ir_node * to_block, ir_node * node)
 /* Abhängigkeiten vom Start-Block und den Filter-Operationen im
  * Start-Block auf den Aufrufer hinzufügen. */
 static void construct_start(ir_entity * caller, ir_entity * callee,
-                           ir_node * call, ir_node * exec) {
+                            ir_node * call, ir_node * exec)
+{
   irg_data_t *data  = get_entity_link(callee);
   ir_graph   *irg   = get_entity_irg(callee);
   ir_node    *start = get_irg_start(irg);
   ir_node    *filter;
+  (void) caller;
 
   assert(irg);
   assert(get_entity_peculiarity(callee) == peculiarity_existent); /* Else data is not initalized. */
@@ -592,6 +607,7 @@ static bool is_outermost_graph(ir_graph *irg) {
   return true;
 }
 
+#ifdef INTERPROCEDURAL_VIEW
 /* Grundblock der Call-Operation aufteilen. CallBegin- und Filter-Operationen
  * einfügen. Die Steuer- und Datenflussabhängigkeiten von den aufgerufenen
  * Methoden auf die CallBegin-Operation, und von der Aufrufstelle auf die
@@ -802,6 +818,7 @@ static void construct_call(ir_node * call) {
   DEL_ARR_F(irgs);
   DEL_ARR_F(data);
 }
+#endif
 
 
 void cg_construct(int arr_len, ir_entity ** free_methods_arr) {
@@ -861,7 +878,9 @@ void cg_construct(int arr_len, ir_entity ** free_methods_arr) {
 
 
 
-static void destruct_walker(ir_node * node, void * env) {
+static void destruct_walker(ir_node * node, void * env)
+{
+  (void) env;
   if (get_irn_op(node) == op_Block) {
     remove_Block_cg_cfgpred_arr(node);
     /* Do not turn Break into Jmp.  Better: merge blocks right away.
@@ -894,11 +913,11 @@ void cg_destruct(void) {
       ir_graph * irg = get_irp_irg(i);
       irg_walk_graph(irg, destruct_walker, firm_clear_link, NULL);
 
-      set_irg_frame      (irg, skip_Id(get_irg_frame(irg)));
-      set_irg_globals    (irg, skip_Id(get_irg_globals(irg)));
-      set_irg_initial_mem(irg, skip_Id(get_irg_initial_mem(irg)));
-      set_irg_end_reg    (irg, get_irg_end(irg));
-      set_irg_end_except (irg, get_irg_end(irg));
+         set_irg_initial_exec(irg, skip_Id(get_irg_initial_exec(irg)));
+      set_irg_frame       (irg, skip_Id(get_irg_frame(irg)));
+      set_irg_initial_mem (irg, skip_Id(get_irg_initial_mem(irg)));
+      set_irg_end_reg     (irg, get_irg_end(irg));
+      set_irg_end_except  (irg, get_irg_end(irg));
 
       set_irg_callee_info_state(irg, irg_callee_info_none);
     }
@@ -906,3 +925,5 @@ void cg_destruct(void) {
     set_irp_ip_view(ip_view_no);
   }
 }
+
+#endif