projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't ask mode_T node for output register
[libfirm]
/
ir
/
be
/
begnuas.c
diff --git
a/ir/be/begnuas.c
b/ir/be/begnuas.c
index
258b37f
..
0679d60
100644
(file)
--- a/
ir/be/begnuas.c
+++ b/
ir/be/begnuas.c
@@
-24,9
+24,7
@@
* @date 04.11.2005
* @version $Id$
*/
* @date 04.11.2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
-#endif
#include "begnuas.h"
#include "begnuas.h"
@@
-634,19
+632,21
@@
static int ent_is_string_const(ir_entity *ent)
static void dump_string_cst(ir_entity *ent)
{
int i, len;
static void dump_string_cst(ir_entity *ent)
{
int i, len;
+ int output_len;
ir_type *type;
int type_size;
int remaining_space;
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 \"");
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;
ir_node *irn;
int c;
@@
-675,7
+675,7
@@
static void dump_string_cst(ir_entity *ent)
remaining_space = type_size - len;
assert(remaining_space >= 0);
if(remaining_space > 0) {
remaining_space = type_size - len;
assert(remaining_space >= 0);
if(remaining_space > 0) {
- be_emit_irprintf("\t.s
kip
\t%d\n", remaining_space);
+ be_emit_irprintf("\t.s
pace
\t%d\n", remaining_space);
}
}
}
}
@@
-814,6
+814,7
@@
static void dump_bitfield(normal_or_bitfield *vals, size_t offset_bits,
if (tv == NULL) {
panic("Couldn't get numeric value for bitfield initializer");
}
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;
/* normalize offset */
vals += offset_bits >> 3;
@@
-951,7
+952,7
@@
static void dump_initializer(be_gas_decl_env_t *env, ir_entity *entity)
* In the worst case, every initializer allocates one byte.
* Moreover, initializer might be big, do not allocate on stack.
*/
* 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;
#ifndef NDEBUG
glob_vals = vals;
@@
-996,7
+997,7
@@
static void dump_initializer(be_gas_decl_env_t *env, ir_entity *entity)
/* a gap */
if (space > 0) {
/* a gap */
if (space > 0) {
- be_emit_irprintf("\t.s
kip
\t%d\n", space);
+ be_emit_irprintf("\t.s
pace
\t%d\n", space);
be_emit_write_line();
}
}
be_emit_write_line();
}
}
@@
-1040,7
+1041,7
@@
static void dump_compound_init(be_gas_decl_env_t *env, ir_entity *ent)
* In the worst case, every initializer allocates one byte.
* Moreover, initializer might be big, do not allocate on stack.
*/
* 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) {
/* collect the values and store them at the offsets */
for (i = 0; i < n; ++i) {
@@
-1109,7
+1110,7
@@
static void dump_compound_init(be_gas_decl_env_t *env, ir_entity *ent)
/* a gap */
if (space > 0) {
/* a gap */
if (space > 0) {
- be_emit_irprintf("\t.s
kip
\t%d\n", space);
+ be_emit_irprintf("\t.s
pace
\t%d\n", space);
be_emit_write_line();
}
}
be_emit_write_line();
}
}
@@
-1220,14
+1221,21
@@
static void dump_global(be_gas_decl_env_t *env, ir_entity *ent)
be_emit_write_line();
break;
}
be_emit_write_line();
break;
}
- } else if (section == GAS_SECTION_PIC_TRAMPOLINES) {
+ } else if (section == GAS_SECTION_PIC_TRAMPOLINES
+ || section == GAS_SECTION_PIC_SYMBOLS) {
if (be_gas_flavour == GAS_FLAVOUR_MACH_O) {
be_emit_cstring("\t.indirect_symbol ");
be_emit_ident(get_entity_ident(ent));
be_emit_char('\n');
be_emit_write_line();
if (be_gas_flavour == GAS_FLAVOUR_MACH_O) {
be_emit_cstring("\t.indirect_symbol ");
be_emit_ident(get_entity_ident(ent));
be_emit_char('\n');
be_emit_write_line();
- be_emit_cstring("\thlt ; hlt ; hlt ; hlt ; hlt\n");
- be_emit_write_line();
+ if (section == GAS_SECTION_PIC_TRAMPOLINES) {
+ be_emit_cstring("\thlt ; hlt ; hlt ; hlt ; hlt\n");
+ be_emit_write_line();
+ } else {
+ assert(section == GAS_SECTION_PIC_SYMBOLS);
+ be_emit_cstring("\t.long 0\n");
+ be_emit_write_line();
+ }
} else {
panic("PIC trampolines not yet supported in this gas mode");
}
} else {
panic("PIC trampolines not yet supported in this gas mode");
}
@@
-1254,7
+1262,7
@@
static void dump_global(be_gas_decl_env_t *env, ir_entity *ent)
dump_compound_init(env, ent);
break;
default:
dump_compound_init(env, ent);
break;
default:
-
assert(0
);
+
panic("Unimplemented type kind in dump_global()"
);
}
}
}
}
}
}