This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.

[PATCH 0/9] New back end ia16: 16-bit Intel x86

From: Andrew Jenner <andrew at codesourcery dot com>

To: GCC Patches <gcc-patches at gcc dot gnu dot org>

Date: Sat, 1 Apr 2017 17:47:37 +0100

Subject: [PATCH 0/9] New back end ia16: 16-bit Intel x86

Authentication-results: sourceware.org; auth=none

About 10 years ago, Rask Ingemann Lambertsen sent a patch series to add

a 16-bit x86 (i.e. 8088, 8086, 80186 and 80286 CPUs) back end. This work

was never committed. Recently I've been doing some work on this back

end, and today we released a Sourcery CodeBench Lite distribution based

on it (see

). Given this, I thought it would be a good idea to send these patches

upstream today (though obviously if I commit these it won't be until

we're in Stage 1 and more testing has been done on the middle-end changes).

I have not been able to contact Rask Ingemann Lambertsen, but he does

have a copyright assignment for GCC on file (dated 2006-11-16) so I do

not believe there are any copyright assignment issues that would block this.

On top of the original patch, here is what I have done: * Ported to GCC 6.3. * Switched from reload to LRA. * Added C++ support. * Added startup code, BSP and string functions to Newlib. * Improved prologue/epilogue generation. * Implemented stack usage and sibling calls. * Fixed many bugs. * Improved the testsuite to have better support for 16-bit ports.

My intention is to continue to develop this back end. I'm happy to be

maintainer of it as an in-tree port or (if the steering committee does

not want this port in-tree) as an out-of-tree port. I plan to add

further code generation improvements and features including:

* Far pointers. * Support for OMF .obj files and DOS .exe files in binutils. * x87 floating point. * Debugging support.

* More C library functions (to improve compatibility with other DOS

compilers).

Contents of the patch set: 1: Top-level config.sub. 2: The port itself. 3: Documentation. 4: libstdc++ changes. 5: libstdc++ testsuite changes. 6: gcc testsuite changes. 7: ira-color.c fix. 8: subreg_get_info fix. 9: c-family/c-cppbuiltin.c fix. Test results are at https://gcc.gnu.org/ml/gcc-testresults/2017-04/msg00088.html To answer some questions that came up last time the port was submitted:

* This port is only useful for targetting CPUs prior to the 80386. If

you want to generate code for a 32-bit x86 CPU that runs in 16-bit mode

(e.g. for a bootloader) the i386 target has the -m16 option for this case.

* I'm not interested in changing the name from ia16. I'd have preferred

i086 or i86 (by analogy with i386) but I don't feel strongly enough to

argue about it or change it. If someone else cares strongly enough about

it to write the patches, I'll consider it.

* I'm also not interested in merging this port with the i386 back end.

The targets are too different, and it would create an excessive

maintenance burden for ia16 and (worse) for i386.

Andrew