rename type entity into ir_entity
[libfirm] / ir / be / ppc32 / ppc32_gen_decls.c
index d42a291..586b69d 100644 (file)
@@ -86,13 +86,13 @@ static void dump_arith_tarval(struct obstack *obst, tarval *tv, int bytes)
 
   case 4:
     obstack_printf(obst, "0x%02x%02x%02x%02x",
-       get_tarval_sub_bits(tv, 3), get_tarval_sub_bits(tv, 2), get_tarval_sub_bits(tv, 1), get_tarval_sub_bits(tv, 0));
+    get_tarval_sub_bits(tv, 3), get_tarval_sub_bits(tv, 2), get_tarval_sub_bits(tv, 1), get_tarval_sub_bits(tv, 0));
     break;
 
   case 8:
     obstack_printf(obst, "0x%02x%02x%02x%02x%02x%02x%02x%02x",
-       get_tarval_sub_bits(tv, 7), get_tarval_sub_bits(tv, 6), get_tarval_sub_bits(tv, 5), get_tarval_sub_bits(tv, 4),
-       get_tarval_sub_bits(tv, 3), get_tarval_sub_bits(tv, 2), get_tarval_sub_bits(tv, 1), get_tarval_sub_bits(tv, 0));
+    get_tarval_sub_bits(tv, 7), get_tarval_sub_bits(tv, 6), get_tarval_sub_bits(tv, 5), get_tarval_sub_bits(tv, 4),
+    get_tarval_sub_bits(tv, 3), get_tarval_sub_bits(tv, 2), get_tarval_sub_bits(tv, 1), get_tarval_sub_bits(tv, 0));
     break;
 
   case 10:
@@ -179,12 +179,25 @@ static void do_dump_atomic_init(struct obstack *obst, ir_node *init)
       obstack_printf(obst, "%s", get_entity_ld_name(get_SymConst_entity(init)));
       break;
 
-    case symconst_size:
+    case symconst_ofs_ent:
+      obstack_printf(obst, "%d", get_entity_offset(get_SymConst_entity(init)));
+      break;
+
+    case symconst_type_size:
       obstack_printf(obst, "%d", get_type_size_bytes(get_SymConst_type(init)));
       break;
 
+    case symconst_type_align:
+      obstack_printf(obst, "%d", get_type_alignment_bytes(get_SymConst_type(init)));
+      break;
+
+    case symconst_enum_const:
+      tv = get_enumeration_value(get_SymConst_enum(init));
+      dump_arith_tarval(obst, tv, bytes);
+      break;
+
     default:
-      assert(0 && "dump_atomic_init(): don't know how to init from this SymConst");
+      assert(!"dump_atomic_init(): don't know how to init from this SymConst");
     }
     return;
 
@@ -260,7 +273,7 @@ static void dump_atomic_init(struct obstack *obst, ir_node *init)
  * @param ent The entity
  * @return 1 if it is a string constant, 0 otherwise
  */
-static int ent_is_string_const(entity *ent)
+static int ent_is_string_const(ir_entity *ent)
 {
   int res = 0;
   ir_type *ty;
@@ -311,7 +324,7 @@ static int ent_is_string_const(entity *ent)
  * @param obst The obst to dump on.
  * @param ent The entity to dump.
  */
-static void dump_string_cst(struct obstack *obst, entity *ent)
+static void dump_string_cst(struct obstack *obst, ir_entity *ent)
 {
   int i, n;
 
@@ -351,7 +364,7 @@ struct arr_info {
  * Dumps the initialization of global variables that are not
  * "uninitialized".
  */
-static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obstack, struct obstack *comm_obstack, entity *ent)
+static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obstack, struct obstack *comm_obstack, ir_entity *ent)
 {
   ir_type *ty         = get_entity_type(ent);
   const char *ld_name = get_entity_ld_name(ent);
@@ -362,8 +375,8 @@ static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obst
    * FIXME: did NOT work for partly constant values
    */
   if (! is_Method_type(ty)) {
-    ent_variability variability = get_entity_variability(ent);
-    visibility visibility = get_entity_visibility(ent);
+    ir_variability variability = get_entity_variability(ent);
+    ir_visibility visibility = get_entity_visibility(ent);
 
     if (variability == variability_constant) {
       /* a constant entity, put it on the rdata */
@@ -398,7 +411,7 @@ static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obst
 
           /* potential spare values should be already included! */
                  for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
-            entity *step = get_compound_ent_value_member(ent, i);
+            ir_entity *step = get_compound_ent_value_member(ent, i);
             ir_type *stype = get_entity_type(step);
 
             if (get_type_mode(stype)) {
@@ -448,10 +461,10 @@ static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obst
             /* We wanna know how many arrays are on the path to the entity. We also have to know how
              * many elements each array holds to calculate the offset for the entity. */
             for (j = 0; j < graph_length; j++) {
-              entity  *step      = get_compound_graph_path_node(path, j);
-              ir_type *step_type = get_entity_type(step);
-              int     ty_size    = (get_type_size_bits(step_type) + 7) >> 3;
-              int     k, n       = 0;
+              ir_entity *step      = get_compound_graph_path_node(path, j);
+              ir_type   *step_type = get_entity_type(step);
+              int       ty_size    = (get_type_size_bits(step_type) + 7) >> 3;
+              int       k, n       = 0;
 
               if (is_Array_type(step_type))
                 for (k = 0; k < get_array_n_dimensions(step_type); k++)
@@ -466,9 +479,9 @@ static void dump_global(struct obstack *rdata_obstack, struct obstack *data_obst
             if (aipos) aipos--;
 
             for (offset = j = 0; j < graph_length; j++) {
-              entity *step       = get_compound_graph_path_node(path, j);
+              ir_entity *step    = get_compound_graph_path_node(path, j);
               ir_type *step_type = get_entity_type(step);
-              int ent_ofs        = get_entity_offset_bytes(step);
+              int ent_ofs        = get_entity_offset(step);
               int stepsize       = 0;
 
               /* add all positive offsets (= offsets in structs) */
@@ -554,12 +567,12 @@ void ppc32_dump_globals(struct obstack *rdata_obstack, struct obstack *data_obst
 
 void ppc32_dump_indirect_symbols(struct obstack *isyms)
 {
-       entity *ent;
-       for(ent=pset_first(symbol_pset); ent; ent=pset_next(symbol_pset))
-       {
-               const char *ld_name = get_entity_ld_name(ent);
-               obstack_printf(isyms, ".non_lazy_symbol_pointer\n%s:\n\t.indirect_symbol _%s\n\t.long 0\n\n",ld_name,ld_name);
-       }
+  ir_entity *ent;
+
+  foreach_pset(symbol_pset, ent) {
+    const char *ld_name = get_entity_ld_name(ent);
+    obstack_printf(isyms, ".non_lazy_symbol_pointer\n%s:\n\t.indirect_symbol _%s\n\t.long 0\n\n",ld_name,ld_name);
+  }
 }
 
 /************************************************************************/