This removes unnecessary movn, movf, lds, and a few other instructions.
Any instructions that has not side effects and writes to a slot that
isn't used can be removed. A number of other optimizations can follow
from this:
- Implement the def-aliasing-var optimization better
- This function can be iterated as a fix point until no more
instructions are removed.
- If we implement slot renaming, then we no longer need to free slots
and can simplify the initial code generation a lot.
Building janet requires janet_boot to be run on the host at build time;
- $(UNAME) can now be overridden from the make cmdline
- Added $(RUN) variable to allow a emulator to be specified
- Added ".exe" extension to binaries when using MINGW
Examples:
Cross compiling for win32 and running under wine:
```
make test \
CC=i686-w64-mingw32-gcc \
LD=i686-w64-mingw32-gcc \
UNAME=MINGW \
RUN=wine
Janet 1.27.0-ad7c3bed mingw/x86/gcc - '(doc)' for help
```
Cross compiling for aarch64 and running under qemu:
```
make repl \
CC=aarch64-none-linux-gnu-gcc \
LD=aarch64-none-linux-gnu-gcc \
RUN="qemu-aarch64 -L /tmp/aarch64/"
Janet 1.27.0-ad7c3bed linux/aarch64/gcc - '(doc)' for help
```
This allows a configuration workflow that is a bit simpler than before
and doesn't requiring applying patches. Instead, add a config.mk to
source dir with JANETCONF_HEADER=myconfig.h and compile as usual.
The patching workflow will of course still work exactly as before.
When using make to build an rpm, the current symlink is
created with an absolute path to the buildroot as causes
the make install target to fail with:
error: Symlink points to BuildRoot: /usr/include/janet.h -> /home/stephen/rpmbuild/BUILDROOT/janet-1.23.0-3.x86_64/usr/include/janet/janet.h
We can create the link relatively which makes this more
portable, where:
ln -sf -t '/home/stephen/rpmbuild/BUILDROOT/janet-1.23.0-3.x86_64/usr/include' janet.h janet/janet.h
Resulting in the following symlink:
ls -la BUILDROOT/usr/include/janet.h
lrwxrwxrwx. 1 stephen stephen 13 Jul 2 08:17 BUILDROOT/usr/include/janet.h -> janet/janet.h
This symlink can then be properly packaged without path
issues.
Signed-off-by: Stephen Hassard <steve@hassard.net>
Add support for integer return and floating point return variants, as
well as arguments on the stack. Start flushing out struct arguments.
Still needed:
- structs (packed and unpacked)
- complex numbers
- long doubles
- MASM alternative for windows (you can technically use sysv abi on
windows)
- more calling conventions.