[comp.os.minix] Minix C Compiler Sources from UniPress Software -- What do I get?

tdavis@enlog.Wichita.NCR.COM (Tim Davis) (07/11/88)

I recently purchased the Minix C compiler sources  from  UniPress
Software.   I haven't opened the diskette package yet because the
reference manual doesn't make it quite clear what is actually  on
the diskettes.

What pieces of source code are actually on  the  diskettes?   The
manual  (on  page  6.1)  says "(The Minix compiler sources do not
include the cgg component.  cgg  is  included  in  the  full  ACK
system.)"  GREAT!!  The code generator component source is not on
the diskette?  It seems like it would be rather tough to port the
compiler  to  another  machine  without having access to the code
generator source.  By the way, the ACK (Amsterdam  Compiler  Kit)
which does include the cgg component costs a measly $9950.00.

Has anyone bought the sources, looked at the diskettes, and tried
to  modify  the  compiler to generate 68000 code?  (without using
the ACK)

Thanks in advance.
-- 
---------------------------
...tIM dAVIS
(Tim.Davis@Wichita.NCR.COM)

paradis@encore.UUCP (Jim Paradis) (07/12/88)

In article <290@enlog.Wichita.NCR.COM> tdavis@enlog.Wichita.NCR.COM (Tim Davis) writes:
>The Minix compiler sources do not include the cgg component.  cgg  
>is  included  in  the  full  ACK system.  GREAT!!  The code 
>generator component source is not on the diskette?  It seems like 
>it would be rather tough to port the compiler  to  another  machine  
>without having access to the code generator source.

Yes, sir, there is no cgg.  I've been told by ast that the ACK is
HUGE, and the compiler-compiler is a significant fraction of that;
i.e., prob'ly way too big to fit on a PC anyway... 

On the other hand, if you're masochistic, the intermediate-code ("EM")
IS fully documented in the manual, which means that if you want
you're perfectly free to hand-code your OWN code generator... 8-) 8-)

-- 
Jim Paradis, Encore Computer
(.signature undergoing renovations. Please pardon our appearance.)

vandys@hpisoa1.HP.COM (Andrew Valencia) (07/12/88)

	Yes, we had a complaint about just this situation a year ago or so.
Apparently what is on those disks is useless for just about anything you'd
want to do.  I'd suggest you return those for a refund (give the money to
the poor :->) and get GNU CC.  Full source, great code generation for the
68K, and no cost.  The only hitch is that you'll have to cross-compile to
get started.

	With the soon-to-be-had Atari ST port of MINIX, perhaps you could do
your port from there.  Or maybe the C compiler for ST MINIX will float your
boat.

			Good luck!
			Andy Valencia

ast@cs.vu.nl (Andy Tanenbaum) (07/13/88)

In article <290@enlog.Wichita.NCR.COM> tdavis@enlog.Wichita.NCR.COM (Tim Davis) writes:
>What pieces of source code are actually on the [UniPress] diskettes?  

Although I haven't actually seen their package, what is supposed to be on
the diskettes is enough C code that if you compile it somewhere, you
get a binary of a compiler that turns C programs into 8088 code in MINIX
format.  You can use this to cross compile from a VAX or SUN etc.

The code generator-generator is not present.  The main reason is that cgg
does not use Yacc, but LLGEN, our own compiler-writing system.  LLGEN in
turn uses ....    Before all is said and done, you need some 6 megabytes
of source code, 40 megabytes of free disk space, a machine with an address
space considerably in excess of 1 MB, and more.  This is the full ACK, 
which is indeed sold for $995 (university price) and is aimed at VAX and
SUN class machines, not PC and AT class machines.  It also includes front ends
for other languages and back ends for 8080/8086/Z80/Z8000/68000/68020/VAX/PDP-11
6502/NS32032 and other CPUs.

While the standard code generator is hard to modify without full ACK
(since it is full of machine-generated tables), the interfaces between the
cpp - cem - opt - cg - asld passes are very well defined.  It is conceivable
that someone could take the input to cg and write a wholly new program to
expand the incoming EM code into 68000 assembler or binary.  If fact, if you
just did a dumb macro expansion of the 100 or so EM instructions, it is
probably only a week's work, but the code will not be optimal.  

Conclusion:  for general compiler development, porting etc, you need full
ACK and a VAX/SUN class machine, but the MINIX C compiler source is not
worthless by any means.  Many people use it to cross compile on non-Intel
CPUs, for example, and the front end is useful even if you have to write

your own back end (and assembler) from scratch.

Andy Tanenbaum (ast@cs.vu.nl)

nispa@cs.hut.fi (07/18/88)

In article <846@ast.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes:
>
>Although I haven't actually seen their package, what is supposed to be on
>the diskettes is enough C code that if you compile it somewhere, you
>get a binary of a compiler that turns C programs into 8088 code in MINIX
>format.  You can use this to cross compile from a VAX or SUN etc.

A few months ago I tried to install the Minix C compiler on a Sun-4.
I was able to compile the compiler (after a few minor changes),
but it refused to do anything sensible.

Are there any known problems with the MinixCC/Sun4-combination?
Any bugs that depend on word length or byte order of the CPU?
---
Tapani Lindgren                              | Email <nispa@cs.hut.fi> or
Helsinki University of Technology            | <nispa@finhutcs.BITNET> or
Laboratory of Information Processing Science | <mcvax!santra!sauna!nispa>
---
Tapani Lindgren                              | Email <nispa@cs.hut.fi> or
Helsinki University of Technology            | <nispa@finhutcs.BITNET> or
Laboratory of Information Processing Science | <mcvax!santra!sauna!nispa>

frank@morgan.com (Frank Wortner) (07/26/88)

In article <14648@santra.UUCP> Tapani Lindgren <nispa@cs.hut.fi> writes:

>A few months ago I tried to install the Minix C compiler on a Sun-4.
>I was able to compile the compiler (after a few minor changes),
>but it refused to do anything sensible.
>
>Are there any known problems with the MinixCC/Sun4-combination?
>Any bugs that depend on word length or byte order of the CPU?

I know of one problem Minix cc has on Sun 4s (and other
machines).  The ACK/Minix authors were rather cavelier in their handling of
variable argument lists.  They assumed that all processors passed
arguments on the stack just like PDP-11s, VAXen, and 8086s.
Unfortunately, Sun 4s do not.  The ACK explicitly takes addresses of
argument lists and uses pointers to index through these lists.  Here's
an example (taken from Minix cc.c):

	char *
	mkstr(dst, arg)
		char *dst, *arg;
	{
		char **vec = (char **) &arg; /* WRONG !!!! */
		register char *p;
		register char *q = dst;
	
		while (p = *vec++) {	     /* WRONG !!!! */
			while (*q++ = *p++);
			q--;
		}
		return dst;
	}


Here is the same example written portably using varargs(3) (available
in most modern C compilers):

	/* This works on Sun 4 (and everywhere else) */
	char *mkstr(va_alist)
	va_dcl
	{
	    va_list ap;
	    char *dst;
	    register char *p, *q;
	
	    va_start(ap);
	    q = dst = va_arg(ap, char *);
	    while ((p = va_arg(ap, char *)) != (char *)0) {
		while (*q++ = *p++);
		q--;
	    }
	    va_end(ap);
	    return dst;
	}

(In case you're wondering, the function takes two or more strings and
concatenates them.)

Minix source isn't as portable or well written as it could be, but
neither was 1970s vintage Un*x.

						Frank