- Update license text (remove irrelevant FreeBSD references)
- Update root readme.txt
- Improve prologue/epilogue generation
Don't generate unnecessary jumps back and forth to/from
"sub sp, size_of_locals".
Instead, with the help of fgetpos()/fsetpos()
initially write ";sub sp, 0" and then, when
the size is finally known, go back and overwrite it with
" sub sp, size_of_locals".
gcc 5.0 defaults to -std=gnu11 meaning code which relies on implicit
ints will no longer compile. Passing -std=gnu89 restores the default
but causes problems because the system headers are written in gnu11.
Using -idirafter instead of -nostdinc resolves all problems and should
be compatible with old GCC versions (and clang).
- type specifiers may occur in any order
(e.g. "unsigned short int" and "int short unsigned")
- use .rodata/.rdata section for string literals
- arbitrary length string literals (hooray!)
- better concatenation of adjacent string literals
(now works even across preprocessor directives)
Support .bss section
- -nobss option in smlrc: use .data instead of .bss as before
- take advantage of .bss in smlrc (put a large array into it)
Remove dead/useless code
Remove useless/rarely used features/options:
-use-gp (MIPS)
-flat16/-flat32 (x86)
-seg16t (x86), -seg16 is now the default
-ctor-fxn
Add/change:
- use EXIT_FAILURE=1 instead of -1 in smlrc when aborting
due to an error
- properly sign-/zero-extend returned values, e.g. the following
function must return 255 and not -1:
unsigned char f(void) { return -1; }
- properly decay arrays on the left side of ->, e.g. the following must
compile:
{
struct {char c;} s[1];
s[0].c = 'a'; putchar(s[0].c);
(s+0)->c = 'b'; putchar(s[0].c);
(*s).c = 'c'; putchar(s[0].c);
s->c = 'd'; putchar(s[0].c);
putchar('\n');
}
Also:
- support structure passing/returning by value (x86 only)
Improvements:
- use registers more efficiently
- eliminate some register copies and stack manipulations
- promote left operands to right immediate operands
- improve simple assignments to auto/static vars
- use bltz, blez, bgtz, bgez
- change mul/divu (by powers of 2) to sll/srl/and
- use seb, seh for sign extension instead of sll/sra
- overall generate a bit tighter, faster and more readable asm code
Fixes:
- >>= should be unsigned when the left operand is unsigned int.
The right operand isn't important here.
- very subtle bug in e.g. void f(){int a; &a+1;/*wrong value of &a+1*/}
Other:
- include stdarg.c and skeleton.c in /share/example/Makefile