*** empty log message ***
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 11 Jul 2001 12:19:09 +0000 (12:19 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 11 Jul 2001 12:19:09 +0000 (12:19 +0000)
[r224]

ir/tr/typegmod.c [new file with mode: 0644]
ir/tr/typegmod.h [new file with mode: 0644]
ir/tr/typegmod_t.h [new file with mode: 0644]

diff --git a/ir/tr/typegmod.c b/ir/tr/typegmod.c
new file mode 100644 (file)
index 0000000..d6138fc
--- /dev/null
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001 by Universitaet Karlsruhe
+** All rights reserved.
+**
+** Authors: Goetz Lindenmaier
+**
+*/
+
+# include "typegmod_t.h"
+# include "type_t.h"
+# include "tpop_t.h"
+# include "irmode.h"
+
+inline void exchange_types(type *old_type, type *new_type) {
+  int i;
+  /* Deallocate datastructures not directly contained in the
+     old type */
+  /* @@@@ */
+
+  /* Remove old type from type list.  Will this confuscate the
+     iterators? */
+  /* @@@ */
+
+  /* Ev. add to a list of id types for later deallocation. */
+  /* @@@ */
+
+  /* Exchange the types */
+  old_type->type_op = type_id;
+  old_type->mode = (ir_mode *) new_type;
+}
+
+inline type *skip_tid(type *tp) {
+  while (tp->type_op == type_id)
+    tp = (type *) tp->mode;
+  return tp;
+}
diff --git a/ir/tr/typegmod.h b/ir/tr/typegmod.h
new file mode 100644 (file)
index 0000000..d6490b4
--- /dev/null
@@ -0,0 +1,40 @@
+
+# ifndef _TYPEGMOD_H_
+# define _TYPEGMOD_H_
+
+# include "type.h"
+
+/****h* libfirm/typegmod
+ *
+ * NAME
+ *  file typegmod.h
+ * COPYRIGHT
+ *   (C) 2001 by Universitaet Karlsruhe
+ * AUTHORS
+ *   Goetz Lindenmaier
+ * NOTES
+ *  This module supplies routines that support changing the type graph.
+ *****
+ */
+
+/****f* tpop/exchange_types
+ *
+ * NAME
+ *   exchange_types -- replaces one type by the other.
+ * SYNOPSIS
+ *   void exchange_types(type *old_type, type *new_type);
+ * INPUTS
+ *   The old type that shall be replaced by the new type.
+ * SIDE EFFECTS
+ *   Old type is replaced by new_type.  All references to old_type
+ *   now point to new_type.  The memory for the old type is destroyed,
+ *   but still used.  Therefore it is not freed.  The memory will
+ *   be lost after a certain while.
+ *   In the future there might be a routine to recover the memory, but
+ *   this will be at considerable runtime cost.
+ ***
+ */
+inline void exchange_types(type *old_type, type *new_type);
+
+
+# endif /*_TYPEGMOD_H_ */
diff --git a/ir/tr/typegmod_t.h b/ir/tr/typegmod_t.h
new file mode 100644 (file)
index 0000000..46e1864
--- /dev/null
@@ -0,0 +1,35 @@
+
+# ifndef _TYPEGMOD_T_H_
+# define _TYPEGMOD_T_H_
+
+# include "typegmod.h"
+
+/****h* libfirm/typegmod
+ *
+ * NAME
+ *  file typegmod.h
+ * COPYRIGHT
+ *   (C) 2001 by Universitaet Karlsruhe
+ * AUTHORS
+ *   Goetz Lindenmaier
+ * NOTES
+ *  This module supplies routines that support changing the type graph.
+ *****
+ */
+
+/****f* tpop/skip_tid
+ *
+ * NAME
+ *   skip_tid -- skip id types until a useful type is reached.
+ * SYNOPSIS
+ *   type *skip_tid(type *tp)
+ * INPUTS
+ *   A type of arbitrary kind.
+ * RETURNS
+ *   tp if it is not an id type.
+ *   If tp is an id type retruns the real type it stands for.
+ ***
+ */
+inline type *skip_tid(type *tp);
+
+# endif /*_TYPEGMOD_T_H_ */