Nick Downing [Thu, 6 Jun 2019 13:15:45 +0000 (23:15 +1000)]
Rough changes to add a cpmz80 platform, and an experiment with building from shell script not lua
David Given [Sat, 23 Mar 2019 11:31:32 +0000 (12:31 +0100)]
Merge pull request #183 from kernigh/kernigh-include
Include headers to declare functions
George Koehler [Fri, 22 Mar 2019 19:15:40 +0000 (15:15 -0400)]
Include more headers to declare functions.
This causes clang to give fewer warnings of implicit declarations of
functions.
In mach/pdp/cv/cv.c, rename wr_int2() to cv_int2() because it
conflicts with wr_int2() in <object.h>.
In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK
for access() in <unistd.h>.
George Koehler [Fri, 22 Mar 2019 18:35:07 +0000 (14:35 -0400)]
Raise _XOPEN_SOURCE from 500 to 700
In OpenBSD, _XOPEN_SOURCE 500 forces _POSIX_C_SOURCE down to 199506,
which hides the declarations of openat() and fdopendir() and causes
compiler warnings.
Don't set _POSIX_C_SOURCE, because _XOPEN_SOURCE may set
_POSIX_C_SOURCE to a different value.
George Koehler [Fri, 22 Mar 2019 18:19:02 +0000 (14:19 -0400)]
Include <fcntl.h> or <unistd.h>
This silences some clang warnings of implicit declarations of
functions. The `register int` silences a warning of implicit int.
George Koehler [Fri, 22 Mar 2019 18:09:50 +0000 (14:09 -0400)]
Use %zu to print size_t count
This silences a compiler warning.
George Koehler [Fri, 22 Mar 2019 17:18:07 +0000 (13:18 -0400)]
Include <unistd.h> for lseek()
This unbreaks my build in OpenBSD. The old `long lseek()` conflicts
with `off_t lseek()` in OpenBSD headers, because long and off_t are
different types. Commit
b4df26e caused "system.h" to include some
headers where OpenBSD declares lseek().
Manuals for lseek() say to #include <unistd.h>. Do so to be portable
to systems where other headers don't declare lseek().
David Given [Wed, 20 Mar 2019 14:53:22 +0000 (15:53 +0100)]
Merge pull request #181 from ccodere/carl-ansi-part1
More ANSI C conversion
carl [Sun, 17 Mar 2019 15:19:16 +0000 (23:19 +0800)]
* Bugfix of "rename" across volumes, now simply copies the file instead.
carl [Sun, 17 Mar 2019 14:42:58 +0000 (22:42 +0800)]
Try to update frontend driver.
carl [Sun, 17 Mar 2019 14:42:20 +0000 (22:42 +0800)]
+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:42:10 +0000 (22:42 +0800)]
+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:42:00 +0000 (22:42 +0800)]
+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:41:25 +0000 (22:41 +0800)]
+ ANSI C conversion
carl [Sun, 17 Mar 2019 14:25:47 +0000 (22:25 +0800)]
+ Make it build with troff
carl [Sun, 17 Mar 2019 14:24:54 +0000 (22:24 +0800)]
+ Have the DEBUG version compile
carl [Sun, 17 Mar 2019 14:23:56 +0000 (22:23 +0800)]
+ Add sys_tmpnam() and sys_basename()
carl [Sun, 17 Mar 2019 14:23:18 +0000 (22:23 +0800)]
Addition of tmpnam system function.
carl [Sun, 17 Mar 2019 14:22:29 +0000 (22:22 +0800)]
+ Have the DEBUG version compile
carl [Sun, 17 Mar 2019 14:22:19 +0000 (22:22 +0800)]
Better type checking on function callback.
David Given [Mon, 11 Mar 2019 16:00:12 +0000 (17:00 +0100)]
Merge pull request #177 from davidgiven/dtrg-8080
i80: Better peephole optimiser rules
David Given [Mon, 11 Mar 2019 13:50:30 +0000 (13:50 +0000)]
Don't buffer overflow when trying to process source bytes with the high bit
set.
David Given [Fri, 8 Mar 2019 22:06:34 +0000 (23:06 +0100)]
Add a 'kill' pseudoinstruction to the 8080 assembler, which marks when the code
generator is finished with a register; use this to create some more effective
peephole optimiser rules.
David Given [Thu, 7 Mar 2019 19:51:08 +0000 (20:51 +0100)]
Merge pull request #174 from ccodere/carl-ansi-part1
Carl ansi part1
carl [Fri, 1 Mar 2019 17:41:01 +0000 (01:41 +0800)]
+ Better type checking in function tables.
carl [Fri, 1 Mar 2019 17:39:25 +0000 (01:39 +0800)]
+ M2 Compiler ISO C90 compatibility
* Fixing of potential crash issue with function tables in compiler.
+ SYSTEM.h is now renamed to SYSTEMM2.h to avoid conflicts on non case sensitive filesystems.
carl [Fri, 1 Mar 2019 17:36:11 +0000 (01:36 +0800)]
CPP ISO C90 compatibility and conversion.
carl [Fri, 1 Mar 2019 17:35:09 +0000 (01:35 +0800)]
Basic compiler is now ISO C90 compliant.
David Given [Mon, 25 Feb 2019 22:23:04 +0000 (23:23 +0100)]
Merge pull request #173 from ccodere/carl-ansi-part1
Carl ansi part1
carl [Mon, 25 Feb 2019 16:46:10 +0000 (00:46 +0800)]
Fix issue again with wrong macro on error.
carl [Mon, 25 Feb 2019 16:44:52 +0000 (00:44 +0800)]
* Fix more tabs.
carl [Sat, 23 Feb 2019 17:15:23 +0000 (01:15 +0800)]
* Convert spaces -> tabs to keep consistency with existing code.
carl [Sat, 23 Feb 2019 16:46:05 +0000 (00:46 +0800)]
* Remove some more compiler warnings.
carl [Sat, 23 Feb 2019 16:45:35 +0000 (00:45 +0800)]
Bugfix of fprint using correct output redirection (fix from last commit).
carl [Sat, 23 Feb 2019 16:44:50 +0000 (00:44 +0800)]
Pascal compiler better type checking and function declarations (Better ISO C compatibility)
David Given [Wed, 20 Feb 2019 18:36:49 +0000 (19:36 +0100)]
Merge pull request #172 from ccodere/carl-ansi-part1
Carl ansi part1
carl [Wed, 20 Feb 2019 16:43:49 +0000 (00:43 +0800)]
Remove unused variable.
carl [Wed, 20 Feb 2019 16:43:04 +0000 (00:43 +0800)]
Remove CMake changes and generic sed scripts so they are move to a separate branch.
carl [Tue, 19 Feb 2019 16:44:32 +0000 (00:44 +0800)]
* Was trying to use the new system API which is not ready causing stack issues.
carl [Tue, 19 Feb 2019 16:32:19 +0000 (00:32 +0800)]
+ Add missing files.
carl [Mon, 18 Feb 2019 16:48:21 +0000 (00:48 +0800)]
+ Add topgen
carl [Mon, 18 Feb 2019 16:44:39 +0000 (00:44 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
carl [Mon, 18 Feb 2019 16:44:19 +0000 (00:44 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
.
carl [Mon, 18 Feb 2019 16:42:15 +0000 (00:42 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Scripts to generate compiler header is now sed based.
carl [Mon, 18 Feb 2019 16:40:51 +0000 (00:40 +0800)]
+ Addition of scripts to generate compiler include files.
carl [Mon, 18 Feb 2019 16:39:39 +0000 (00:39 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
carl [Mon, 18 Feb 2019 16:39:05 +0000 (00:39 +0800)]
Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
- Remove support for generating K&R code.
- Remove mkstemp and replace by tmpnam (more portable but less safe)
carl [Mon, 18 Feb 2019 16:37:52 +0000 (00:37 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
carl [Mon, 18 Feb 2019 16:37:26 +0000 (00:37 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:37:11 +0000 (00:37 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:36:48 +0000 (00:36 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
+ Added support for sys_tmpdir for better portability.
carl [Mon, 18 Feb 2019 16:35:32 +0000 (00:35 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:35:24 +0000 (00:35 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
carl [Mon, 18 Feb 2019 16:35:01 +0000 (00:35 +0800)]
* Add missing header file.
carl [Mon, 18 Feb 2019 16:34:44 +0000 (00:34 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:34:24 +0000 (00:34 +0800)]
* Adapt to new sys_filesize prototype.
carl [Mon, 18 Feb 2019 16:34:03 +0000 (00:34 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:33:54 +0000 (00:33 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h (TMPDIR is no longer hard coded)
carl [Mon, 18 Feb 2019 16:33:21 +0000 (00:33 +0800)]
* Initial support of CMake
+ Generation of header files is now made through a C program to make it more portable.
carl [Mon, 18 Feb 2019 16:32:48 +0000 (00:32 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
carl [Mon, 18 Feb 2019 16:32:17 +0000 (00:32 +0800)]
* Initial support of CMake
carl [Mon, 18 Feb 2019 16:31:58 +0000 (00:31 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
carl [Mon, 18 Feb 2019 16:31:29 +0000 (00:31 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
carl [Mon, 18 Feb 2019 16:30:47 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
* Adapt to new sys_filesize prototype.
carl [Mon, 18 Feb 2019 16:30:35 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
* Adapt to new sys_filesize prototype.
carl [Mon, 18 Feb 2019 16:30:01 +0000 (00:30 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
carl [Mon, 18 Feb 2019 16:29:42 +0000 (00:29 +0800)]
Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
+ Convert to sed scripts some shell scripts for better portability.
+ Reduce usage of em_path.h
David Given [Mon, 18 Feb 2019 10:04:23 +0000 (11:04 +0100)]
Fix typo.
David Given [Sun, 17 Feb 2019 09:09:22 +0000 (10:09 +0100)]
Minor improvements to the way types are expanded (should avoid embarassing ands
with 0xff).
David Given [Sat, 16 Feb 2019 00:23:27 +0000 (01:23 +0100)]
Merge pull request #171 from davidgiven/dtrg-comparisons
i80: a few more minor fixes
David Given [Sat, 16 Feb 2019 00:18:31 +0000 (01:18 +0100)]
Add a few minor top optimisations.
David Given [Sat, 16 Feb 2019 00:18:21 +0000 (01:18 +0100)]
Fix typo where I was confusing sbi and sui, with hilarious results.
David Given [Fri, 15 Feb 2019 22:56:00 +0000 (23:56 +0100)]
Merge pull request #170 from davidgiven/dtrg-i169
Fix driver crash when using -R
David Given [Fri, 15 Feb 2019 22:40:42 +0000 (23:40 +0100)]
Fix memory corruption when using -R; the values being stored in the list
weren't freeable when they should have been.
David Given [Fri, 15 Feb 2019 22:24:10 +0000 (23:24 +0100)]
Reformat before editing.
David Given [Fri, 15 Feb 2019 22:12:12 +0000 (23:12 +0100)]
Merge pull request #168 from davidgiven/dtrg-i167
i80: fix large stack frames
David Given [Fri, 15 Feb 2019 22:03:01 +0000 (23:03 +0100)]
Loading large constants now computes the stack offset correctly.
David Given [Fri, 15 Feb 2019 22:01:33 +0000 (23:01 +0100)]
Generate the proper function prologues for big stack frames.
David Given [Fri, 15 Feb 2019 21:54:13 +0000 (22:54 +0100)]
Merge pull request #166 from davidgiven/dtrg-comparisons
i80: grabbag of optimisations
David Given [Fri, 15 Feb 2019 21:26:14 +0000 (22:26 +0100)]
Cleanup.
David Given [Fri, 15 Feb 2019 21:20:07 +0000 (22:20 +0100)]
Add rules for converting smallnconst2 and smallpconst2 to registers, to stop
the conversion from happening via the stack. Star Trek goes from 39450 to 39384
bytes.
David Given [Fri, 15 Feb 2019 20:38:17 +0000 (21:38 +0100)]
Using regpair instead of hl_or_de is not, in fact, safe until we've stopped
using bc.
David Given [Fri, 15 Feb 2019 20:30:27 +0000 (21:30 +0100)]
Fix nearly all the comparisons, a lot of which were broken. Using a rst for
unsigned comparisons is surprisingly not that useful due to marshalling
overhead; it's only four bytes to do inline (plus jc), or six for a constant.
Also add some useful top optimisations. Star Trek goes from 39890 to 39450
bytes.
David Given [Thu, 14 Feb 2019 23:38:39 +0000 (00:38 +0100)]
Call cmps rather than cmpu for bge... make cmps and cmpu rsts. Apply various
other tiny optimisations.
David Given [Thu, 14 Feb 2019 22:57:55 +0000 (23:57 +0100)]
Use nicely optimised helper tools to do signed comparisons of words. Star Trek
goes from 40452 to 39890 bytes.
David Given [Thu, 14 Feb 2019 22:29:41 +0000 (23:29 +0100)]
Merge pull request #165 from davidgiven/dtrg-b164
i80: fix bad code in inl using faddrn
David Given [Thu, 14 Feb 2019 22:21:47 +0000 (23:21 +0100)]
Fix bad helper tool invocation for inl with faddrn.
David Given [Thu, 14 Feb 2019 22:19:11 +0000 (23:19 +0100)]
Add failing test case.
David Given [Wed, 13 Feb 2019 23:13:41 +0000 (00:13 +0100)]
Merge pull request #163 from davidgiven/dtrg-regmoves
i80: fix pathological behaviour in asp
David Given [Wed, 13 Feb 2019 23:05:08 +0000 (00:05 +0100)]
Turns out that every time the compiler tried to do a stack retraction with asp,
it would flush registers onto the stack. This stops it doing this. Star Trek
goes from 40779 to 40452 bytes.
David Given [Wed, 13 Feb 2019 21:56:18 +0000 (22:56 +0100)]
Merge pull request #161 from davidgiven/dtrg-faststack
i80: use helper functions for stack access
David Given [Wed, 13 Feb 2019 21:46:00 +0000 (22:46 +0100)]
Merge from default.
David Given [Wed, 13 Feb 2019 21:45:22 +0000 (22:45 +0100)]
Instead of using parameterised rsts for stack access, add a huge swathe of
automatically built helper tools. Star Trek goes up from 40243 to 40779 bytes,
but should be a lot faster.
David Given [Wed, 13 Feb 2019 21:42:05 +0000 (22:42 +0100)]
Don't do weird things if files starting with a hyphen exist in the build
directory.
David Given [Wed, 13 Feb 2019 20:16:06 +0000 (21:16 +0100)]
Merge pull request #160 from davidgiven/dtrg-b159
i80, powerpc, mips: fix issue with logical operations and signed small constants
David Given [Wed, 13 Feb 2019 19:56:10 +0000 (20:56 +0100)]
Fix issue with logical operations and small signed constants which turned out
to affect multiple platforms.
David Given [Wed, 13 Feb 2019 19:10:38 +0000 (20:10 +0100)]
Update test case to provoke bug.
David Given [Tue, 12 Feb 2019 21:29:01 +0000 (22:29 +0100)]
Merge pull request #158 from davidgiven/dtrg-b157
i80: fix bad code in comparisons
David Given [Tue, 12 Feb 2019 21:19:07 +0000 (22:19 +0100)]
Fix bad code generation due to not correctly flushing the stack before
comparisons.
David Given [Tue, 12 Feb 2019 21:08:08 +0000 (22:08 +0100)]
Added a test case for #157.