Doesn't add any new capabilities, but we now generate error
messages if you attempt casts we don't support,
and we also found and fixed some bugs in declaration parsing.
+ Tokens are now simple IDs, rather than ids or maybe pointers.
+ We can now allocate data that's freed automatically when
compilation end or when a block goes out of scope.
+ Renamed our Array utility class to Vector, and made its
api work a little more like the STL vector template class.
Until now we faked local variables -- they only worked correctly if
there was no overlap between local variables and global variables.
Use a symbol table stack instead of a string list.
Fix bug with looking up undefined symbols.
It makes it harder to deal with memory allocation.
Also fix bug in the otcc-ansi.c test, where the wrong part of the
code buffer was being mprotected, so that if the code buffer happened
to be allocated across a page boundary, some code would no receive
execute permission.
Set execute permission on code before running it.
Handle negative relative offsets for global variables.
Add printfs to report the progress of nested compiles.
Change way we detect whether we can run the host compiler
or not. We used to check if we were running on a 32-bit
Linux. Now we check if the executable is a 32-bit Linux
executable.
main(argc, argv) --> int main(int argc, char** argv)
Although we accept int, void, and char types, and pointers to same,
we actually still treat everything as an int.
The ACC compiler used to be able to compile itself. This was a neat
feature, but because ACC only supports ints, pointers are stored as
ints, and cast to pointers when used.
This checkin turns many ints that are really pointers back into
pointers, so that the code is clearer.
int ch;
char* glo;
char* sym_stack;
char* dstk;
char* dptr;
int dch;
char* last_id;
Document internal CodeGenerator interface
Move license to a separate license file.
Define a public API for calling libacc.
Update the "acc" test program to use the public API.
Move "main.cpp" and test scripts into the tests subdirectory.
Move test data from tests to tests/data
Remove stale test data.
If libacc is built on x86, then x86 is the default code generator.
If libacc is built on arm. then ARM is the default code generator
And so on for future architectures.
The 64-bit x64 machine has no working code generator currently.
We may add one to support the simulator builds.
Improved the test program so we don't try to run tests if the
compile failed. Also avoid running tests that don't work on
a given platform.
Collapsed the inc/dec codegen into the loadEAX function, because it
allows us to generate better code for inc/dec'ing a global variable
on ARM, because we don't have to load the variable's address twice.
Added C++-style "//..end-of-line" comments, since I kept trying to use them when writing
test programs.
The biggest known missing piece is global variables.
+ Improved li to handle all 32-bit values.
+ Implemented push/pop of temp registers during evaluation
+ Implemented the unary and binary easy math operators (+,-,*,<<,>>,|,&,^,~)
+ Implemented global function calling.
This program works:
main() { return 42; }
The disassembler was borrowed from codeflinger, and just modified enough to compile
under C++ without warnings.
Implemented gsym
Implemented a hack verison of li, only works for -256..255
Implemented gjmp
+ Changed indentation, causes the stats to say there's a lot of lines changed.
+ Should be able to compile multiple times with the same compiler object.
+ Create a CodeBuffer class to hold the code.
+ Create a CodeGenerator class to encapsulate knowlege of the CPU instruction set.
+ Started filling in the code generator.