[comp.os.minix] 68000 and i386 C compiler VIII: Patch 2

HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) (04/16/91)

here comes the next patch to c68/c386. It covers all errors reported to
me.

there was no or little activity on c386 since I do not use it and I saw
no reports.

Someone sent me a new FP library, this is included here (liback).
It has still to be hand-translated to GAS syntax for libgas.


I heard rumours of automatic ACK--> GAS assembly program translators.
if someone mails me such a beast, I would be happy since it makes
maintaining the support lib easier.
Here is the ChangeLog:
Jan 7, 1991:
c68/c386 Version III
====================

changes:

- Full support for double data type in the front end
- enum type abandoned (are ints now)

- support for alloca in 68k and 386 code generators:
  saved registers are restored via references to the frame pointer, not
  the stack pointer

- bug fixes

If compiled with -DNOFLOAT, the compiler does not use floating-point
stuff and cannot generate floating-point constants.
(At least, no floating point code is generated. Floating point declarations
are not bracketed)

Patchlevel 1:
=============

Jan 9,1991: (problems reported by NETlanders)
Excessive popping of the floating point stack now fixed.
reference to save_mask in a target-independent part of genstmt removed.

The FP-stack pop-off in gen386.c was not correct -- lead to
additional fstp %st(0) instructions. --- fixed.

Jan 10,1991:
improved constant optimizations,
e.g. (1.0 > 2.0) is a legal constant integer expression.
optimize.c has changes so dramatically that is will be included as
as whole in the next patch.

Jan 16,1991:
changed all long constants like (long)65535 to 65535l since someone
complained (long)65535 would yield -1l with his compiler

Jan 17,1991:
added \a and \v in getsym.c, getsch()
removed the support function from the user's namespace
support functions now begin with a dot. This dot suppresses a translation
which may take place in outlate()

Jan 18,1991:
nofpu stuff redesigned, module which implements the support functions
on the 80387 hardware stack coded and tested.
Argument passing to support functions now via %ecx (not via the stack)
if possible. This is not possible for the 68000 compiler since there
is no free register.

rounded up .lcomm and .comm storage requests to a multiple of AL_DEFAULT
since someone told me that the 'by hand'-alignment will not work with all
assemblers. This only affects out68k_gas.c and out68k_sun.c

Renamed out386_sun.c into out386_gas.c since there was so much confusion.
Added some #ifdef SUN_ASM_SYNTAX to overcome the differences between
Sun and GAS syntax.

Wrote a file compiler.doc which tells what c68/c386 is.

Jan 23, 1991:
options can be given to in the form -Qoption, e.g. -Qshort or -Qnoshort.
This may make setting up a cc easier since cc now knows immedeately
which option to pass to c68/c386.

Jan 24, 1991:
added bt_void to function alignment() in decl.c:
there was a bug report that
   typdef void t;
wont work.

Jan 30, 1991:
peep_tst in peep68k.c:
There was a bug that lead to a nil pointer reference (the second operand
to a clr instruction was referenced)

Feb 1, 1991:
allowed an expression like
   i ? void_function() : 0; (expr.c, gen68k.c, gen386.c)

or x = i ? y : z; where x,y,z are structures. (gen68k.c)

It was necessary to do the strip-off on structures (which makes the expr.
gen. routines return a pointer to the structure, rather than the struc.
itself) in g_deref(). This code used to reside in g_assign, but when
structs may appear with in ? :, then there is another case.

Casts of constants to 'void' are now possible.

In gen386.c, this was already handled more carefully.

---

some changes to make the compiler error-robust, e.g. no code generation
is attempted if the parser has discovered syntax errors for this function
If c68/c386 gets a signal on ANY input, report it to me.
The compiler should not dump core even on plain english text or FORTRAN
programs

---

Feb 8, 1991:
Fixed the calculation of act_line which always was 1 too high.

Feb 13, 1991:
Added missigng validate-call in gen386.c, g_lsh()/g_rsh()/g_aslsh()/g_asrsh()

Feb 20, 1991:
Made MAX_PARAM a symbolic constant in c.h. It is used in decl.c; this
is the maximum number of parameters a function may have.

Feb 28, 1991:
Fixed genswitch in genstmt.c: use sign-extension to 32 bits for signed types

Mar 1, 1991:
========> This version is my internal (SCCS-)Version 3.5 and this version
========> is submitted to the net as c68 VIII, patchlevel 1

Mar 3, 1991:
genffp.c:
added a semicolon to 'return 0' in the NOFLOAT section

out386_gas.c:
added code for prepending underscores...
default setup: prepend underscores in the GAS version, do not prepend
               underscores in the Sun version

<passim>:
tried to eliminate ALL floating-point stuff when NOFLOAT is defined.

Mar 12, 1991:
updated ACK support library, has to be hand-translated to GAS syntax

Mar 13, 1991:
Optimization of move #0 --> clr is not safe on the 68000 except if the
destination is a data reg.

Mar 22, 1991:
save head and tail in expr.c, primary() when doing casts since this may
occur inside a declaration: e.g.

long buf[32/(int)sizeof(long)]; was wrong (the size was 16, not 32)

Apr 1, 1991:
In the expression a[b], allowed b to be a pointer and a to be an integral
value, this makes a[b] equivalent to *(a+b).

Apr 2, 1991:
allowed static initializations of unions: the first variant is initialized.
========> This version is my internal (SCCS-)Version 3.6 and this version
========> is submitted to the net as c68 VIII, patchlevel 2