if (get_ia32_frame_ent(irn)) {
ia32_am_flavour_t am_flav = get_ia32_am_flavour(irn);
- /* Pop nodes modify the stack pointer before reading the destination
+ /* Pop nodes modify the stack pointer before calculating the destination
* address, so fix this here
*/
if(is_ia32_Pop(irn)) {
if (get_ia32_op_type(irn) == ia32_Normal) {
set_ia32_cnst(irn, buf);
- }
- else {
+ } else {
add_ia32_am_offs(irn, buf);
am_flav |= ia32_O;
set_ia32_am_flavour(irn, am_flav);
if(is_ia32_Push(pred) && proj == 0)
return 4;
- else if(is_ia32_Pop(pred) && proj == 1)
+ if(is_ia32_Pop(pred) && proj == 1)
return -4;
}
*/
char *get_ia32_am_offs(const ir_node *node) {
ia32_attr_t *attr = get_ia32_attr(node);
- char *res = NULL;
+ static char res[64];
if (! attr->am_offs) {
return NULL;
}
- res = obstack_alloc(get_irg_obstack(get_irn_irg(node)), 64);
- snprintf(res, 64, "%+ld", attr->am_offs);
+ snprintf(res, sizeof(res), "%+ld", attr->am_offs);
return res;
}
if (! offset || strlen(offset) < 1)
return;
- sscanf(offset, "%d", &o);
+ assert(sscanf(offset, "%d", &o) == 1);
if (op == '-')
attr->am_offs -= o;
else if (op == '+')
- attr->am_offs -= o;
+ attr->am_offs += o;
else
assert(0);
}
/* base is an constant address */
if (is_imm) {
- if (get_ia32_immop_type(ptr) == ia32_ImmSymConst) {
+ if (get_ia32_op_type(ptr) == ia32_SymConst) {
set_ia32_am_sc(new_op, get_ia32_id_cnst(ptr));
am_flav = ia32_am_N;
}