-- Debug stack offsets
-- Get code generation working and suiting things like as09
- Write some copt rules to stop the output sucking so much
- Steal the rst tricks done by BDS C
- Output mixed code/data so we can flush the literal pool every line of asm
and maybe even get rid of the literal pool (2.5K saving)
- Can we split the preprocessor optionally
-- Work out what is needed for stack frame based Z80 and 6809 code
-
-Easy small C fixups worth doing in passing
-- \x and \001 style escapes
+- Work out what is needed for stack frame based Z80 code
return newstkp;
}
+/* FIXME */
+int gen_defer_modify_stack(int newstkp)
+{
+ return gen_modify_stack(newstkp);
+}
+
+
/**
* multiply the primary register by INTSIZE
*/
output_with_tab ("fdb ");
}
+static int defer;
+
/**
* modify the stack pointer to the new value indicated
* @param newstkp new value
int gen_modify_stack(int newstkp) {
int k;
- k = newstkp - stkp;
+ k = newstkp - stkp + defer;
+ defer = 0;
if (k == 0)
return (newstkp);
output_with_tab("leas ");
return (newstkp);
}
+/**
+ * modify the stack pointer to the new value indicated, but
+ * allow the change to be deferred
+ */
+
+int gen_defer_modify_stack(int newstkp)
+{
+ defer += newstkp - stkp;
+ return newstkp + defer;
+}
+
/**
* multiply the primary register by INTSIZE
*/
return (newstkp);
}
+/* FIXME */
+int gen_defer_modify_stack(int newstkp)
+{
+ return gen_modify_stack(newstkp);
+}
+
+
/**
* multiply the primary register by INTSIZE
*/
return (newstkp);
}
+/* FIXME */
+int gen_defer_modify_stack(int newstkp)
+{
+ return gen_modify_stack(newstkp);
+}
+
/**
* multiply the primary register by INTSIZE
*/
return (newstkp);
}
+/* FIXME */
+int gen_defer_modify_stack(int newstkp)
+{
+ return gen_modify_stack(newstkp);
+}
+
/**
* multiply the primary register by INTSIZE
*/
if (find_locale(an) > -1)
multidef(an);
else {
+ /* FIXME: struct */
add_local(an, 0, 0, argstk, AUTO);
argstk = argstk + INTSIZE;
}
ptr = ptr - 1;
address = symbol_table[ptr].offset;
symbol_table[ptr].offset = address + INTSIZE;
+ /* Struct etc FIXME */
}
}
} else {
extern void gen_def_byte(void);
extern void gen_def_storage(void);
extern void gen_def_word(void);
+extern int gen_defer_modify_stack(int newstkp);
extern int gen_modify_stack(int newstkp);
extern void gen_multiply_by_two(void);
extern void gen_divide_by_two(void);
if (input_eof)
return;
if (decls) {
- if (!statement_declare ())
+ if (!statement_declare ()) {
+ /* Any deferred movement now happens */
+ gen_modify_stack(stkp);
decls = NO;
+ }
} else
do_statement ();
}
/* FIXME: do one gen_modify_stack at the end and
some kind of align method here */
if (stclass != LSTATIC) {
- stkp = gen_modify_stack(stkp - k);
+ stkp = gen_defer_modify_stack(stkp - k);
add_local(sname, j, typ, stkp, AUTO);
} else
add_local(sname, j, typ, k, LSTATIC);