added new licence header
[libfirm] / ir / tr / typegmod.c
index 14b1e33..e07c781 100644 (file)
@@ -1,24 +1,43 @@
+/*
+ * 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.
+ */
+
 /*
  * Project:     libFIRM
  * File name:   ir/tr/typegmod.c
  * Purpose:     Functionality to modify the type graph.
  * Author:      Goetz Lindenmaier
- * Modified by:
+ * Modified by: Michael Beck
  * Created:
  * CVS-ID:      $Id$
- * Copyright:   (c) 2001-2003 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright:   (c) 2001-2006 Universität Karlsruhe
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-# include "typegmod.h"
-# include "type_t.h"
-# include "tpop_t.h"
-# include "irmode.h"
+#include "typegmod.h"
+#include "type_t.h"
+#include "tpop_t.h"
+#include "irmode.h"
 
-void exchange_types(type *old_type, type *new_type) {
+void exchange_types(ir_type *old_type, ir_type *new_type) {
+  unsigned flags = old_type->flags & (tf_frame_type | tf_value_param_type | tf_global_type | tf_tls_type);
   /* Deallocate datastructures not directly contained in the
      old type.  We must do this now as it is the latest point
      where we know the original kind of type.
@@ -40,11 +59,14 @@ void exchange_types(type *old_type, type *new_type) {
   /* Exchange the types */
   old_type->type_op = type_id;
   old_type->mode = (ir_mode *) new_type;
+  /* ensure that the frame, value param, global and tls flags
+     are set right if these types are exchanged */
+  new_type->flags |= flags;
 }
 
-type *skip_tid(type *tp) {
+ir_type *skip_tid(ir_type *tp) {
   /* @@@ implement the self cycle killing trick of skip_id(ir_node *) */
   while (tp->type_op == type_id)
-    tp = (type *) tp->mode;
+    tp = (ir_type *) tp->mode;
   return tp;
 }