added callbacks and adapted interfaces for abstract machine specification
[libfirm] / ir / be / arm / arm_gen_decls.c
index 964452e..07f5944 100644 (file)
@@ -9,22 +9,15 @@
 #include <ctype.h>
 #include <assert.h>
 
-#include "xmalloc.h"
-#include <obstack.h>
-
-#ifdef obstack_chunk_alloc
-# undef obstack_chunk_alloc
-# define obstack_chunk_alloc xmalloc
-#else
-# define obstack_chunk_alloc xmalloc
-# define obstack_chunk_free free
-#endif
+#include "obst.h"
 
 #include "tv.h"
 #include "irnode.h"
 #include "entity.h"
 #include "irprog.h"
 
+#include "arm_emitter.h"
+
 #include "arm_gen_decls.h"
 
 /************************************************************************/
@@ -184,12 +177,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_bytes(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;
 
@@ -367,8 +373,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 */
@@ -572,21 +578,21 @@ void arm_gen_decls(FILE *out) {
   size = obstack_object_size(&data);
   cp   = obstack_finish(&data);
   if (size > 0) {
-    fprintf(out, "\t.data\n");
+               arm_switch_section(out, SECTION_DATA);
     fwrite(cp, 1, size, out);
   }
 
   size = obstack_object_size(&rodata);
   cp   = obstack_finish(&rodata);
   if (size > 0) {
-    fprintf(out, "\t.section\t.rodata\n");
+               arm_switch_section(out, SECTION_RODATA);
     fwrite(cp, 1, size, out);
   }
 
   size = obstack_object_size(&comm);
   cp   = obstack_finish(&comm);
   if (size > 0) {
-    fprintf(out, "\t.common\n");
+               arm_switch_section(out, SECTION_COMMON);
     fwrite(cp, 1, size, out);
   }