Commit Graph

5 Commits

Author SHA1 Message Date
Adam Sampson
dfefcdfd41 Refactor AnalyseAsm to use a state monad.
This makes the code quite a bit cleaner, and since it can keep track of which
functions it's already analysed it goes a lot quicker on big files.
2007-08-22 00:11:20 +00:00
Adam Sampson
6f00d4f4a7 Make the label regex more specific.
This makes it only generate legal labels in the .post.c file.
2007-08-21 22:19:54 +00:00
Adam Sampson
bd44a1c748 Add a few bytes of stack to every function.
This also makes sure that every function gets a stack size constant.

There are some functions which don't do any stack adjustment -- where GCC's
smart enough to just compile them to a "ret" (because it knows it needs a
function pointer, but also that the function does nothing). CCSP doesn't like
it when you ask for a stack size of 0; I haven't yet investigated why, but this is likely to change anyway once Carl's changes go into CCSP trunk.
2007-08-21 22:06:21 +00:00
Adam Sampson
c8d5a4ff40 Add licensing information.
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.

(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
2007-08-18 20:42:11 +00:00
Adam Sampson
6047836456 Add a first shot at the assembly analyser, and make GenerateC use it.
This does about the minimum necessary for assembly analysis to work. It assumes
that any function it hasn't been able to analyse itself needs 512 bytes (most
need far less); it doesn't do any flow analysis; it doesn't do a lot of sanity
checking. However, it produces sensible numbers, and works with the demos I've
tried so far.

I was originally going to make this a separate tool, but there are a number of
bits of the code can be nicely reused, so it's a separate "operating mode" in
the existing program (as is parse-only mode now).
2007-08-08 19:39:47 +00:00