returns after assert(0) inserted
[libfirm] / ir / tr / entity.c
index f38847d..8bc7955 100644 (file)
@@ -22,6 +22,7 @@
 /* All this is needed to build the constant node for methods: */
 # include "irprog_t.h"
 # include "ircons.h"
+# include "tv_t.h"
 
 /*******************************************************************/
 /** general                                                       **/
@@ -84,10 +85,12 @@ new_entity (type *owner, ident *name, type *type)
     res->variability = constant;
     rem = current_ir_graph;
     current_ir_graph = get_const_code_irg();
-    res->value = new_Const(mode_P, tarval_P_from_entity(res));
+    res->value = new_Const(mode_P, new_tarval_from_entity(res, mode_P));
     current_ir_graph = rem;
   } else {
     res->variability = uninitialized;
+    res->value = NULL;
+    res->values = NULL;
   }
   res->peculiarity = existent;
   res->volatility = non_volatile;
@@ -179,7 +182,7 @@ copy_entity_name (entity *old, ident *new_name) {
 
 void
 free_entity (entity *ent) {
-  free_tv_entity(ent);
+  free_tarval_entity(ent);
   free_entity_attrs(ent);
   free(ent);
 }
@@ -287,8 +290,8 @@ set_entity_visibility (entity *ent, ent_visibility vis) {
   if (vis != local)
     assert((ent->allocation == static_allocated) ||
           (ent->allocation == automatic_allocated));
-  // @@@ Test that the owner type is not local, but how??
-  //       && get_class_visibility(get_entity_owner(ent)) != local));
+  /* @@@ Test that the owner type is not local, but how??
+         && get_class_visibility(get_entity_owner(ent)) != local));*/
   ent->visibility = vis;
 }
 
@@ -316,6 +319,19 @@ set_entity_variability (entity *ent, ent_variability var){
   ent->variability = var;
 }
 
+/* return the name of the variablity */
+const char *get_variability_name(ent_variability var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(uninitialized);
+    X(initialized);
+    X(part_constant);
+    X(constant);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
 
 INLINE ent_volatility
 get_entity_volatility (entity *ent) {
@@ -329,6 +345,18 @@ set_entity_volatility (entity *ent, ent_volatility vol) {
   ent->volatility = vol;
 }
 
+/* return the name of the volatility */
+const char *get_volatility_name(ent_volatility var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(non_volatile);
+    X(is_volatile);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
+
 INLINE peculiarity
 get_entity_peculiarity (entity *ent) {
   assert (ent);
@@ -343,6 +371,19 @@ set_entity_peculiarity (entity *ent, peculiarity pec) {
   ent->peculiarity = pec;
 }
 
+/* return the name of the peculiarity */
+const char *get_peculiarity_name(peculiarity var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(description);
+    X(inherited);
+    X(existent);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
+
 /* Set has no effect for entities of type method. */
 INLINE ir_node *
 get_atomic_ent_value(entity *ent) {
@@ -372,7 +413,9 @@ ir_node *copy_const_value(ir_node *n) {
   case iro_Add:
     nn = new_Add(copy_const_value(get_Add_left(n)), copy_const_value(get_Add_right(n)), m); break;
   default:
-    assert(0 && "opdope invalid or not implemented"); break;
+    assert(0 && "opdope invalid or not implemented");
+    nn=NULL;
+    break;
   }
   return nn;
 }
@@ -466,7 +509,7 @@ set_array_entity_values(entity *ent, tarval **values, int num_vals) {
   current_ir_graph = get_const_code_irg();
 
   for (i = 0; i < num_vals; i++) {
-    val = new_Const(get_tv_mode (values[i]), values[i]);
+    val = new_Const(get_tarval_mode (values[i]), values[i]);
     add_compound_ent_value(ent, val, get_array_element_entity(arrtp));
   }
   current_ir_graph = rem;