[TUHS] Memory management in Dennis Ritchie's C Compiler

Bakul Shah bakul at iitbombay.org
Tue Aug 18 08:55:31 AEST 2020


On Aug 17, 2020, at 3:32 PM, Norman Wilson <norman at oclsc.org> wrote:
> 
> The hardest but most-interesting part was optimizing.
> lcc does a lot of optimization work by itself, and
> initially I'd hoped to dispense with a separate c2
> pass entirely, but that turns out not to be feasible
> on machines like the VAX or the PDP-11: internally
> lcc separates something like
> 	c = *p++;
> into two operations
> 	c = *p;
> 	p++;
> and makes two distinct calls to the code generator.
> To sew them back together from
> 	cvtbl	(p),c
> 	incl	p
> to
> 	cvtbl	(p)+,c
> requires external help; lcc just can't see that
> what it thinks of as two distinct expressions
> can be combined.

Didn't lcc use iburg or some such to generate the
code generator, which could do such things?

> See the lcc book for details.  Read the book anyway;
> it's the one case I know of in which the authors
> followed strict Literate Programming rules and made
> a big success of it.  Not only is the compiler well-
> documented, but the result is a wonderful tour
> through the construction and design decisions of a
> large program that does real work.

Agree. They used noweb. Probably with a troff backend?


More information about the TUHS mailing list