Datalight faster than 4.2, why?

Guy Harris guy at sun.uucp
Sun Jun 1 08:36:33 AEST 1986


> And again, we would still need a separate cpp to make the kernel,

Well, note that if a "cc" is to be considered a real UNIX "cc", it will have
to support "-P" and "-E".  This means that if you don't have a separate
preprocessor, there will have to be *some* way of running just the
preprocessor part of the lexical analyzer and getting compilable C output
from it.  (Sorry, any of you people who want to bundle "cpp" and the lexical
analyzer, but that's the way it is.)  Given that, you can either hack "cc"
to understand ".S" files as assembler source files to be run through the
preprocessor, or have a "/lib/cpp" command which runs this wonderful
all-passes-integrated C compiler in "preprocessor only" mode.

So there are ways of doing it without "cpp" being a separate program, but
the important point is that it still isn't just a matter of hiding "cpp"s
functionality in the lexical analyzer.

> and I would either have to include the work `inline' (asm.sed for you 4.1
> and 4.2 folks) does, or have a separate ccom and c2+as phase.

Or borrow the idea AT&T-IS has been talking about (see the note on
"Assembler windows" in the article "The Evolution of C - Past and Future" in
the recent UNIX edition of the AT&T Bell Laboratories Technical Journal -
October 1984, Vol. 63 No. 8 Part 2), where the "asm" keyword is used
differently:

	...An experimental implementation now being evaluated uses the
	keyword "asm" in a different context.  A declaration of the form

	    asm f(arg1, arg2, ...) { ... }

	defines a function "f" to be compiled in line (without function
	linkages).  The programmer can specify alternate assembly-language
	expansions in the function prototype, depending on the storage
	classes of the actual parameters.

This has the advantage that it makes it easier to drop into assembler when
you absolutely have to, and the disadvantage that it makes it easier to drop
into assembler when you *don't* have to.

> Important to whom?  What about those writing the compilers themselves,
> or using parts of them?  Did you know that the F77 and Pascal
> compilers share the same code generation program, which is itself
> a modification of the original second pass of the C compiler proper?

Which is a very common practice; how do other systems implement this?  Do
they have the language-dependent first pass and the language-independent
second pass as separate programs?

> And all the compilers share the assembler, which does the grunge
> work of optimising branch instructions on a machine where conditional
> branches have a limited distance, but unconditionals do not.

And don't forget the grunge work of understanding your particular machine
and UNIX system's object file format....
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy at sun.arpa



More information about the Comp.lang.c mailing list