used new get_irn_pinned() fucntion
[libfirm] / ir / tr / type_t.h
index 7259344..6accd23 100644 (file)
@@ -18,6 +18,8 @@
 # include "type.h"
 # include "tpop_t.h"
 
+# include "array.h"
+
 /**
  * @file type_t.h
  * This file contains the datatypes hidden in type.h.
@@ -124,6 +126,10 @@ struct type {
   void *link;              /**< holds temporary data - like in irnode_t.h */
   struct dbg_info* dbi;    /**< A pointer to information for debug support. */
 
+  /* ------------- fields for analyses ---------------*/
+  ir_node **allocations;    /**< array of all Alloc nodes with this type
+                             @@@ Should not be in here, hash table! */
+
 #ifdef DEBUG_libfirm
   int nr;             /**< a unique node number for each node to make output
                              readable. */
@@ -248,6 +254,8 @@ __get_type_size_bits(type *tp) {
 static INLINE int
 __get_type_size_bytes(type *tp) {
   int size = __get_type_size_bits(tp);
+  if (size < 0)
+    return -1;
   if ((size & 7) != 0) {
     assert(0 && "cannot take byte size of this type");
     return -1;
@@ -303,6 +311,19 @@ __is_class_type(type *clss) {
   return (clss->type_op == type_class);
 }
 
+static INLINE int
+__get_class_n_members (type *clss) {
+  assert(clss && (clss->type_op == type_class));
+  return (ARR_LEN (clss->attr.ca.members));
+}
+
+static INLINE entity *
+__get_class_member   (type *clss, int pos) {
+  assert(clss && (clss->type_op == type_class));
+  assert(pos >= 0 && pos < get_class_n_members(clss));
+  return clss->attr.ca.members[pos];
+}
+
 static INLINE int
 __is_struct_type(type *strct) {
   assert(strct);
@@ -375,6 +396,8 @@ __is_atomic_type(type *tp) {
 #define type_not_visited(tp)              __type_not_visited(tp)
 #define is_type(thing)                    __is_type(thing)
 #define is_class_type(clss)               __is_class_type(clss)
+#define get_class_n_members(clss)         __get_class_n_members(clss)
+#define get_class_member(clss, pos)       __get_class_member(clss, pos)
 #define is_struct_type(strct)             __is_struct_type(strct)
 #define is_method_type(method)            __is_method_type(method)
 #define is_union_type(uni)                __is_union_type(uni)