Commit 9ab25678 authored by Sebastian Hack's avatar Sebastian Hack
Browse files

Fixed some bugs

parent 4d7d203e
......@@ -30,6 +30,7 @@
#include "irnode_t.h"
#include "ircons_t.h"
#include "irprintf.h"
#include "irgwalk.h"
#include "be_t.h"
#include "belive_t.h"
......@@ -732,19 +733,26 @@ entity *be_get_spill_entity(const ir_node *irn)
return NULL;
}
static void entity_copy_walker(ir_node *irn, void *data)
static void link_reload_walker(ir_node *irn, void *data)
{
ir_node **root = (ir_node **) data;
if(be_is_Reload(irn)) {
be_frame_attr_t *a = get_irn_attr(irn);
entity *ent = be_get_spill_entity(irn);
a->ent = ent;
set_irn_link(irn, *root);
*root = irn;
}
}
void be_copy_entities_to_reloads(ir_graph *irg)
{
irg_walk_graph(irg, entity_copy_walker, NULL, NULL);
ir_node *irn = NULL;
irg_walk_graph(irg, link_reload_walker, NULL, (void *) &irn);
while(irn) {
be_frame_attr_t *a = get_irn_attr(irn);
entity *ent = be_get_spill_entity(irn);
a->ent = ent;
irn = get_irn_link(irn);
}
}
ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn, ir_node *ctx)
......@@ -774,8 +782,10 @@ ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn, ir_node *ctx)
* Here's one special case:
* If the spill is in the start block, the spill must be after the frame
* pointer is set up. This is checked here and fixed.
* If the insertion point is already the block, everything is fine, since
* the Spill gets inserted at the end of the block.
*/
if(bl == get_irg_start_block(irg))
if(bl == get_irg_start_block(irg) && insert != bl && sched_comes_after(insert, frame))
insert = sched_next(frame);
sched_add_before(insert, spill);
......
......@@ -207,6 +207,8 @@ static const arch_register_class_t *firm_get_reg_class_for_mode(const void *self
static void firm_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *abi)
{
static ir_type *between_type = NULL;
be_abi_call_flags_t flags;
const arch_register_class_t *cls = &reg_classes[CLS_DATAB];
int i, n;
be_abi_call_flags_t call_flags = { 0, 0, 0, 0, 0 };
......@@ -231,7 +233,8 @@ static void firm_get_call_abi(const void *self, ir_type *method_type, be_abi_cal
be_abi_call_res_reg(abi, i, &cls->regs[i]);
}
be_abi_call_set_flags(abi, call_flags, between_type);
flags.val = 0;
be_abi_call_set_flags(abi, flags, between_type);
}
......
......@@ -315,7 +315,7 @@ static int ia32_const_to_str(lc_appendable_t *app,
buf = get_ia32_am_offs(X);
}
return lc_arg_append(app, occ, buf, strlen(buf));
return buf ? lc_arg_append(app, occ, buf, strlen(buf)) : 0;
}
/**
......@@ -829,7 +829,7 @@ static void ia32_register_emitters(void) {
/* benode emitter */
BE_EMIT(Call);
BE_EMIT(IncSP);
BE_EMIT(AddSP);
// BE_EMIT(AddSP);
/* firm emitter */
EMIT(Jmp);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment