extract architecture independent gen.c
This is actually the next version of neatcc. Previously, code generation
was done independently for each architecture. That included handling
different instructions, optimizing instructions using immediate, constant
inlining, handling jumps, locals, stack and temporaries, in addition to
a separate optimization patch for each architecture, which was separated
to make the complexity more manageable. I was satisfied with the design
when there were only one architecture, but with three architectures and
an optimization patch for each, things started to look awful.
This patch extracts the architecture-independent gen.c from the old
code generation files. The new layout of neatcc is:
1. cpp.c preprocessing
2. tok.c tokenizing
3. ncc.c parsing
4. gen.c architecture independent code generation and optimization
5. x86.c architecture dependent code generation
6. out.c output executable file
It has many benefits:
* Architecture-dependent files are much shorter and easier to maintain,
so adding new architectures or tweaking instructions for old
architectures are much easier now.
* All architectures are maintained on the same branch; this makes
distributing neatcc as a single package much easier and without
depending on git.
* The architecture-independent gen.c now leaves a lot of room for
optimizations. neatcc's two pass optimization, which used to be a hack
and left as a separate patch, is now an effective optimization method.
A lot of improvements are possible.
16 files changed: