aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/compile-i386.c
diff options
authorJeff Garzik <jgarzik@redhat.com>2003-09-07 22:29:33 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:01:05 -0700
commitc95635f1310e95b2d12758dc1ddcda80e3d4e685 (patch)
tree7c1a3d7c87d1ac954f325aeb51fc9928636a312a /compile-i386.c
parente56db31bb6dec8c5e112d1d7ff2563ddae2fd7fd (diff)
downloadsparse-dev-c95635f1310e95b2d12758dc1ddcda80e3d4e685.tar.gz
[be] calculate offset of func args on stack correctly
And remove code warning people it's wrong, as it should no longer be.
Diffstat (limited to 'compile-i386.c')
-rw-r--r--compile-i386.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/compile-i386.c b/compile-i386.c
index eb22fc3a..a48589f2 100644
--- a/compile-i386.c
+++ b/compile-i386.c
@@ -180,7 +180,7 @@ static inline unsigned int arg_offset(struct storage *s)
return 123456; /* intentionally bogus value */
/* FIXME: this is wrong wrong wrong */
- return (current_func->pseudo_nr + 1) * 4;
+ return (current_func->pseudo_nr + 1 + s->idx) * 4;
}
static const char *pretty_offset(int ofs)
@@ -211,21 +211,6 @@ static void stor_sym_init(struct symbol *sym)
stor->sym = sym;
}
-/* we don't yet properly locate arguments on the stack. we generate
- * an offset based on the stack frame at the time the argument is
- * referenced, which is incorrect, because the stack frame pointer
- * may change after that point, and before the end of the function.
- */
-static const char *stor_arg_warning(struct storage *s)
-{
- static const char warning[32] = "stack offset WRONG!";
-
- if (s->type != STOR_ARG)
- return NULL;
-
- return warning;
-}
-
static const char *stor_op_name(struct storage *s)
{
static char name[32];
@@ -554,7 +539,7 @@ static void emit_func_post(struct symbol *sym, struct storage *ret_val)
/* function prologue */
if (ret_val)
- insn("movl", ret_val, REG_EAX, stor_arg_warning(ret_val), 0);
+ insn("movl", ret_val, REG_EAX, NULL, 0);
val = new_storage(STOR_VALUE);
val->value = (long long) (pseudo_nr * 4);
@@ -778,10 +763,10 @@ static void emit_move(struct expression *dest_expr, struct storage *dest,
/* FIXME: Bitfield move! */
/* FIXME: pay attention to arg 'bits' */
- insn("movl", src, REG_EAX, stor_arg_warning(src), 0);
+ insn("movl", src, REG_EAX, NULL, 0);
/* FIXME: pay attention to arg 'bits' */
- insn("movl", REG_EAX, dest, stor_arg_warning(dest), 0);
+ insn("movl", REG_EAX, dest, NULL, 0);
}
static void emit_store(struct expression *dest_expr, struct storage *dest,
@@ -941,9 +926,7 @@ static void emit_if_conditional(struct statement *stmt)
val = x86_expression(cond);
/* load 'if' test result into EAX */
- insn("movl", val, REG_EAX,
- stor_arg_warning(val) ? stor_arg_warning(val) :
- "begin if conditional", 0);
+ insn("movl", val, REG_EAX, "begin if conditional", 0);
/* clear ECX */
insn("xorl", REG_ECX, REG_ECX, NULL, 0);
@@ -1292,7 +1275,6 @@ static struct storage *x86_call_expression(struct expression *expr)
/* FIXME: pay attention to 'size' */
insn("pushl", new, NULL,
- stor_arg_warning(new) ? stor_arg_warning(new) :
!framesize ? "begin function call" : NULL, 0);
framesize += size >> 3;