* @date 04.11.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include "begnuas.h"
static void dump_string_cst(ir_entity *ent)
{
int i, len;
+ int output_len;
ir_type *type;
int type_size;
int remaining_space;
- len = get_compound_ent_n_values(ent);
+ len = get_compound_ent_n_values(ent);
+ output_len = len;
if (be_gas_flavour == GAS_FLAVOUR_MACH_O) {
be_emit_cstring("\t.ascii \"");
} else {
be_emit_cstring("\t.string \"");
- len -= 1;
+ output_len -= 1;
}
- for (i = 0; i < len; ++i) {
+ for (i = 0; i < output_len; ++i) {
ir_node *irn;
int c;
remaining_space = type_size - len;
assert(remaining_space >= 0);
if(remaining_space > 0) {
- be_emit_irprintf("\t.skip\t%d\n", remaining_space);
+ be_emit_irprintf("\t.space\t%d\n", remaining_space);
}
}
if (tv == NULL) {
panic("Couldn't get numeric value for bitfield initializer");
}
+ tv = tarval_convert_to(tv, get_type_mode(type));
/* normalize offset */
vals += offset_bits >> 3;
* In the worst case, every initializer allocates one byte.
* Moreover, initializer might be big, do not allocate on stack.
*/
- vals = xcalloc(size, sizeof(vals[0]));
+ vals = XMALLOCNZ(normal_or_bitfield, size);
#ifndef NDEBUG
glob_vals = vals;
/* a gap */
if (space > 0) {
- be_emit_irprintf("\t.skip\t%d\n", space);
+ be_emit_irprintf("\t.space\t%d\n", space);
be_emit_write_line();
}
}
* In the worst case, every initializer allocates one byte.
* Moreover, initializer might be big, do not allocate on stack.
*/
- vals = xcalloc(last_ofs, sizeof(vals[0]));
+ vals = XMALLOCNZ(normal_or_bitfield, last_ofs);
/* collect the values and store them at the offsets */
for (i = 0; i < n; ++i) {
/* a gap */
if (space > 0) {
- be_emit_irprintf("\t.skip\t%d\n", space);
+ be_emit_irprintf("\t.space\t%d\n", space);
be_emit_write_line();
}
}
dump_compound_init(env, ent);
break;
default:
- assert(0);
+ panic("Unimplemented type kind in dump_global()");
}
}
}