ref: 3ed9d43d93fa78ca837f4e282c88a6538b3fa064
parent: 9ef821cee1ddc8419dd44a11e9dfcee2ab0d0837
author: Ori Bernstein <[email protected]>
date: Sat Jul 28 21:45:27 EDT 2012
Align the stack.
--- a/8/simp.c
+++ b/8/simp.c
@@ -60,14 +60,6 @@
static Type *tyword;
static Type *tyvoid;
-static int max(int a, int b)
-{
- if (a > b)
- return a;
- else
- return b;
-}
-
static Type *base(Type *t)
{
assert(t->nsub == 1);
@@ -202,19 +194,6 @@
return s;
}
-static size_t min(size_t a, size_t b)
-{
- if (a < b)
- return a;
- else
- return b;
-}
-
-static size_t align(size_t sz, size_t align)
-{
- return (sz + align - 1) & ~(align - 1);
-}
-
size_t tysize(Type *t)
{
size_t sz;
@@ -1203,7 +1182,7 @@
fn = zalloc(sizeof(Func));
fn->name = strdup(name);
fn->isexport = export;
- fn->stksz = s->stksz;
+ fn->stksz = align(s->stksz, 8);
fn->locs = s->locs;
fn->ret = s->ret;
fn->cfg = cfg;