Merge commit '556c60f4f27e2a3bfde6a47acf876716ea8d5795'
* commit '556c60f4f27e2a3bfde6a47acf876716ea8d5795':
Correctly compute the type of an assignment expression.
This change enables following types of statements to work correctly:
a = b = 3;
if ((a = getchar()) < 0) { ... }
This fixes 2232082 acc: assignment in comparison segfaults
Now you can say:
#define A B
#define B C
#define C 4
int x = A;
And it will work as expected.
Print an error message rather than assert when we're expecting a
function value, but don't find one.
to function defined in libdl.so but the library is missing the linker commands.
Currently, the library is linked via dependency of another library. While this
works, it is not the right thing to do.
We had been arbitrarily swallowing the next token, even if it wasn't
the one we were expecting. Now we only swallow it if it _is_ the one
we were expecting.
This script copies the test file over to the ARM, runs the acc compiler
on ARM, and then prints out the results.
It also syncs the acc compiler binary over to the ARM.
Implement some optimizations:
+ performing arithmetic by a small constant is 3 instructions shorter.
+ reading a local variables is 1 instruction shorter.
+ constant array indexing (e.g. p[5]) is 5 instructions shorter.
Until now the address operator only worked with simple variables.
Now it works with arbitrary expressions (that are lvalues or function
names). So for example this now works:
struct S { int a[10]};
int f(struct S* p) {
return &p->a[3];
}
For example, this now works:
#define A (1 + 2)
Note that we still don't support defines with argument lists, so this is
still illegal:
#define A(X) (X + 2)
Also in this change: The compiler test script allows command-line
arguments to disable testing on ARM and to disable testing the output
of the old OTCC compiler.
Disabling testing on ARM is handy for developing front-end code when no
device or emulator is available.
Disabling testing OTCC output is handy for some 64-bit Linux environments,
because the original OTCC needs some tweaking to be fully compatible, and
I don't have time to investigate this problem right now.
This is another step towards being able to handle lval / rvals.
Improved storeR0ToTOS to convert R0 to the proper type to store into
*TOS. (This is something that storeR0 was already doing.)
Removed storeR0 as it is no longer being used.