Itsa me, quake3io!

This commit is contained in:
Zachary Slater 2005-08-26 04:48:05 +00:00
parent dbe4ddb103
commit 5b755058f5
1409 changed files with 798983 additions and 798983 deletions

122
lcc/COPYRIGHT Normal file → Executable file
View file

@ -1,61 +1,61 @@
The authors of this software are Christopher W. Fraser and
David R. Hanson.
Copyright (c) 1991,1992,1993,1994,1995,1996,1997,1998 by AT&T,
Christopher W. Fraser, and David R. Hanson. All Rights Reserved.
Permission to use, copy, modify, and distribute this software for any
purpose, subject to the provisions described below, without fee is
hereby granted, provided that this entire notice is included in all
copies of any software that is or includes a copy or modification of
this software and in all copies of the supporting documentation for
such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
lcc is not public-domain software, shareware, and it is not protected
by a `copyleft' agreement, like the code from the Free Software
Foundation.
lcc is available free for your personal research and instructional use
under the `fair use' provisions of the copyright law. You may, however,
redistribute lcc in whole or in part provided you acknowledge its
source and include this CPYRIGHT file. You may, for example, include
the distribution in a CDROM of free software, provided you charge only
for the media, or mirror the distribution files at your site.
You may not sell lcc or any product derived from it in which it is a
significant part of the value of the product. Using the lcc front end
to build a C syntax checker is an example of this kind of product.
You may use parts of lcc in products as long as you charge for only
those components that are entirely your own and you acknowledge the use
of lcc clearly in all product documentation and distribution media. You
must state clearly that your product uses or is based on parts of lcc
and that lcc is available free of charge. You must also request that
bug reports on your product be reported to you. Using the lcc front
end to build a C compiler for the Motorola 88000 chip and charging for
and distributing only the 88000 code generator is an example of this
kind of product.
Using parts of lcc in other products is more problematic. For example,
using parts of lcc in a C++ compiler could save substantial time and
effort and therefore contribute significantly to the profitability of
the product. This kind of use, or any use where others stand to make a
profit from what is primarily our work, requires a license agreement
with Addison-Wesley. Per-copy and unlimited use licenses are
available; for more information, contact
J. Carter Shanklin
Addison Wesley Longman, Inc.
2725 Sand Hill Rd.
Menlo Park, CA 94025
650/854-0300 x2478 FAX: 650/614-2930 jcs@awl.com
-----
Chris Fraser / cwfraser@microsoft.com
David Hanson / drh@microsoft.com
$Revision: 145 $ $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $
The authors of this software are Christopher W. Fraser and
David R. Hanson.
Copyright (c) 1991,1992,1993,1994,1995,1996,1997,1998 by AT&T,
Christopher W. Fraser, and David R. Hanson. All Rights Reserved.
Permission to use, copy, modify, and distribute this software for any
purpose, subject to the provisions described below, without fee is
hereby granted, provided that this entire notice is included in all
copies of any software that is or includes a copy or modification of
this software and in all copies of the supporting documentation for
such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
lcc is not public-domain software, shareware, and it is not protected
by a `copyleft' agreement, like the code from the Free Software
Foundation.
lcc is available free for your personal research and instructional use
under the `fair use' provisions of the copyright law. You may, however,
redistribute lcc in whole or in part provided you acknowledge its
source and include this CPYRIGHT file. You may, for example, include
the distribution in a CDROM of free software, provided you charge only
for the media, or mirror the distribution files at your site.
You may not sell lcc or any product derived from it in which it is a
significant part of the value of the product. Using the lcc front end
to build a C syntax checker is an example of this kind of product.
You may use parts of lcc in products as long as you charge for only
those components that are entirely your own and you acknowledge the use
of lcc clearly in all product documentation and distribution media. You
must state clearly that your product uses or is based on parts of lcc
and that lcc is available free of charge. You must also request that
bug reports on your product be reported to you. Using the lcc front
end to build a C compiler for the Motorola 88000 chip and charging for
and distributing only the 88000 code generator is an example of this
kind of product.
Using parts of lcc in other products is more problematic. For example,
using parts of lcc in a C++ compiler could save substantial time and
effort and therefore contribute significantly to the profitability of
the product. This kind of use, or any use where others stand to make a
profit from what is primarily our work, requires a license agreement
with Addison-Wesley. Per-copy and unlimited use licenses are
available; for more information, contact
J. Carter Shanklin
Addison Wesley Longman, Inc.
2725 Sand Hill Rd.
Menlo Park, CA 94025
650/854-0300 x2478 FAX: 650/614-2930 jcs@awl.com
-----
Chris Fraser / cwfraser@microsoft.com
David Hanson / drh@microsoft.com
$Revision: 145 $ $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $

182
lcc/LOG Normal file → Executable file
View file

@ -1,91 +1,91 @@
From lcc 4.0 to 4.1:
Changes:
See doc/4.html for changes in the code-generation interface.
Warns about constants that are too large, eg, short x = 70000;
Warns about expressions that have no effect.
Unsigned shorts are now used for wide-character constants, and
wchar_t is a typedef for unsigned short.
More assertions in gen.c to confirm that the register allocator is
configured correctly; ie, that the various masks, wildcards,
clobbers, and targets are internally consistent. Full checking
appears impractical, but there's still more than than there was
before.
On the SPARC, lcc now emits .type and .size directives
unconditionally.
On the x86, constants are now emitted into the text segment.
If the environment variable "LCCDIR" is defined, it gives the directory
that contains the preprocessor, the compiler proper, and the
lcc-specific libraries.
Under Windows, lcc searches the directories named in the environment
variable "include" for header files.
Errors fixed:
Erroneously complained about unknown sizes for some const fields, eg,
typedef struct foo ref; struct foo { const ref *q; int a; };
f(ref *p, int i) { return p->q[i].a; }
-A -A erroneously complained about static main's that didn't conform
to the ANSI-mandated "int main(void)" or "int main(int, char **)".
Silently generated incorrect code for a structure copy with a
post-incremented target, eg,
struct { int x; } data = {1}, copy[2], *q = copy;
main() { *q++ = data; }
Generated incorrect values in some expressions with constant pointers.
Silently truncated string literals longer than 4095 characters.
Failed to emit debugging information for uninitialized globals.
Failed to diagnose missing sizes in some multi-dimensioned array
declarators, eg, extern int x[][10]; int x[5][];
Silently emitted incorrect sizes and initalizations for some
incomplete multi-dimensioned arrays involving pointers and whose size
is determined by the number of initializers.
Set only the x.name field for some back-end symbols (eg, wildcards),
and the uninitialized name field crashed some debugging output.
uses() failed to check the register *set* as well as the register
mask. There's no known bug demo, but a wildcard set might be
contrived that would need the test.
Crashed with -b on some conditional expressions involving calls, eg,
int p; void g(void) { p ? f() : 1; }
On the MIPS, sometimes generated an incorrect frame size and thus a
crash when floating-point registers were saved.
On the SPARC, erroneously reused a register variable as a temporary
when the variable is compiler-generated.
On the SPARC with -b, emitted incorrect code for returning structs.
On the x86, conversion from float to int rounded instead of truncated
with the default floating-point mode.
On the x86, eliminate rtargets for kids after the first (see p. 419).
On the x86, substitute reg for freg, in order to use the common reg
rules. Needed only for debugging output, since we're not using any
float regs as regs at this time.
On the x86, "double f(); main(){f();}" wasn't popping the FP register stack.
On the x86, ECX was saved by the callee, when it should have been
saved by the caller.
$Id: LOG 145 2001-10-17 21:53:10Z timo $
From lcc 4.0 to 4.1:
Changes:
See doc/4.html for changes in the code-generation interface.
Warns about constants that are too large, eg, short x = 70000;
Warns about expressions that have no effect.
Unsigned shorts are now used for wide-character constants, and
wchar_t is a typedef for unsigned short.
More assertions in gen.c to confirm that the register allocator is
configured correctly; ie, that the various masks, wildcards,
clobbers, and targets are internally consistent. Full checking
appears impractical, but there's still more than than there was
before.
On the SPARC, lcc now emits .type and .size directives
unconditionally.
On the x86, constants are now emitted into the text segment.
If the environment variable "LCCDIR" is defined, it gives the directory
that contains the preprocessor, the compiler proper, and the
lcc-specific libraries.
Under Windows, lcc searches the directories named in the environment
variable "include" for header files.
Errors fixed:
Erroneously complained about unknown sizes for some const fields, eg,
typedef struct foo ref; struct foo { const ref *q; int a; };
f(ref *p, int i) { return p->q[i].a; }
-A -A erroneously complained about static main's that didn't conform
to the ANSI-mandated "int main(void)" or "int main(int, char **)".
Silently generated incorrect code for a structure copy with a
post-incremented target, eg,
struct { int x; } data = {1}, copy[2], *q = copy;
main() { *q++ = data; }
Generated incorrect values in some expressions with constant pointers.
Silently truncated string literals longer than 4095 characters.
Failed to emit debugging information for uninitialized globals.
Failed to diagnose missing sizes in some multi-dimensioned array
declarators, eg, extern int x[][10]; int x[5][];
Silently emitted incorrect sizes and initalizations for some
incomplete multi-dimensioned arrays involving pointers and whose size
is determined by the number of initializers.
Set only the x.name field for some back-end symbols (eg, wildcards),
and the uninitialized name field crashed some debugging output.
uses() failed to check the register *set* as well as the register
mask. There's no known bug demo, but a wildcard set might be
contrived that would need the test.
Crashed with -b on some conditional expressions involving calls, eg,
int p; void g(void) { p ? f() : 1; }
On the MIPS, sometimes generated an incorrect frame size and thus a
crash when floating-point registers were saved.
On the SPARC, erroneously reused a register variable as a temporary
when the variable is compiler-generated.
On the SPARC with -b, emitted incorrect code for returning structs.
On the x86, conversion from float to int rounded instead of truncated
with the default floating-point mode.
On the x86, eliminate rtargets for kids after the first (see p. 419).
On the x86, substitute reg for freg, in order to use the common reg
rules. Needed only for debugging output, since we're not using any
float regs as regs at this time.
On the x86, "double f(); main(){f();}" wasn't popping the FP register stack.
On the x86, ECX was saved by the callee, when it should have been
saved by the caller.
$Id: LOG 145 2001-10-17 21:53:10Z timo $

42
lcc/README Normal file → Executable file
View file

@ -1,21 +1,21 @@
This hierarchy is the distribution for lcc version 4.1.
lcc version 3.x is described in the book "A Retargetable C Compiler:
Design and Implementation" (Addison-Wesley, 1995, ISBN 0-8053-1670-1).
There are significant differences between 3.x and 4.x, most notably in
the intermediate code. doc/4.html summarizes the differences.
VERSION 4.1 IS INCOMPATIBLE WITH EARLIER VERSIONS OF LCC. DO NOT
UNLOAD THIS DISTRIBUTION ON TOP OF A 3.X DISTRIBUTION.
LOG describes the changes since the last release.
CPYRIGHT describes the conditions under you can use, copy, modify, and
distribute lcc or works derived from lcc.
doc/install.html is an HTML file that gives a complete description of
the distribution and installation instructions.
Chris Fraser / cwfraser@microsoft.com
David Hanson / drh@microsoft.com
$Revision: 145 $ $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $
This hierarchy is the distribution for lcc version 4.1.
lcc version 3.x is described in the book "A Retargetable C Compiler:
Design and Implementation" (Addison-Wesley, 1995, ISBN 0-8053-1670-1).
There are significant differences between 3.x and 4.x, most notably in
the intermediate code. doc/4.html summarizes the differences.
VERSION 4.1 IS INCOMPATIBLE WITH EARLIER VERSIONS OF LCC. DO NOT
UNLOAD THIS DISTRIBUTION ON TOP OF A 3.X DISTRIBUTION.
LOG describes the changes since the last release.
CPYRIGHT describes the conditions under you can use, copy, modify, and
distribute lcc or works derived from lcc.
doc/install.html is an HTML file that gives a complete description of
the distribution and installation instructions.
Chris Fraser / cwfraser@microsoft.com
David Hanson / drh@microsoft.com
$Revision: 145 $ $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $

6
lcc/README.id Normal file → Executable file
View file

@ -1,3 +1,3 @@
2001-10-31 Timothee Besset <ttimo@idsoftware.com>
updated from the $/source/lcc code
modified for portability and use with >= 1.31 mod source release
2001-10-31 Timothee Besset <ttimo@idsoftware.com>
updated from the $/source/lcc code
modified for portability and use with >= 1.31 mod source release

184
lcc/alpha/osf/tst/8q.1bk Normal file → Executable file
View file

@ -1,92 +1,92 @@
1 5 8 6 3 7 2 4
1 6 8 3 7 4 2 5
1 7 4 6 8 2 5 3
1 7 5 8 2 4 6 3
2 4 6 8 3 1 7 5
2 5 7 1 3 8 6 4
2 5 7 4 1 8 6 3
2 6 1 7 4 8 3 5
2 6 8 3 1 4 7 5
2 7 3 6 8 5 1 4
2 7 5 8 1 4 6 3
2 8 6 1 3 5 7 4
3 1 7 5 8 2 4 6
3 5 2 8 1 7 4 6
3 5 2 8 6 4 7 1
3 5 7 1 4 2 8 6
3 5 8 4 1 7 2 6
3 6 2 5 8 1 7 4
3 6 2 7 1 4 8 5
3 6 2 7 5 1 8 4
3 6 4 1 8 5 7 2
3 6 4 2 8 5 7 1
3 6 8 1 4 7 5 2
3 6 8 1 5 7 2 4
3 6 8 2 4 1 7 5
3 7 2 8 5 1 4 6
3 7 2 8 6 4 1 5
3 8 4 7 1 6 2 5
4 1 5 8 2 7 3 6
4 1 5 8 6 3 7 2
4 2 5 8 6 1 3 7
4 2 7 3 6 8 1 5
4 2 7 3 6 8 5 1
4 2 7 5 1 8 6 3
4 2 8 5 7 1 3 6
4 2 8 6 1 3 5 7
4 6 1 5 2 8 3 7
4 6 8 2 7 1 3 5
4 6 8 3 1 7 5 2
4 7 1 8 5 2 6 3
4 7 3 8 2 5 1 6
4 7 5 2 6 1 3 8
4 7 5 3 1 6 8 2
4 8 1 3 6 2 7 5
4 8 1 5 7 2 6 3
4 8 5 3 1 7 2 6
5 1 4 6 8 2 7 3
5 1 8 4 2 7 3 6
5 1 8 6 3 7 2 4
5 2 4 6 8 3 1 7
5 2 4 7 3 8 6 1
5 2 6 1 7 4 8 3
5 2 8 1 4 7 3 6
5 3 1 6 8 2 4 7
5 3 1 7 2 8 6 4
5 3 8 4 7 1 6 2
5 7 1 3 8 6 4 2
5 7 1 4 2 8 6 3
5 7 2 4 8 1 3 6
5 7 2 6 3 1 4 8
5 7 2 6 3 1 8 4
5 7 4 1 3 8 6 2
5 8 4 1 3 6 2 7
5 8 4 1 7 2 6 3
6 1 5 2 8 3 7 4
6 2 7 1 3 5 8 4
6 2 7 1 4 8 5 3
6 3 1 7 5 8 2 4
6 3 1 8 4 2 7 5
6 3 1 8 5 2 4 7
6 3 5 7 1 4 2 8
6 3 5 8 1 4 2 7
6 3 7 2 4 8 1 5
6 3 7 2 8 5 1 4
6 3 7 4 1 8 2 5
6 4 1 5 8 2 7 3
6 4 2 8 5 7 1 3
6 4 7 1 3 5 2 8
6 4 7 1 8 2 5 3
6 8 2 4 1 7 5 3
7 1 3 8 6 4 2 5
7 2 4 1 8 5 3 6
7 2 6 3 1 4 8 5
7 3 1 6 8 5 2 4
7 3 8 2 5 1 6 4
7 4 2 5 8 1 3 6
7 4 2 8 6 1 3 5
7 5 3 1 6 8 2 4
8 2 4 1 7 5 3 6
8 2 5 3 1 7 4 6
8 3 1 6 2 5 7 4
8 4 1 3 6 2 7 5
1 5 8 6 3 7 2 4
1 6 8 3 7 4 2 5
1 7 4 6 8 2 5 3
1 7 5 8 2 4 6 3
2 4 6 8 3 1 7 5
2 5 7 1 3 8 6 4
2 5 7 4 1 8 6 3
2 6 1 7 4 8 3 5
2 6 8 3 1 4 7 5
2 7 3 6 8 5 1 4
2 7 5 8 1 4 6 3
2 8 6 1 3 5 7 4
3 1 7 5 8 2 4 6
3 5 2 8 1 7 4 6
3 5 2 8 6 4 7 1
3 5 7 1 4 2 8 6
3 5 8 4 1 7 2 6
3 6 2 5 8 1 7 4
3 6 2 7 1 4 8 5
3 6 2 7 5 1 8 4
3 6 4 1 8 5 7 2
3 6 4 2 8 5 7 1
3 6 8 1 4 7 5 2
3 6 8 1 5 7 2 4
3 6 8 2 4 1 7 5
3 7 2 8 5 1 4 6
3 7 2 8 6 4 1 5
3 8 4 7 1 6 2 5
4 1 5 8 2 7 3 6
4 1 5 8 6 3 7 2
4 2 5 8 6 1 3 7
4 2 7 3 6 8 1 5
4 2 7 3 6 8 5 1
4 2 7 5 1 8 6 3
4 2 8 5 7 1 3 6
4 2 8 6 1 3 5 7
4 6 1 5 2 8 3 7
4 6 8 2 7 1 3 5
4 6 8 3 1 7 5 2
4 7 1 8 5 2 6 3
4 7 3 8 2 5 1 6
4 7 5 2 6 1 3 8
4 7 5 3 1 6 8 2
4 8 1 3 6 2 7 5
4 8 1 5 7 2 6 3
4 8 5 3 1 7 2 6
5 1 4 6 8 2 7 3
5 1 8 4 2 7 3 6
5 1 8 6 3 7 2 4
5 2 4 6 8 3 1 7
5 2 4 7 3 8 6 1
5 2 6 1 7 4 8 3
5 2 8 1 4 7 3 6
5 3 1 6 8 2 4 7
5 3 1 7 2 8 6 4
5 3 8 4 7 1 6 2
5 7 1 3 8 6 4 2
5 7 1 4 2 8 6 3
5 7 2 4 8 1 3 6
5 7 2 6 3 1 4 8
5 7 2 6 3 1 8 4
5 7 4 1 3 8 6 2
5 8 4 1 3 6 2 7
5 8 4 1 7 2 6 3
6 1 5 2 8 3 7 4
6 2 7 1 3 5 8 4
6 2 7 1 4 8 5 3
6 3 1 7 5 8 2 4
6 3 1 8 4 2 7 5
6 3 1 8 5 2 4 7
6 3 5 7 1 4 2 8
6 3 5 8 1 4 2 7
6 3 7 2 4 8 1 5
6 3 7 2 8 5 1 4
6 3 7 4 1 8 2 5
6 4 1 5 8 2 7 3
6 4 2 8 5 7 1 3
6 4 7 1 3 5 2 8
6 4 7 1 8 2 5 3
6 8 2 4 1 7 5 3
7 1 3 8 6 4 2 5
7 2 4 1 8 5 3 6
7 2 6 3 1 4 8 5
7 3 1 6 8 5 2 4
7 3 8 2 5 1 6 4
7 4 2 5 8 1 3 6
7 4 2 8 6 1 3 5
7 5 3 1 6 8 2 4
8 2 4 1 7 5 3 6
8 2 5 3 1 7 4 6
8 3 1 6 2 5 7 4
8 4 1 3 6 2 7 5

4
lcc/alpha/osf/tst/8q.2bk Normal file → Executable file
View file

@ -1,2 +1,2 @@
tst/8q.c:30: warning: missing return value
tst/8q.c:39: warning: missing return value
tst/8q.c:30: warning: missing return value
tst/8q.c:39: warning: missing return value

386
lcc/alpha/osf/tst/8q.sbk Normal file → Executable file
View file

@ -1,193 +1,193 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
L.2:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $25,1
stl $25,down($27)
stl $25,up($27)
L.3:
lda $14,1($14)
cmplt $14,15,$23
bne $23,L.2
mov $31,$14
L.6:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $25,1
stl $25,rows($27)
L.7:
lda $14,1($14)
cmplt $14,8,$23
bne $23,L.6
mov $31,$16
jsr $26,queens
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl queens
.text
.ent queens
queens:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
mov $31,$13
L.11:
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,rows($25)
cmpeq $25,$31,$23
bne $23,L.15
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,up($25)
cmpeq $25,$31,$23
bne $23,L.15
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,down($25)
cmpeq $25,$31,$23
bne $23,L.15
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,down($25)
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,up($25)
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,rows($25)
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
stl $13,x($27)
cmpeq $14,7,$23
beq $23,L.17
jsr $26,print
ldgp $gp,0($26)
br L.18
L.17:
lda $16,1($14)
jsr $26,queens
ldgp $gp,0($26)
L.18:
lda $27,1
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,down($25)
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,up($25)
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,rows($25)
L.15:
L.12:
lda $13,1($13)
cmplt $13,8,$23
bne $23,L.11
mov $31,$0
L.10:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end queens
.globl print
.text
.ent print
print:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
L.20:
lda $16,L.24
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
ldl $27,x($27)
lda $17,49($27)
jsr $26,printf
ldgp $gp,0($26)
L.21:
lda $14,1($14)
cmplt $14,8,$23
bne $23,L.20
lda $16,L.25
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.19:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end print
.globl x
.comm x,32
.globl rows
.comm rows,32
.globl down
.comm down,60
.globl up
.comm up,60
.rdata
.align 0
L.25:
.byte 10
.byte 0
.align 0
L.24:
.byte 37
.byte 99
.byte 32
.byte 0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
L.2:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $25,1
stl $25,down($27)
stl $25,up($27)
L.3:
lda $14,1($14)
cmplt $14,15,$23
bne $23,L.2
mov $31,$14
L.6:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $25,1
stl $25,rows($27)
L.7:
lda $14,1($14)
cmplt $14,8,$23
bne $23,L.6
mov $31,$16
jsr $26,queens
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl queens
.text
.ent queens
queens:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
mov $31,$13
L.11:
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,rows($25)
cmpeq $25,$31,$23
bne $23,L.15
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,up($25)
cmpeq $25,$31,$23
bne $23,L.15
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
ldl $25,down($25)
cmpeq $25,$31,$23
bne $23,L.15
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,down($25)
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,up($25)
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $31,rows($25)
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
stl $13,x($27)
cmpeq $14,7,$23
beq $23,L.17
jsr $26,print
ldgp $gp,0($26)
br L.18
L.17:
lda $16,1($14)
jsr $26,queens
ldgp $gp,0($26)
L.18:
lda $27,1
addl $13,$14,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,down($25)
subl $13,$14,$25
lda $25,7($25)
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,up($25)
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,2,$25
stl $27,rows($25)
L.15:
L.12:
lda $13,1($13)
cmplt $13,8,$23
bne $23,L.11
mov $31,$0
L.10:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end queens
.globl print
.text
.ent print
print:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
L.20:
lda $16,L.24
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
ldl $27,x($27)
lda $17,49($27)
jsr $26,printf
ldgp $gp,0($26)
L.21:
lda $14,1($14)
cmplt $14,8,$23
bne $23,L.20
lda $16,L.25
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.19:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end print
.globl x
.comm x,32
.globl rows
.comm rows,32
.globl down
.comm down,60
.globl up
.comm up,60
.rdata
.align 0
L.25:
.byte 10
.byte 0
.align 0
L.24:
.byte 37
.byte 99
.byte 32
.byte 0

8
lcc/alpha/osf/tst/array.1bk Normal file → Executable file
View file

@ -1,4 +1,4 @@
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003
0 1 2 3 1000 1001 1002 1003 2000 2001 2002 2003

4
lcc/alpha/osf/tst/array.2bk Normal file → Executable file
View file

@ -1,2 +1,2 @@
tst/array.c:33: warning: missing return value
tst/array.c:48: warning: missing return value
tst/array.c:33: warning: missing return value
tst/array.c:48: warning: missing return value

520
lcc/alpha/osf/tst/array.sbk Normal file → Executable file
View file

@ -1,260 +1,260 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-144($sp)
.mask 0x4007000,-120
.frame $sp,144,$26,48
stq $12,0($sp)
stq $13,8($sp)
stq $14,16($sp)
stq $26,24($sp)
.prologue 1
mov $31,$13
L.2:
mov $31,$14
L.6:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
lda $25,x($25)
addq $27,$25,$27
lda $25,1000
mull $25,$13,$25
addl $25,$14,$25
stl $25,($27)
L.7:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.6
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$25
sll $27,4,$27
lda $27,x($27)
stq $27,y($25)
L.3:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.2
jsr $26,f
ldgp $gp,0($26)
mov $31,$13
L.10:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,4,$25
lda $22,-104+144($sp)
addq $25,$22,$25
mov $25,$12
sll $27,3,$27
stq $25,y($27)
mov $31,$14
L.14:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$12,$25
sll $13,8*(8-4),$22
sra $22,8*(8-4),$22
sll $22,4,$22
lda $22,x($22)
addq $27,$22,$27
ldl $27,($27)
stl $27,($25)
L.15:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.14
L.11:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.10
lda $16,-104+144($sp)
lda $17,y
jsr $26,g
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $12,0($sp)
ldq $13,8($sp)
ldq $14,16($sp)
ldq $26,24($sp)
lda $sp,144($sp)
ret
.end main
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $31,$13
L.19:
mov $31,$14
L.23:
lda $16,L.27
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
lda $25,x($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.24:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.23
L.20:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.19
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$13
L.29:
mov $31,$14
L.33:
lda $16,L.27
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.34:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.33
L.30:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.29
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.18:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end f
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4007800,-64
.frame $sp,96,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
mov $16,$14
mov $17,$13
.prologue 1
mov $31,$11
L.38:
mov $31,$12
L.42:
lda $16,L.27
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $11,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
addq $25,$14,$25
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.43:
lda $12,1($12)
cmplt $12,4,$23
bne $23,L.42
L.39:
lda $11,1($11)
cmplt $11,3,$23
bne $23,L.38
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$11
L.46:
mov $31,$12
L.50:
lda $16,L.27
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $11,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
addq $25,$13,$25
ldq $25,($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.51:
lda $12,1($12)
cmplt $12,4,$23
bne $23,L.50
L.47:
lda $11,1($11)
cmplt $11,3,$23
bne $23,L.46
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.37:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end g
.globl y
.comm y,24
.globl x
.comm x,48
.rdata
.align 0
L.28:
.byte 10
.byte 0
.align 0
L.27:
.byte 32
.byte 37
.byte 100
.byte 0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-144($sp)
.mask 0x4007000,-120
.frame $sp,144,$26,48
stq $12,0($sp)
stq $13,8($sp)
stq $14,16($sp)
stq $26,24($sp)
.prologue 1
mov $31,$13
L.2:
mov $31,$14
L.6:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
lda $25,x($25)
addq $27,$25,$27
lda $25,1000
mull $25,$13,$25
addl $25,$14,$25
stl $25,($27)
L.7:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.6
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$25
sll $27,4,$27
lda $27,x($27)
stq $27,y($25)
L.3:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.2
jsr $26,f
ldgp $gp,0($26)
mov $31,$13
L.10:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,4,$25
lda $22,-104+144($sp)
addq $25,$22,$25
mov $25,$12
sll $27,3,$27
stq $25,y($27)
mov $31,$14
L.14:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$12,$25
sll $13,8*(8-4),$22
sra $22,8*(8-4),$22
sll $22,4,$22
lda $22,x($22)
addq $27,$22,$27
ldl $27,($27)
stl $27,($25)
L.15:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.14
L.11:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.10
lda $16,-104+144($sp)
lda $17,y
jsr $26,g
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $12,0($sp)
ldq $13,8($sp)
ldq $14,16($sp)
ldq $26,24($sp)
lda $sp,144($sp)
ret
.end main
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $31,$13
L.19:
mov $31,$14
L.23:
lda $16,L.27
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
lda $25,x($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.24:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.23
L.20:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.19
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$13
L.29:
mov $31,$14
L.33:
lda $16,L.27
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.34:
lda $14,1($14)
cmplt $14,4,$23
bne $23,L.33
L.30:
lda $13,1($13)
cmplt $13,3,$23
bne $23,L.29
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.18:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end f
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4007800,-64
.frame $sp,96,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
mov $16,$14
mov $17,$13
.prologue 1
mov $31,$11
L.38:
mov $31,$12
L.42:
lda $16,L.27
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $11,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,4,$25
addq $25,$14,$25
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.43:
lda $12,1($12)
cmplt $12,4,$23
bne $23,L.42
L.39:
lda $11,1($11)
cmplt $11,3,$23
bne $23,L.38
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$11
L.46:
mov $31,$12
L.50:
lda $16,L.27
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $11,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
addq $25,$13,$25
ldq $25,($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.51:
lda $12,1($12)
cmplt $12,4,$23
bne $23,L.50
L.47:
lda $11,1($11)
cmplt $11,3,$23
bne $23,L.46
lda $16,L.28
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.37:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end g
.globl y
.comm y,24
.globl x
.comm x,48
.rdata
.align 0
L.28:
.byte 10
.byte 0
.align 0
L.27:
.byte 32
.byte 37
.byte 100
.byte 0

102
lcc/alpha/osf/tst/cf.1bk Normal file → Executable file
View file

@ -1,51 +1,51 @@
char freq
011 8.1
012 6.1
040 11.9
! 0.2
" 1.5
% 0.6
& 0.4
' 0.4
( 2.9
) 2.9
* 0.8
+ 1.3
, 1.3
- 0.4
. 0.6
/ 1.0
0 2.5
1 1.9
2 0.6
3 0.2
7 0.4
8 0.2
; 3.8
< 0.8
= 2.7
> 0.2
[ 1.5
\ 0.8
] 1.5
a 3.1
c 4.4
e 2.3
f 6.0
g 1.3
h 1.0
i 5.0
l 1.0
m 0.2
n 3.3
o 2.1
p 1.0
q 0.4
r 4.2
s 0.6
t 3.8
u 1.2
v 0.6
w 0.2
{ 0.6
} 0.6
char freq
011 8.1
012 6.1
040 11.9
! 0.2
" 1.5
% 0.6
& 0.4
' 0.4
( 2.9
) 2.9
* 0.8
+ 1.3
, 1.3
- 0.4
. 0.6
/ 1.0
0 2.5
1 1.9
2 0.6
3 0.2
7 0.4
8 0.2
; 3.8
< 0.8
= 2.7
> 0.2
[ 1.5
\ 0.8
] 1.5
a 3.1
c 4.4
e 2.3
f 6.0
g 1.3
h 1.0
i 5.0
l 1.0
m 0.2
n 3.3
o 2.1
p 1.0
q 0.4
r 4.2
s 0.6
t 3.8
u 1.2
v 0.6
w 0.2
{ 0.6
} 0.6

0
lcc/alpha/osf/tst/cf.2bk Normal file → Executable file
View file

340
lcc/alpha/osf/tst/cf.sbk Normal file → Executable file
View file

@ -1,170 +1,170 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-96($sp)
.fmask 0x200,-96
.mask 0x4007000,-64
.frame $sp,96,$26,48
stt $f9,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
stq $16,48($sp)
stq $17,56($sp)
.prologue 1
ldl $27,-48+96($sp)
cmple $27,1,$23
beq $23,L.2
lds $f9,L.4
br L.3
L.2:
ldq $27,-40+96($sp)
ldq $16,8($27)
jsr $26,atof
ldgp $gp,0($26)
lds $f29,L.5
divs $f0,$f29,$f9
L.3:
mov $31,$14
L.6:
mov $14,$27
lda $14,1($27)
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f30,L.4
sts $f30,f($27)
L.7:
lda $27,127
cmple $14,$27,$23
bne $23,L.6
mov $31,$13
br L.11
L.10:
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $27,f($27)
lds $f30,($27)
lds $f29,L.13
adds $f30,$f29,$f30
sts $f30,($27)
lda $13,1($13)
L.11:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$12
lda $25,-1
cmpeq $0,$25,$23
beq $23,L.10
lda $16,L.14
jsr $26,printf
ldgp $gp,0($26)
mov $31,$14
L.15:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f30,f($27)
lds $f29,L.4
cmpteq $f30,$f29,$f1
fbne $f1,L.19
stq $13,-56+96($sp)
ldt $f29,-56+96($sp)
cvtqs $f29,$f29
divs $f30,$f29,$f30
cmptlt $f30,$f9,$f1
fbne $f1,L.19
cmple $14,32,$23
beq $23,L.21
lda $16,L.23
mov $14,$17
jsr $26,printf
ldgp $gp,0($26)
br L.22
L.21:
lda $16,L.24
mov $14,$17
jsr $26,printf
ldgp $gp,0($26)
L.22:
lda $16,L.25
lds $f30,L.5
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f29,f($27)
muls $f30,$f29,$f30
stq $13,-56+96($sp)
ldt $f29,-56+96($sp)
cvtqs $f29,$f29
divs $f30,$f29,$f30
cvtst $f30,$f17
jsr $26,printf
ldgp $gp,0($26)
L.19:
L.16:
lda $14,1($14)
lda $27,127
cmple $14,$27,$23
bne $23,L.15
mov $31,$0
L.1:
ldt $f9,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end main
.globl f
.comm f,512
.rdata
.align 0
L.25:
.byte 9
.byte 37
.byte 46
.byte 49
.byte 102
.byte 10
.byte 0
.align 0
L.24:
.byte 37
.byte 99
.byte 0
.align 0
L.23:
.byte 37
.byte 48
.byte 51
.byte 111
.byte 0
.align 0
L.14:
.byte 99
.byte 104
.byte 97
.byte 114
.byte 9
.byte 102
.byte 114
.byte 101
.byte 113
.byte 10
.byte 0
.align 2
L.13:
.long 0x3f800000
.align 2
L.5:
.long 0x42c80000
.align 2
L.4:
.long 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-96($sp)
.fmask 0x200,-96
.mask 0x4007000,-64
.frame $sp,96,$26,48
stt $f9,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
stq $16,48($sp)
stq $17,56($sp)
.prologue 1
ldl $27,-48+96($sp)
cmple $27,1,$23
beq $23,L.2
lds $f9,L.4
br L.3
L.2:
ldq $27,-40+96($sp)
ldq $16,8($27)
jsr $26,atof
ldgp $gp,0($26)
lds $f29,L.5
divs $f0,$f29,$f9
L.3:
mov $31,$14
L.6:
mov $14,$27
lda $14,1($27)
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f30,L.4
sts $f30,f($27)
L.7:
lda $27,127
cmple $14,$27,$23
bne $23,L.6
mov $31,$13
br L.11
L.10:
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lda $27,f($27)
lds $f30,($27)
lds $f29,L.13
adds $f30,$f29,$f30
sts $f30,($27)
lda $13,1($13)
L.11:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$12
lda $25,-1
cmpeq $0,$25,$23
beq $23,L.10
lda $16,L.14
jsr $26,printf
ldgp $gp,0($26)
mov $31,$14
L.15:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f30,f($27)
lds $f29,L.4
cmpteq $f30,$f29,$f1
fbne $f1,L.19
stq $13,-56+96($sp)
ldt $f29,-56+96($sp)
cvtqs $f29,$f29
divs $f30,$f29,$f30
cmptlt $f30,$f9,$f1
fbne $f1,L.19
cmple $14,32,$23
beq $23,L.21
lda $16,L.23
mov $14,$17
jsr $26,printf
ldgp $gp,0($26)
br L.22
L.21:
lda $16,L.24
mov $14,$17
jsr $26,printf
ldgp $gp,0($26)
L.22:
lda $16,L.25
lds $f30,L.5
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
lds $f29,f($27)
muls $f30,$f29,$f30
stq $13,-56+96($sp)
ldt $f29,-56+96($sp)
cvtqs $f29,$f29
divs $f30,$f29,$f30
cvtst $f30,$f17
jsr $26,printf
ldgp $gp,0($26)
L.19:
L.16:
lda $14,1($14)
lda $27,127
cmple $14,$27,$23
bne $23,L.15
mov $31,$0
L.1:
ldt $f9,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end main
.globl f
.comm f,512
.rdata
.align 0
L.25:
.byte 9
.byte 37
.byte 46
.byte 49
.byte 102
.byte 10
.byte 0
.align 0
L.24:
.byte 37
.byte 99
.byte 0
.align 0
L.23:
.byte 37
.byte 48
.byte 51
.byte 111
.byte 0
.align 0
L.14:
.byte 99
.byte 104
.byte 97
.byte 114
.byte 9
.byte 102
.byte 114
.byte 101
.byte 113
.byte 10
.byte 0
.align 2
L.13:
.long 0x3f800000
.align 2
L.5:
.long 0x42c80000
.align 2
L.4:
.long 0x0

90
lcc/alpha/osf/tst/cq.1bk Normal file → Executable file
View file

@ -1,45 +1,45 @@
Section s22 returned 0.
s241,er4
Section s241 returned 4.
Section s243 returned 0.
Section s244 returned 0.
Section s25 returned 0.
8 bits in chars.
32 bits in ints.
16 bits in shorts.
64 bits in longs.
32 bits in unsigneds.
32 bits in floats.
64 bits in doubles.
1.192093e-07 is the least number that can be added to 1. (float).
2.220446e-16 is the least number that can be added to 1. (double).
Section s26 returned 0.
Section s4 returned 0.
Section s61 returned 0.
Section s626 returned 0.
Section s71 returned 0.
Section s72 returned 0.
Section s757 returned 0.
Section s7813 returned 0.
Section s714 returned 0.
Section s715 returned 0.
Register count for char is unreliable.
Register count for pointer is unreliable.
Register count for int is unreliable.
Section s81 returned 0.
Section s84 returned 0.
char alignment: 1
short alignment: 2
int alignment: 4
long alignment: 8
unsigned alignment: 4
float alignment: 4
double alignment: 8
Sign extension in fields
Be especially careful with 1-bit fields!
Section s85 returned 0.
Section s86 returned 0.
Section s88 returned 0.
Section s9 returned 0.
Failed.
Section s22 returned 0.
s241,er4
Section s241 returned 4.
Section s243 returned 0.
Section s244 returned 0.
Section s25 returned 0.
8 bits in chars.
32 bits in ints.
16 bits in shorts.
64 bits in longs.
32 bits in unsigneds.
32 bits in floats.
64 bits in doubles.
1.192093e-07 is the least number that can be added to 1. (float).
2.220446e-16 is the least number that can be added to 1. (double).
Section s26 returned 0.
Section s4 returned 0.
Section s61 returned 0.
Section s626 returned 0.
Section s71 returned 0.
Section s72 returned 0.
Section s757 returned 0.
Section s7813 returned 0.
Section s714 returned 0.
Section s715 returned 0.
Register count for char is unreliable.
Register count for pointer is unreliable.
Register count for int is unreliable.
Section s81 returned 0.
Section s84 returned 0.
char alignment: 1
short alignment: 2
int alignment: 4
long alignment: 8
unsigned alignment: 4
float alignment: 4
double alignment: 8
Sign extension in fields
Be especially careful with 1-bit fields!
Section s85 returned 0.
Section s86 returned 0.
Section s88 returned 0.
Section s9 returned 0.
Failed.

8
lcc/alpha/osf/tst/cq.2bk Normal file → Executable file
View file

@ -1,4 +1,4 @@
tst/cq.c:533: warning: missing return value
tst/cq.c:1169: warning: missing return value
tst/cq.c:5294: warning: unreachable code
tst/cq.c:5303: warning: missing return value
tst/cq.c:533: warning: missing return value
tst/cq.c:1169: warning: missing return value
tst/cq.c:5294: warning: unreachable code
tst/cq.c:5303: warning: missing return value

33808
lcc/alpha/osf/tst/cq.sbk Normal file → Executable file

File diff suppressed because it is too large Load diff

22
lcc/alpha/osf/tst/cvt.1bk Normal file → Executable file
View file

@ -1,11 +1,11 @@
1 1 1 1 1 1 1 1 1.000000 1.000000 1.000000
2 2 2 2 2 2 2 2 2.000000 2.000000 2.000000
3 3 3 3 3 3 3 3 3.000000 3.000000 3.000000
4 4 4 4 4 4 4 4 4.000000 4.000000 4.000000
5 5 5 5 5 5 5 5 5.000000 5.000000 5.000000
6 6 6 6 6 6 6 6 6.000000 6.000000 6.000000
7 7 7 7 7 7 7 7 7.000000 7.000000 7.000000
8 8 8 8 8 8 8 8 8.000000 8.000000 8.000000
9 9 9 9 9 9 9 9 9.000000 9.000000 9.000000
10 10 10 10 10 10 10 10 10.000000 10.000000 10.000000
11 11 11 11 11 11 11 11 11.000000 11.000000 11.000000
1 1 1 1 1 1 1 1 1.000000 1.000000 1.000000
2 2 2 2 2 2 2 2 2.000000 2.000000 2.000000
3 3 3 3 3 3 3 3 3.000000 3.000000 3.000000
4 4 4 4 4 4 4 4 4.000000 4.000000 4.000000
5 5 5 5 5 5 5 5 5.000000 5.000000 5.000000
6 6 6 6 6 6 6 6 6.000000 6.000000 6.000000
7 7 7 7 7 7 7 7 7.000000 7.000000 7.000000
8 8 8 8 8 8 8 8 8.000000 8.000000 8.000000
9 9 9 9 9 9 9 9 9.000000 9.000000 9.000000
10 10 10 10 10 10 10 10 10.000000 10.000000 10.000000
11 11 11 11 11 11 11 11 11.000000 11.000000 11.000000

4
lcc/alpha/osf/tst/cvt.2bk Normal file → Executable file
View file

@ -1,2 +1,2 @@
tst/cvt.c:32: warning: conversion from `pointer to void function(void)' to `pointer to void' is compiler dependent
tst/cvt.c:33: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent
tst/cvt.c:32: warning: conversion from `pointer to void function(void)' to `pointer to void' is compiler dependent
tst/cvt.c:33: warning: conversion from `pointer to void' to `pointer to void function(void)' is compiler dependent

1488
lcc/alpha/osf/tst/cvt.sbk Normal file → Executable file

File diff suppressed because it is too large Load diff

10
lcc/alpha/osf/tst/fields.1bk Normal file → Executable file
View file

@ -1,5 +1,5 @@
x = 1 2 3 4 -3 6
y = 3 8 9
x = 1 2 3 0 0 6
y = 2 8 16
p->a = 0x3, p->b = 0xf
x = 1 2 3 4 -3 6
y = 3 8 9
x = 1 2 3 0 0 6
y = 2 8 16
p->a = 0x3, p->b = 0xf

8
lcc/alpha/osf/tst/fields.2bk Normal file → Executable file
View file

@ -1,4 +1,4 @@
tst/fields.c:6: warning: initializer exceeds bit-field width
tst/fields.c:8: warning: initializer exceeds bit-field width
tst/fields.c:30: warning: missing return value
tst/fields.c:34: warning: missing return value
tst/fields.c:6: warning: initializer exceeds bit-field width
tst/fields.c:8: warning: initializer exceeds bit-field width
tst/fields.c:30: warning: missing return value
tst/fields.c:34: warning: missing return value

650
lcc/alpha/osf/tst/fields.sbk Normal file → Executable file
View file

@ -1,325 +1,325 @@
.sdata
.globl x
.align 2
x:
.long 0x1
.byte 0x2
.space 3
.byte 0x3
.byte 0x40
.space 2
.byte 0x50
.byte 0x6
.space 2
.globl i
.align 2
i:
.long 0x10
.globl y
.align 2
y:
.byte 0x23
.space 3
.byte 0x9
.byte 0x0
.byte 0x0
.byte 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-72
.frame $sp,80,$26,48
stq $26,8($sp)
.prologue 1
lda $16,L.4
ldl $17,x
lda $27,x+4
ldb $18,($27)
ldl $27,x+8
sll $27,20,$27
addl $27,0,$27
sra $27,20,$19
addl $19,0,$19
ldl $27,x+8
sll $27,16,$27
addl $27,0,$27
sra $27,28,$20
addl $20,0,$20
ldl $27,x+12
sll $27,25,$27
addl $27,0,$27
sra $27,29,$21
addl $21,0,$21
lda $27,x+13
ldb $27,($27)
stq $27,0($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.10
ldl $27,y
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
ldl $19,y+4
zap $19,240,$19
jsr $26,printf
ldgp $gp,0($26)
ldl $27,x+8
and $27,0xffff0fff,$27
ldl $25,i
sll $25,28,$25
addl $25,0,$25
sra $25,28,$25
addl $25,0,$25
sll $25,12,$25
zap $25,240,$25
and $25,0xf000,$25
or $27,$25,$27
stl $27,x+8
ldl $27,x+12
and $27,0xffffff8f,$27
stl $27,x+12
lda $16,L.4
ldl $17,x
lda $27,x+4
ldb $18,($27)
ldl $27,x+8
sll $27,20,$27
addl $27,0,$27
sra $27,20,$19
addl $19,0,$19
ldl $27,x+8
sll $27,16,$27
addl $27,0,$27
sra $27,28,$20
addl $20,0,$20
ldl $27,x+12
sll $27,25,$27
addl $27,0,$27
sra $27,29,$21
addl $21,0,$21
lda $27,x+13
ldb $27,($27)
stq $27,0($sp)
jsr $26,printf
ldgp $gp,0($26)
ldl $27,y
zap $27,240,$27
and $27,0xfffffffc,$27
or $27,2,$27
stl $27,y
ldl $27,i
stl $27,y+4
lda $16,L.10
ldl $27,y
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
ldl $19,y+4
zap $19,240,$19
jsr $26,printf
ldgp $gp,0($26)
lda $16,x
jsr $26,f2
ldgp $gp,0($26)
mov $31,$0
L.3:
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl f1
.text
.ent f1
f1:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
mov $16,$14
.prologue 1
ldl $27,($14)
zap $27,240,$27
and $27,0xffffffc3,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
and $27,0xfffffffc,$27
and $31,3,$25
and $25,3,$25
or $27,$25,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
and $27,60,$27
cmpeq $27,$31,$23
bne $23,L.22
lda $16,L.24
jsr $26,printf
ldgp $gp,0($26)
L.22:
ldl $27,($14)
zap $27,240,$27
or $27,3,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
or $27,60,$27
stl $27,($14)
lda $16,L.25
ldl $27,($14)
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.21:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f1
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
ldl $27,i
cmpeq $27,$31,$23
beq $23,L.28
lda $13,1
br L.29
L.28:
mov $31,$13
L.29:
ldl $27,($14)
zap $27,240,$27
and $27,0xfffffffc,$27
mov $13,$25
and $25,3,$25
and $25,3,$25
or $27,$25,$27
stl $27,($14)
mov $14,$16
jsr $26,f1
ldgp $gp,0($26)
ldl $27,($14)
zap $27,240,$27
and $27,0xffffffc3,$27
mov $31,$25
and $25,15,$25
sll $25,2,$25
zap $25,240,$25
and $25,60,$25
or $27,$25,$27
stl $27,($14)
mov $31,$0
L.26:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end f2
.rdata
.align 0
L.25:
.byte 112
.byte 45
.byte 62
.byte 97
.byte 32
.byte 61
.byte 32
.byte 48
.byte 120
.byte 37
.byte 120
.byte 44
.byte 32
.byte 112
.byte 45
.byte 62
.byte 98
.byte 32
.byte 61
.byte 32
.byte 48
.byte 120
.byte 37
.byte 120
.byte 10
.byte 0
.align 0
L.24:
.byte 112
.byte 45
.byte 62
.byte 98
.byte 32
.byte 33
.byte 61
.byte 32
.byte 48
.byte 33
.byte 10
.byte 0
.align 0
L.10:
.byte 121
.byte 32
.byte 61
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.4:
.byte 120
.byte 32
.byte 61
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 10
.byte 0
.sdata
.globl x
.align 2
x:
.long 0x1
.byte 0x2
.space 3
.byte 0x3
.byte 0x40
.space 2
.byte 0x50
.byte 0x6
.space 2
.globl i
.align 2
i:
.long 0x10
.globl y
.align 2
y:
.byte 0x23
.space 3
.byte 0x9
.byte 0x0
.byte 0x0
.byte 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-72
.frame $sp,80,$26,48
stq $26,8($sp)
.prologue 1
lda $16,L.4
ldl $17,x
lda $27,x+4
ldb $18,($27)
ldl $27,x+8
sll $27,20,$27
addl $27,0,$27
sra $27,20,$19
addl $19,0,$19
ldl $27,x+8
sll $27,16,$27
addl $27,0,$27
sra $27,28,$20
addl $20,0,$20
ldl $27,x+12
sll $27,25,$27
addl $27,0,$27
sra $27,29,$21
addl $21,0,$21
lda $27,x+13
ldb $27,($27)
stq $27,0($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.10
ldl $27,y
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
ldl $19,y+4
zap $19,240,$19
jsr $26,printf
ldgp $gp,0($26)
ldl $27,x+8
and $27,0xffff0fff,$27
ldl $25,i
sll $25,28,$25
addl $25,0,$25
sra $25,28,$25
addl $25,0,$25
sll $25,12,$25
zap $25,240,$25
and $25,0xf000,$25
or $27,$25,$27
stl $27,x+8
ldl $27,x+12
and $27,0xffffff8f,$27
stl $27,x+12
lda $16,L.4
ldl $17,x
lda $27,x+4
ldb $18,($27)
ldl $27,x+8
sll $27,20,$27
addl $27,0,$27
sra $27,20,$19
addl $19,0,$19
ldl $27,x+8
sll $27,16,$27
addl $27,0,$27
sra $27,28,$20
addl $20,0,$20
ldl $27,x+12
sll $27,25,$27
addl $27,0,$27
sra $27,29,$21
addl $21,0,$21
lda $27,x+13
ldb $27,($27)
stq $27,0($sp)
jsr $26,printf
ldgp $gp,0($26)
ldl $27,y
zap $27,240,$27
and $27,0xfffffffc,$27
or $27,2,$27
stl $27,y
ldl $27,i
stl $27,y+4
lda $16,L.10
ldl $27,y
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
ldl $19,y+4
zap $19,240,$19
jsr $26,printf
ldgp $gp,0($26)
lda $16,x
jsr $26,f2
ldgp $gp,0($26)
mov $31,$0
L.3:
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl f1
.text
.ent f1
f1:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
mov $16,$14
.prologue 1
ldl $27,($14)
zap $27,240,$27
and $27,0xffffffc3,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
and $27,0xfffffffc,$27
and $31,3,$25
and $25,3,$25
or $27,$25,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
and $27,60,$27
cmpeq $27,$31,$23
bne $23,L.22
lda $16,L.24
jsr $26,printf
ldgp $gp,0($26)
L.22:
ldl $27,($14)
zap $27,240,$27
or $27,3,$27
stl $27,($14)
ldl $27,($14)
zap $27,240,$27
or $27,60,$27
stl $27,($14)
lda $16,L.25
ldl $27,($14)
zap $27,240,$27
and $27,3,$17
srl $27,2,$27
and $27,15,$18
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.21:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f1
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
ldl $27,i
cmpeq $27,$31,$23
beq $23,L.28
lda $13,1
br L.29
L.28:
mov $31,$13
L.29:
ldl $27,($14)
zap $27,240,$27
and $27,0xfffffffc,$27
mov $13,$25
and $25,3,$25
and $25,3,$25
or $27,$25,$27
stl $27,($14)
mov $14,$16
jsr $26,f1
ldgp $gp,0($26)
ldl $27,($14)
zap $27,240,$27
and $27,0xffffffc3,$27
mov $31,$25
and $25,15,$25
sll $25,2,$25
zap $25,240,$25
and $25,60,$25
or $27,$25,$27
stl $27,($14)
mov $31,$0
L.26:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end f2
.rdata
.align 0
L.25:
.byte 112
.byte 45
.byte 62
.byte 97
.byte 32
.byte 61
.byte 32
.byte 48
.byte 120
.byte 37
.byte 120
.byte 44
.byte 32
.byte 112
.byte 45
.byte 62
.byte 98
.byte 32
.byte 61
.byte 32
.byte 48
.byte 120
.byte 37
.byte 120
.byte 10
.byte 0
.align 0
L.24:
.byte 112
.byte 45
.byte 62
.byte 98
.byte 32
.byte 33
.byte 61
.byte 32
.byte 48
.byte 33
.byte 10
.byte 0
.align 0
L.10:
.byte 121
.byte 32
.byte 61
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.4:
.byte 120
.byte 32
.byte 61
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 10
.byte 0

58
lcc/alpha/osf/tst/front.2bk Normal file → Executable file
View file

@ -1,29 +1,29 @@
tst/front.c:3: warning: missing return value
tst/front.c:10: warning: missing return value
tst/front.c:20: type error in argument 1 to `s'; found `pointer to struct D' expected `pointer to incomplete struct D defined at tst/front.c:14'
tst/front.c:21: warning: missing return value
tst/front.c:32: warning: missing return value
tst/front.c:36: operands of = have illegal types `pointer to int' and `pointer to const int'
tst/front.c:38: warning: missing return value
tst/front.c:62: operands of = have illegal types `pointer to char' and `pointer to const void'
tst/front.c:63: warning: missing return value
tst/front.c:68: warning: missing return value
tst/front.c:69: warning: inconsistent linkage for `yy' previously declared at tst/front.c:68
tst/front.c:69: warning: missing return value
tst/front.c:71: invalid storage class `static' for `int function goo'
tst/front.c:71: warning: declaration of `goo' does not match previous declaration at tst/front.c:70
tst/front.c:71: warning: missing return value
tst/front.c:74: warning: declaration of `xr' does not match previous declaration at tst/front.c:72
tst/front.c:74: warning: missing return value
tst/front.c:81: warning: missing return value
tst/front.c:82: warning: declaration of `ss2' does not match previous declaration at tst/front.c:81
tst/front.c:84: warning: inconsistent linkage for `ss5' previously declared at tst/front.c:80
tst/front.c:92: type error in argument 1 to `gx1'; found `pointer to double' expected `double'
tst/front.c:92: warning: missing return value
tst/front.c:95: redeclaration of `hx1' previously declared at tst/front.c:94
tst/front.c:98: warning: missing return value
tst/front.c:101: conflicting argument declarations for function `gg1'
tst/front.c:101: warning: missing return value
tst/front.c:112: type error in argument 4 to `qsort'; found `pointer to int function(pointer to pointer to char,pointer to pointer to char)' expected `pointer to int function(pointer to const void,pointer to const void)'
tst/front.c:113: warning: missing return value
tst/front.c:120: warning: missing return value
tst/front.c:3: warning: missing return value
tst/front.c:10: warning: missing return value
tst/front.c:20: type error in argument 1 to `s'; found `pointer to struct D' expected `pointer to incomplete struct D defined at tst/front.c:14'
tst/front.c:21: warning: missing return value
tst/front.c:32: warning: missing return value
tst/front.c:36: operands of = have illegal types `pointer to int' and `pointer to const int'
tst/front.c:38: warning: missing return value
tst/front.c:62: operands of = have illegal types `pointer to char' and `pointer to const void'
tst/front.c:63: warning: missing return value
tst/front.c:68: warning: missing return value
tst/front.c:69: warning: inconsistent linkage for `yy' previously declared at tst/front.c:68
tst/front.c:69: warning: missing return value
tst/front.c:71: invalid storage class `static' for `int function goo'
tst/front.c:71: warning: declaration of `goo' does not match previous declaration at tst/front.c:70
tst/front.c:71: warning: missing return value
tst/front.c:74: warning: declaration of `xr' does not match previous declaration at tst/front.c:72
tst/front.c:74: warning: missing return value
tst/front.c:81: warning: missing return value
tst/front.c:82: warning: declaration of `ss2' does not match previous declaration at tst/front.c:81
tst/front.c:84: warning: inconsistent linkage for `ss5' previously declared at tst/front.c:80
tst/front.c:92: type error in argument 1 to `gx1'; found `pointer to double' expected `double'
tst/front.c:92: warning: missing return value
tst/front.c:95: redeclaration of `hx1' previously declared at tst/front.c:94
tst/front.c:98: warning: missing return value
tst/front.c:101: conflicting argument declarations for function `gg1'
tst/front.c:101: warning: missing return value
tst/front.c:112: type error in argument 4 to `qsort'; found `pointer to int function(pointer to pointer to char,pointer to pointer to char)' expected `pointer to int function(pointer to const void,pointer to const void)'
tst/front.c:113: warning: missing return value
tst/front.c:120: warning: missing return value

760
lcc/alpha/osf/tst/front.sbk Normal file → Executable file
View file

@ -1,380 +1,380 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
mov $31,$16
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end main
.globl nested
.text
.ent nested
nested:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
cmplt $16,4,$23
beq $23,L.6
lda $27,114
cmpeq $17,$27,$23
bne $23,L.9
L.6:
cmpeq $16,1,$23
beq $23,L.8
lda $27,104
cmpeq $17,$27,$23
bne $23,L.9
lda $27,105
cmpeq $17,$27,$23
bne $23,L.9
L.8:
cmpeq $16,2,$23
beq $23,L.3
lda $27,111
cmpeq $17,$27,$23
bne $23,L.9
lda $27,121
cmpeq $17,$27,$23
beq $23,L.3
L.9:
mov $17,$16
L.3:
mov $31,$0
L.2:
lda $sp,64($sp)
ret
.end nested
.globl s
.text
.ent s
s:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
L.10:
lda $sp,64($sp)
ret
.end s
.sdata
.globl Dy
.align 2
Dy:
.long 0x0
.space 4
.globl Dz
.align 2
Dz:
.long 0x1
.space 4
.globl Dfunc
.text
.text
.ent Dfunc
Dfunc:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end Dfunc
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end f
.globl f1
.text
.ent f1
f1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end f1
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end f2
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end g
.globl h
.text
.ent h
h:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end h
.globl h1
.text
.ent h1
h1:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end h1
.globl h2
.text
.ent h2
h2:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end h2
.sdata
.align 2
L.21:
.long 0x1
.globl set1
.text
.text
.ent set1
set1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end set1
.sdata
.align 2
L.23:
.long 0x2
.globl set2
.text
.text
.ent set2
set2:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end set2
.text
.ent goo
goo:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end goo
.globl sss
.text
.ent sss
sss:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end sss
.lcomm L.27,4
.globl rrr
.text
.text
.ent rrr
rrr:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end rrr
.globl setstatic
.text
.ent setstatic
setstatic:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end setstatic
.globl gx1
.text
.ent gx1
gx1:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stt $f16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end gx1
.globl ff1
.text
.ent ff1
ff1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end ff1
.globl gg1
.text
.ent gg1
gg1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end gg1
.globl hh1
.text
.ent hh1
hh1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end hh1
.globl cmp
.text
.ent cmp
cmp:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end cmp
.globl sort
.text
.ent sort
sort:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end sort
.globl onearg
.text
.ent onearg
onearg:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end onearg
.extern xr 4
.globl ss4
.comm ss4,4
.lcomm ss2,4
.lcomm ss5,4
.globl ss3
.comm ss3,4
.lcomm ss1,4
.lcomm yy,4
.globl z
.comm z,4
.globl y
.comm y,8
.globl x
.comm x,8
.globl b
.comm b,4
.globl a
.comm a,4
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
mov $31,$16
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end main
.globl nested
.text
.ent nested
nested:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
cmplt $16,4,$23
beq $23,L.6
lda $27,114
cmpeq $17,$27,$23
bne $23,L.9
L.6:
cmpeq $16,1,$23
beq $23,L.8
lda $27,104
cmpeq $17,$27,$23
bne $23,L.9
lda $27,105
cmpeq $17,$27,$23
bne $23,L.9
L.8:
cmpeq $16,2,$23
beq $23,L.3
lda $27,111
cmpeq $17,$27,$23
bne $23,L.9
lda $27,121
cmpeq $17,$27,$23
beq $23,L.3
L.9:
mov $17,$16
L.3:
mov $31,$0
L.2:
lda $sp,64($sp)
ret
.end nested
.globl s
.text
.ent s
s:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
L.10:
lda $sp,64($sp)
ret
.end s
.sdata
.globl Dy
.align 2
Dy:
.long 0x0
.space 4
.globl Dz
.align 2
Dz:
.long 0x1
.space 4
.globl Dfunc
.text
.text
.ent Dfunc
Dfunc:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end Dfunc
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end f
.globl f1
.text
.ent f1
f1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end f1
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end f2
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end g
.globl h
.text
.ent h
h:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end h
.globl h1
.text
.ent h1
h1:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end h1
.globl h2
.text
.ent h2
h2:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end h2
.sdata
.align 2
L.21:
.long 0x1
.globl set1
.text
.text
.ent set1
set1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end set1
.sdata
.align 2
L.23:
.long 0x2
.globl set2
.text
.text
.ent set2
set2:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end set2
.text
.ent goo
goo:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end goo
.globl sss
.text
.ent sss
sss:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end sss
.lcomm L.27,4
.globl rrr
.text
.text
.ent rrr
rrr:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end rrr
.globl setstatic
.text
.ent setstatic
setstatic:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end setstatic
.globl gx1
.text
.ent gx1
gx1:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stt $f16,16($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end gx1
.globl ff1
.text
.ent ff1
ff1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end ff1
.globl gg1
.text
.ent gg1
gg1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end gg1
.globl hh1
.text
.ent hh1
hh1:
ldgp $gp,0($27)
lda $sp,-48($sp)
.frame $sp,48,$26,48
.prologue 1
lda $sp,48($sp)
ret
.end hh1
.globl cmp
.text
.ent cmp
cmp:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end cmp
.globl sort
.text
.ent sort
sort:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end sort
.globl onearg
.text
.ent onearg
onearg:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end onearg
.extern xr 4
.globl ss4
.comm ss4,4
.lcomm ss2,4
.lcomm ss5,4
.globl ss3
.comm ss3,4
.lcomm ss1,4
.lcomm yy,4
.globl z
.comm z,4
.globl y
.comm y,8
.globl x
.comm x,8
.globl b
.comm b,4
.globl a
.comm a,4

0
lcc/alpha/osf/tst/incr.1bk Normal file → Executable file
View file

18
lcc/alpha/osf/tst/incr.2bk Normal file → Executable file
View file

@ -1,9 +1,9 @@
tst/incr.c:1: warning: missing return value
tst/incr.c:6: warning: expression with no effect elided
tst/incr.c:6: warning: expression with no effect elided
tst/incr.c:11: warning: missing return value
tst/incr.c:16: warning: expression with no effect elided
tst/incr.c:16: warning: expression with no effect elided
tst/incr.c:21: warning: missing return value
tst/incr.c:30: warning: missing return value
tst/incr.c:39: warning: missing return value
tst/incr.c:1: warning: missing return value
tst/incr.c:6: warning: expression with no effect elided
tst/incr.c:6: warning: expression with no effect elided
tst/incr.c:11: warning: missing return value
tst/incr.c:16: warning: expression with no effect elided
tst/incr.c:16: warning: expression with no effect elided
tst/incr.c:21: warning: missing return value
tst/incr.c:30: warning: missing return value
tst/incr.c:39: warning: missing return value

302
lcc/alpha/osf/tst/incr.sbk Normal file → Executable file
View file

@ -1,151 +1,151 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
mov $31,$0
L.1:
lda $sp,64($sp)
ret
.end main
.globl memchar
.text
.ent memchar
memchar:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5000000,-88
.frame $sp,96,$26,48
stq $24,0($sp)
stq $26,8($sp)
.prologue 1
ldq $27,-72+96($sp)
lda $25,1($27)
stq $25,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $27,1($27)
stq $27,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $25,-1($27)
stq $25,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $27,-1($27)
stq $27,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
mov $31,$0
L.2:
ldq $24,0($sp)
ldq $26,8($sp)
lda $sp,96($sp)
ret
.end memchar
.globl memint
.text
.ent memint
memint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.frame $sp,80,$26,48
.prologue 1
ldq $27,-72+80($sp)
lda $25,4($27)
stq $25,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $27,4($27)
stq $27,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $25,-4($27)
stq $25,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $27,-4($27)
stq $27,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
mov $31,$0
L.3:
lda $sp,80($sp)
ret
.end memint
.globl regchar
.text
.ent regchar
regchar:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5006000,-72
.frame $sp,96,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
.prologue 1
mov $13,$27
lda $13,1($27)
ldb $14,($27)
lda $27,1($13)
mov $27,$13
ldb $14,($27)
mov $13,$27
lda $13,-1($27)
ldb $14,($27)
lda $27,-1($13)
mov $27,$13
ldb $14,($27)
mov $31,$0
L.4:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,96($sp)
ret
.end regchar
.globl regint
.text
.ent regint
regint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $13,$27
lda $13,4($27)
ldl $14,($27)
lda $27,4($13)
mov $27,$13
ldl $14,($27)
mov $13,$27
lda $13,-4($27)
ldl $14,($27)
lda $27,-4($13)
mov $27,$13
ldl $14,($27)
mov $31,$0
L.5:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end regint
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
mov $31,$0
L.1:
lda $sp,64($sp)
ret
.end main
.globl memchar
.text
.ent memchar
memchar:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5000000,-88
.frame $sp,96,$26,48
stq $24,0($sp)
stq $26,8($sp)
.prologue 1
ldq $27,-72+96($sp)
lda $25,1($27)
stq $25,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $27,1($27)
stq $27,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $25,-1($27)
stq $25,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
ldq $27,-72+96($sp)
lda $27,-1($27)
stq $27,-72+96($sp)
ldb $27,($27)
stb $27,-57+96($sp)
mov $31,$0
L.2:
ldq $24,0($sp)
ldq $26,8($sp)
lda $sp,96($sp)
ret
.end memchar
.globl memint
.text
.ent memint
memint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.frame $sp,80,$26,48
.prologue 1
ldq $27,-72+80($sp)
lda $25,4($27)
stq $25,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $27,4($27)
stq $27,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $25,-4($27)
stq $25,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
ldq $27,-72+80($sp)
lda $27,-4($27)
stq $27,-72+80($sp)
ldl $27,($27)
stl $27,-60+80($sp)
mov $31,$0
L.3:
lda $sp,80($sp)
ret
.end memint
.globl regchar
.text
.ent regchar
regchar:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5006000,-72
.frame $sp,96,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
.prologue 1
mov $13,$27
lda $13,1($27)
ldb $14,($27)
lda $27,1($13)
mov $27,$13
ldb $14,($27)
mov $13,$27
lda $13,-1($27)
ldb $14,($27)
lda $27,-1($13)
mov $27,$13
ldb $14,($27)
mov $31,$0
L.4:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,96($sp)
ret
.end regchar
.globl regint
.text
.ent regint
regint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $13,$27
lda $13,4($27)
ldl $14,($27)
lda $27,4($13)
mov $27,$13
ldl $14,($27)
mov $13,$27
lda $13,-4($27)
ldl $14,($27)
lda $27,-4($13)
mov $27,$13
ldl $14,($27)
mov $31,$0
L.5:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end regint

32
lcc/alpha/osf/tst/init.1bk Normal file → Executable file
View file

@ -1,16 +1,16 @@
1 2 3 4
5 6
7
if
for
else
while
1 2 3 if
4 5 0 for
6 7 8 else
9 10 11 while
1 2 3 if
4 5 0 for
6 7 8 else
9 10 11 while
0 0 0
1 2 3 4
5 6
7
if
for
else
while
1 2 3 if
4 5 0 for
6 7 8 else
9 10 11 while
1 2 3 if
4 5 0 for
6 7 8 else
9 10 11 while
0 0 0

6
lcc/alpha/osf/tst/init.2bk Normal file → Executable file
View file

@ -1,3 +1,3 @@
tst/init.c:36: warning: missing return value
tst/init.c:49: warning: missing return value
tst/init.c:59: warning: missing return value
tst/init.c:36: warning: missing return value
tst/init.c:49: warning: missing return value
tst/init.c:59: warning: missing return value

666
lcc/alpha/osf/tst/init.sbk Normal file → Executable file
View file

@ -1,333 +1,333 @@
.sdata
.globl words
.align 2
words:
.long 0x1
.long 0x2
.long 0x3
.byte 105
.byte 102
.byte 0
.space 3
.space 2
.long 0x4
.long 0x5
.space 4
.byte 102
.byte 111
.byte 114
.space 3
.space 2
.long 0x6
.long 0x7
.long 0x8
.byte 101
.byte 108
.byte 115
.byte 101
.byte 0
.space 1
.space 2
.long 0x9
.long 0xa
.long 0xb
.byte 119
.byte 104
.byte 105
.byte 108
.byte 101
.space 1
.space 2
.long 0x0
.space 8
.space 8
.globl wordlist
.align 3
wordlist:
.quad words
.globl x
.align 2
x:
.long 0x1
.long 0x2
.long 0x3
.long 0x4
.long 0x0
.long 0x5
.long 0x6
.space 12
.long 0x7
.space 16
.globl y
.align 3
y:
.quad x
.quad x+20
.quad x+40
.quad 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $31,$13
br L.8
L.5:
mov $31,$14
br L.12
L.9:
lda $16,L.13
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.10:
lda $14,1($14)
L.12:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $27,($27)
cmpeq $27,$31,$23
beq $23,L.9
lda $16,L.14
jsr $26,printf
ldgp $gp,0($26)
L.6:
lda $13,1($13)
L.8:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
ldq $27,y($27)
cmpeq $27,$31,$23
beq $23,L.5
jsr $26,f
ldgp $gp,0($26)
ldq $16,wordlist
jsr $26,g
ldgp $gp,0($26)
mov $31,$0
L.4:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end main
.sdata
.align 3
L.16:
.quad L.17
.quad L.18
.quad L.19
.quad L.20
.quad 0x0
.globl f
.text
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $14,L.16
br L.24
L.21:
lda $16,L.25
ldq $17,($14)
jsr $26,printf
ldgp $gp,0($26)
L.22:
lda $14,8($14)
L.24:
ldq $27,($14)
cmpeq $27,$31,$23
beq $23,L.21
mov $31,$0
L.15:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
br L.30
L.27:
mov $31,$13
br L.34
L.31:
lda $16,L.35
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.32:
lda $13,1($13)
L.34:
mov $13,$27
lda $25,3
cmpult $27,$25,$23
bne $23,L.31
lda $16,L.25
lda $17,12($14)
jsr $26,printf
ldgp $gp,0($26)
L.28:
lda $14,20($14)
L.30:
ldl $27,($14)
cmpeq $27,$31,$23
beq $23,L.27
jsr $26,h
ldgp $gp,0($26)
mov $31,$0
L.26:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end g
.globl h
.text
.ent h
h:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
br L.40
L.37:
lda $16,L.41
lda $27,20
sll $14,8*(8-4),$25
sra $25,8*(8-4),$25
mulq $27,$25,$27
ldl $17,words($27)
ldl $18,words+4($27)
ldl $19,words+8($27)
lda $20,words+12($27)
jsr $26,printf
ldgp $gp,0($26)
L.38:
lda $14,1($14)
L.40:
mov $14,$27
lda $25,5
cmpult $27,$25,$23
bne $23,L.37
mov $31,$0
L.36:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end h
.rdata
.align 0
L.41:
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.35:
.byte 37
.byte 100
.byte 32
.byte 0
.align 0
L.25:
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.20:
.byte 119
.byte 104
.byte 105
.byte 108
.byte 101
.byte 0
.align 0
L.19:
.byte 101
.byte 108
.byte 115
.byte 101
.byte 0
.align 0
L.18:
.byte 102
.byte 111
.byte 114
.byte 0
.align 0
L.17:
.byte 105
.byte 102
.byte 0
.align 0
L.14:
.byte 10
.byte 0
.align 0
L.13:
.byte 32
.byte 37
.byte 100
.byte 0
.sdata
.globl words
.align 2
words:
.long 0x1
.long 0x2
.long 0x3
.byte 105
.byte 102
.byte 0
.space 3
.space 2
.long 0x4
.long 0x5
.space 4
.byte 102
.byte 111
.byte 114
.space 3
.space 2
.long 0x6
.long 0x7
.long 0x8
.byte 101
.byte 108
.byte 115
.byte 101
.byte 0
.space 1
.space 2
.long 0x9
.long 0xa
.long 0xb
.byte 119
.byte 104
.byte 105
.byte 108
.byte 101
.space 1
.space 2
.long 0x0
.space 8
.space 8
.globl wordlist
.align 3
wordlist:
.quad words
.globl x
.align 2
x:
.long 0x1
.long 0x2
.long 0x3
.long 0x4
.long 0x0
.long 0x5
.long 0x6
.space 12
.long 0x7
.space 16
.globl y
.align 3
y:
.quad x
.quad x+20
.quad x+40
.quad 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
.prologue 1
mov $31,$13
br L.8
L.5:
mov $31,$14
br L.12
L.9:
lda $16,L.13
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.10:
lda $14,1($14)
L.12:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
sll $13,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldq $25,y($25)
addq $27,$25,$27
ldl $27,($27)
cmpeq $27,$31,$23
beq $23,L.9
lda $16,L.14
jsr $26,printf
ldgp $gp,0($26)
L.6:
lda $13,1($13)
L.8:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
ldq $27,y($27)
cmpeq $27,$31,$23
beq $23,L.5
jsr $26,f
ldgp $gp,0($26)
ldq $16,wordlist
jsr $26,g
ldgp $gp,0($26)
mov $31,$0
L.4:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end main
.sdata
.align 3
L.16:
.quad L.17
.quad L.18
.quad L.19
.quad L.20
.quad 0x0
.globl f
.text
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $14,L.16
br L.24
L.21:
lda $16,L.25
ldq $17,($14)
jsr $26,printf
ldgp $gp,0($26)
L.22:
lda $14,8($14)
L.24:
ldq $27,($14)
cmpeq $27,$31,$23
beq $23,L.21
mov $31,$0
L.15:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f
.globl g
.text
.ent g
g:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4006000,-64
.frame $sp,80,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
br L.30
L.27:
mov $31,$13
br L.34
L.31:
lda $16,L.35
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.32:
lda $13,1($13)
L.34:
mov $13,$27
lda $25,3
cmpult $27,$25,$23
bne $23,L.31
lda $16,L.25
lda $17,12($14)
jsr $26,printf
ldgp $gp,0($26)
L.28:
lda $14,20($14)
L.30:
ldl $27,($14)
cmpeq $27,$31,$23
beq $23,L.27
jsr $26,h
ldgp $gp,0($26)
mov $31,$0
L.26:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end g
.globl h
.text
.ent h
h:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
mov $31,$14
br L.40
L.37:
lda $16,L.41
lda $27,20
sll $14,8*(8-4),$25
sra $25,8*(8-4),$25
mulq $27,$25,$27
ldl $17,words($27)
ldl $18,words+4($27)
ldl $19,words+8($27)
lda $20,words+12($27)
jsr $26,printf
ldgp $gp,0($26)
L.38:
lda $14,1($14)
L.40:
mov $14,$27
lda $25,5
cmpult $27,$25,$23
bne $23,L.37
mov $31,$0
L.36:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end h
.rdata
.align 0
L.41:
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.35:
.byte 37
.byte 100
.byte 32
.byte 0
.align 0
L.25:
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.20:
.byte 119
.byte 104
.byte 105
.byte 108
.byte 101
.byte 0
.align 0
L.19:
.byte 101
.byte 108
.byte 115
.byte 101
.byte 0
.align 0
L.18:
.byte 102
.byte 111
.byte 114
.byte 0
.align 0
L.17:
.byte 105
.byte 102
.byte 0
.align 0
L.14:
.byte 10
.byte 0
.align 0
L.13:
.byte 32
.byte 37
.byte 100
.byte 0

28
lcc/alpha/osf/tst/limits.1bk Normal file → Executable file
View file

@ -1,14 +1,14 @@
UCHAR_MAX: 000000ff=255
USHRT_MAX: 0000ffff=65535
UINT_MAX: ffffffff=-1
ULONG_MAX: ffffffffffffffff=-1
CHAR_MAX: 0000007f=127
SCHAR_MAX: 0000007f=127
SHRT_MAX: 00007fff=32767
INT_MAX: 7fffffff=2147483647
LONG_MAX: 7fffffffffffffff=9223372036854775807
CHAR_MIN: ffffff80=-128
SCHAR_MIN: ffffff80=-128
SHRT_MIN: ffff8000=-32768
INT_MIN: 80000000=-2147483648
LONG_MIN: 8000000000000000=-9223372036854775808
UCHAR_MAX: 000000ff=255
USHRT_MAX: 0000ffff=65535
UINT_MAX: ffffffff=-1
ULONG_MAX: ffffffffffffffff=-1
CHAR_MAX: 0000007f=127
SCHAR_MAX: 0000007f=127
SHRT_MAX: 00007fff=32767
INT_MAX: 7fffffff=2147483647
LONG_MAX: 7fffffffffffffff=9223372036854775807
CHAR_MIN: ffffff80=-128
SCHAR_MIN: ffffff80=-128
SHRT_MIN: ffff8000=-32768
INT_MIN: 80000000=-2147483648
LONG_MIN: 8000000000000000=-9223372036854775808

0
lcc/alpha/osf/tst/limits.2bk Normal file → Executable file
View file

810
lcc/alpha/osf/tst/limits.sbk Normal file → Executable file
View file

@ -1,405 +1,405 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
lda $16,L.2
lda $27,255
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.3
lda $27,65535
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.4
lda $27,0xffffffff
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.5
lda $27,0xffffffffffffffff
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.6
lda $27,127
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.7
lda $27,127
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.8
lda $27,32767
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.9
lda $27,2147483647
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.10
lda $27,9223372036854775807
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.11
lda $27,-128
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.12
lda $27,-128
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.13
lda $27,-32768
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.14
lda $27,-2147483648
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.15
lda $27,-9223372036854775808
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end main
.rdata
.align 0
L.15:
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.14:
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.13:
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.12:
.byte 83
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.11:
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.10:
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.9:
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.8:
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.7:
.byte 83
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.6:
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.5:
.byte 85
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.4:
.byte 85
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.3:
.byte 85
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.2:
.byte 85
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
.prologue 1
lda $16,L.2
lda $27,255
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.3
lda $27,65535
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.4
lda $27,0xffffffff
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.5
lda $27,0xffffffffffffffff
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.6
lda $27,127
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.7
lda $27,127
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.8
lda $27,32767
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.9
lda $27,2147483647
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.10
lda $27,9223372036854775807
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.11
lda $27,-128
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.12
lda $27,-128
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.13
lda $27,-32768
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.14
lda $27,-2147483648
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
lda $16,L.15
lda $27,-9223372036854775808
mov $27,$17
mov $27,$18
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end main
.rdata
.align 0
L.15:
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.14:
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.13:
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.12:
.byte 83
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.11:
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 73
.byte 78
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.10:
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.9:
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.8:
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.7:
.byte 83
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.6:
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.5:
.byte 85
.byte 76
.byte 79
.byte 78
.byte 71
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 108
.byte 120
.byte 61
.byte 37
.byte 108
.byte 100
.byte 10
.byte 0
.align 0
L.4:
.byte 85
.byte 73
.byte 78
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.3:
.byte 85
.byte 83
.byte 72
.byte 82
.byte 84
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0
.align 0
L.2:
.byte 85
.byte 67
.byte 72
.byte 65
.byte 82
.byte 95
.byte 77
.byte 65
.byte 88
.byte 58
.byte 9
.byte 37
.byte 48
.byte 56
.byte 120
.byte 61
.byte 37
.byte 100
.byte 10
.byte 0

390
lcc/alpha/osf/tst/paranoia.1bk Normal file → Executable file
View file

@ -1,195 +1,195 @@
Lest this program stop prematurely, i.e. before displaying
`END OF TEST',
try to persuade the computer NOT to terminate execution when an
error like Over/Underflow or Division by Zero occurs, but rather
to persevere with a surrogate value after, perhaps, displaying some
warning. If persuasion avails naught, don't despair but run this
program anyway to see how many milestones it passes, and then
amend it to make further progress.
Answer questions with Y, y, N or n (unless otherwise indicated).
Diagnosis resumes after milestone Number 0 Page: 1
Users are invited to help debug and augment this program so it will
cope with unanticipated and newly uncovered arithmetic pathologies.
Please send suggestions and interesting results to
Richard Karpinski
Computer Center U-76
University of California
San Francisco, CA 94143-0704, USA
In doing so, please include the following information:
Precision: double;
Version: 10 February 1989;
Computer:
Compiler:
Optimization level:
Other relevant compiler options:
Diagnosis resumes after milestone Number 1 Page: 2
Running this program should reveal these characteristics:
Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...
Precision = number of significant digits carried.
U2 = Radix/Radix^Precision = One Ulp
(OneUlpnit in the Last Place) of 1.000xxx .
U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .
Adequacy of guard digits for Mult., Div. and Subt.
Whether arithmetic is chopped, correctly rounded, or something else
for Mult., Div., Add/Subt. and Sqrt.
Whether a Sticky Bit used correctly for rounding.
UnderflowThreshold = an underflow threshold.
E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.
V = an overflow threshold, roughly.
V0 tells, roughly, whether Infinity is represented.
Comparisions are checked for consistency with subtraction
and for contamination with pseudo-zeros.
Sqrt is tested. Y^X is not tested.
Extra-precise subexpressions are revealed but NOT YET tested.
Decimal-Binary conversion is NOT YET tested for accuracy.
Diagnosis resumes after milestone Number 2 Page: 3
The program attempts to discriminate among
FLAWs, like lack of a sticky bit,
Serious DEFECTs, like lack of a guard digit, and
FAILUREs, like 2+2 == 5 .
Failures may confound subsequent diagnoses.
The diagnostic capabilities of this program go beyond an earlier
program called `MACHAR', which can be found at the end of the
book `Software Manual for the Elementary Functions' (1980) by
W. J. Cody and W. Waite. Although both programs try to discover
the Radix, Precision and range (over/underflow thresholds)
of the arithmetic, this program tries to cope with a wider variety
of pathologies, and to say how well the arithmetic is implemented.
The program is based upon a conventional radix representation for
floating-point numbers, but also allows logarithmic encoding
as used by certain early WANG machines.
BASIC version of this program (C) 1983 by Prof. W. M. Kahan;
see source comments for more history.
Diagnosis resumes after milestone Number 3 Page: 4
Program is now RUNNING tests on small integers:
-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.
Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 1.1102230e-16 .
Recalculating radix and precision
confirms closest relative separation U1 .
Radix confirmed.
The number of significant digits of the Radix is 53.000000 .
Diagnosis resumes after milestone Number 30 Page: 5
Subtraction appears to be normalized, as it should be.
Checking for guard digit in *, /, and -.
*, /, and - appear to have guard digits, as they should.
Diagnosis resumes after milestone Number 40 Page: 6
Checking rounding on multiply, divide and add/subtract.
Multiplication appears to round correctly.
Division appears to round correctly.
Addition/Subtraction appears to round correctly.
Checking for sticky bit.
Sticky bit apparently used correctly.
Does Multiplication commute? Testing on 20 random pairs.
No failures found in 20 integer pairs.
Running test of square root(x).
Testing if sqrt(X * X) == X for 20 Integers X.
Test for sqrt monotonicity.
sqrt has passed a test for Monotonicity.
Testing whether sqrt is rounded or chopped.
Square root appears to be correctly rounded.
Diagnosis resumes after milestone Number 90 Page: 7
Testing powers Z^i for small Integers Z and i.
... no discrepancis found.
Seeking Underflow thresholds UfThold and E0.
Smallest strictly positive number found is E0 = 2.22507e-308 .
Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe.
What the machine gets for (Z + Z) / Z is 2.00000000000000000e+00 .
This is O.K., provided Over/Underflow has NOT just been signaled.
Diagnosis resumes after milestone Number 120 Page: 8
FLAW: X = 3.05947655544740190e-308
is not equal to Z = 2.22507385850720140e-308 .
yet X - Z yields 0.00000000000000000e+00 .
Should this NOT signal Underflow, this is a SERIOUS DEFECT
that causes confusion when innocent statements like
if (X == Z) ... else ... (f(X) - f(Z)) / (X - Z) ...
encounter Division by Zero although actually
X / Z = 1 + 0.375 .
The Underflow threshold is 2.22507385850720140e-308, below which
calculation may suffer larger Relative error than merely roundoff.
Since underflow occurs below the threshold
UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
only underflow should afflict the expression
(2.00000000000000000e+00) ^ (-1.02200000000000000e+03);
actually calculating yields: 0.00000000000000000e+00 .
This computed value is O.K.
Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065220e+00 as X -> 1.
Accuracy seems adequate.
Testing powers Z^Q at four nearly extreme values.
... no discrepancies found.
Diagnosis resumes after milestone Number 160 Page: 9
Searching for Overflow threshold:
This may generate an error.
* * * FLOATING-POINT ERROR * * *
Can `Z = -Y' overflow?
Trying it on Y = -8.98846567431157950e+307 .
Seems O.K.
Overflow threshold is V = 1.79769313486231570e+308 .
There is no saturation value because the system traps on overflow.
No Overflow should be signaled for V * 1 = 1.79769313486231570e+308
nor for V / 1 = 1.79769313486231570e+308 .
Any overflow signal separating this * from the one
above is a DEFECT.
Diagnosis resumes after milestone Number 190 Page: 10
What message and/or values does Division by Zero produce?
Trying to compute 1 / 0 produces ...
* * * FLOATING-POINT ERROR * * *
Trying to compute 0 / 0 produces ...
* * * FLOATING-POINT ERROR * * *
Diagnosis resumes after milestone Number 220 Page: 11
No failures, defects nor flaws have been discovered.
Rounding appears to conform to the proposed IEEE standard P754,
except for possibly Double Rounding during Gradual Underflow.
The arithmetic diagnosed appears to be Excellent!
A total of 3 floating point exceptions were registered.
END OF TEST.
Lest this program stop prematurely, i.e. before displaying
`END OF TEST',
try to persuade the computer NOT to terminate execution when an
error like Over/Underflow or Division by Zero occurs, but rather
to persevere with a surrogate value after, perhaps, displaying some
warning. If persuasion avails naught, don't despair but run this
program anyway to see how many milestones it passes, and then
amend it to make further progress.
Answer questions with Y, y, N or n (unless otherwise indicated).
Diagnosis resumes after milestone Number 0 Page: 1
Users are invited to help debug and augment this program so it will
cope with unanticipated and newly uncovered arithmetic pathologies.
Please send suggestions and interesting results to
Richard Karpinski
Computer Center U-76
University of California
San Francisco, CA 94143-0704, USA
In doing so, please include the following information:
Precision: double;
Version: 10 February 1989;
Computer:
Compiler:
Optimization level:
Other relevant compiler options:
Diagnosis resumes after milestone Number 1 Page: 2
Running this program should reveal these characteristics:
Radix = 1, 2, 4, 8, 10, 16, 100, 256 ...
Precision = number of significant digits carried.
U2 = Radix/Radix^Precision = One Ulp
(OneUlpnit in the Last Place) of 1.000xxx .
U1 = 1/Radix^Precision = One Ulp of numbers a little less than 1.0 .
Adequacy of guard digits for Mult., Div. and Subt.
Whether arithmetic is chopped, correctly rounded, or something else
for Mult., Div., Add/Subt. and Sqrt.
Whether a Sticky Bit used correctly for rounding.
UnderflowThreshold = an underflow threshold.
E0 and PseudoZero tell whether underflow is abrupt, gradual, or fuzzy.
V = an overflow threshold, roughly.
V0 tells, roughly, whether Infinity is represented.
Comparisions are checked for consistency with subtraction
and for contamination with pseudo-zeros.
Sqrt is tested. Y^X is not tested.
Extra-precise subexpressions are revealed but NOT YET tested.
Decimal-Binary conversion is NOT YET tested for accuracy.
Diagnosis resumes after milestone Number 2 Page: 3
The program attempts to discriminate among
FLAWs, like lack of a sticky bit,
Serious DEFECTs, like lack of a guard digit, and
FAILUREs, like 2+2 == 5 .
Failures may confound subsequent diagnoses.
The diagnostic capabilities of this program go beyond an earlier
program called `MACHAR', which can be found at the end of the
book `Software Manual for the Elementary Functions' (1980) by
W. J. Cody and W. Waite. Although both programs try to discover
the Radix, Precision and range (over/underflow thresholds)
of the arithmetic, this program tries to cope with a wider variety
of pathologies, and to say how well the arithmetic is implemented.
The program is based upon a conventional radix representation for
floating-point numbers, but also allows logarithmic encoding
as used by certain early WANG machines.
BASIC version of this program (C) 1983 by Prof. W. M. Kahan;
see source comments for more history.
Diagnosis resumes after milestone Number 3 Page: 4
Program is now RUNNING tests on small integers:
-1, 0, 1/2, 1, 2, 3, 4, 5, 9, 27, 32 & 240 are O.K.
Searching for Radix and Precision.
Radix = 2.000000 .
Closest relative separation found is U1 = 1.1102230e-16 .
Recalculating radix and precision
confirms closest relative separation U1 .
Radix confirmed.
The number of significant digits of the Radix is 53.000000 .
Diagnosis resumes after milestone Number 30 Page: 5
Subtraction appears to be normalized, as it should be.
Checking for guard digit in *, /, and -.
*, /, and - appear to have guard digits, as they should.
Diagnosis resumes after milestone Number 40 Page: 6
Checking rounding on multiply, divide and add/subtract.
Multiplication appears to round correctly.
Division appears to round correctly.
Addition/Subtraction appears to round correctly.
Checking for sticky bit.
Sticky bit apparently used correctly.
Does Multiplication commute? Testing on 20 random pairs.
No failures found in 20 integer pairs.
Running test of square root(x).
Testing if sqrt(X * X) == X for 20 Integers X.
Test for sqrt monotonicity.
sqrt has passed a test for Monotonicity.
Testing whether sqrt is rounded or chopped.
Square root appears to be correctly rounded.
Diagnosis resumes after milestone Number 90 Page: 7
Testing powers Z^i for small Integers Z and i.
... no discrepancis found.
Seeking Underflow thresholds UfThold and E0.
Smallest strictly positive number found is E0 = 2.22507e-308 .
Since comparison denies Z = 0, evaluating (Z + Z) / Z should be safe.
What the machine gets for (Z + Z) / Z is 2.00000000000000000e+00 .
This is O.K., provided Over/Underflow has NOT just been signaled.
Diagnosis resumes after milestone Number 120 Page: 8
FLAW: X = 3.05947655544740190e-308
is not equal to Z = 2.22507385850720140e-308 .
yet X - Z yields 0.00000000000000000e+00 .
Should this NOT signal Underflow, this is a SERIOUS DEFECT
that causes confusion when innocent statements like
if (X == Z) ... else ... (f(X) - f(Z)) / (X - Z) ...
encounter Division by Zero although actually
X / Z = 1 + 0.375 .
The Underflow threshold is 2.22507385850720140e-308, below which
calculation may suffer larger Relative error than merely roundoff.
Since underflow occurs below the threshold
UfThold = (2.00000000000000000e+00) ^ (-1.02200000000000000e+03)
only underflow should afflict the expression
(2.00000000000000000e+00) ^ (-1.02200000000000000e+03);
actually calculating yields: 0.00000000000000000e+00 .
This computed value is O.K.
Testing X^((X + 1) / (X - 1)) vs. exp(2) = 7.38905609893065220e+00 as X -> 1.
Accuracy seems adequate.
Testing powers Z^Q at four nearly extreme values.
... no discrepancies found.
Diagnosis resumes after milestone Number 160 Page: 9
Searching for Overflow threshold:
This may generate an error.
* * * FLOATING-POINT ERROR * * *
Can `Z = -Y' overflow?
Trying it on Y = -8.98846567431157950e+307 .
Seems O.K.
Overflow threshold is V = 1.79769313486231570e+308 .
There is no saturation value because the system traps on overflow.
No Overflow should be signaled for V * 1 = 1.79769313486231570e+308
nor for V / 1 = 1.79769313486231570e+308 .
Any overflow signal separating this * from the one
above is a DEFECT.
Diagnosis resumes after milestone Number 190 Page: 10
What message and/or values does Division by Zero produce?
Trying to compute 1 / 0 produces ...
* * * FLOATING-POINT ERROR * * *
Trying to compute 0 / 0 produces ...
* * * FLOATING-POINT ERROR * * *
Diagnosis resumes after milestone Number 220 Page: 11
No failures, defects nor flaws have been discovered.
Rounding appears to conform to the proposed IEEE standard P754,
except for possibly Double Rounding during Gradual Underflow.
The arithmetic diagnosed appears to be Excellent!
A total of 3 floating point exceptions were registered.
END OF TEST.

32
lcc/alpha/osf/tst/paranoia.2bk Normal file → Executable file
View file

@ -1,16 +1,16 @@
tst/paranoia.c:1867: warning: missing return value
tst/paranoia.c:1874: warning: missing return value
tst/paranoia.c:1884: warning: missing return value
tst/paranoia.c:1924: warning: missing return value
tst/paranoia.c:1939: warning: missing return value
tst/paranoia.c:1956: warning: missing return value
tst/paranoia.c:1975: warning: missing return value
tst/paranoia.c:1988: warning: missing return value
tst/paranoia.c:1995: warning: missing return value
tst/paranoia.c:2055: warning: missing return value
tst/paranoia.c:2062: warning: missing return value
tst/paranoia.c:2070: warning: missing return value
tst/paranoia.c:2087: warning: missing return value
tst/paranoia.c:2115: warning: missing return value
tst/paranoia.c:2144: warning: missing return value
tst/paranoia.c:2173: warning: missing return value
tst/paranoia.c:1867: warning: missing return value
tst/paranoia.c:1874: warning: missing return value
tst/paranoia.c:1884: warning: missing return value
tst/paranoia.c:1924: warning: missing return value
tst/paranoia.c:1939: warning: missing return value
tst/paranoia.c:1956: warning: missing return value
tst/paranoia.c:1975: warning: missing return value
tst/paranoia.c:1988: warning: missing return value
tst/paranoia.c:1995: warning: missing return value
tst/paranoia.c:2055: warning: missing return value
tst/paranoia.c:2062: warning: missing return value
tst/paranoia.c:2070: warning: missing return value
tst/paranoia.c:2087: warning: missing return value
tst/paranoia.c:2115: warning: missing return value
tst/paranoia.c:2144: warning: missing return value
tst/paranoia.c:2173: warning: missing return value

38582
lcc/alpha/osf/tst/paranoia.sbk Normal file → Executable file

File diff suppressed because it is too large Load diff

40
lcc/alpha/osf/tst/sort.1bk Normal file → Executable file
View file

@ -1,20 +1,20 @@
exchange(1,9)
exchange(3,7)
exchange(5,6)
exchange(0,5)
exchange(0,3)
exchange(0,0)
exchange(1,2)
exchange(6,6)
exchange(8,9)
exchange(7,8)
-51
-1
0
1
3
10
18
32
567
789
exchange(1,9)
exchange(3,7)
exchange(5,6)
exchange(0,5)
exchange(0,3)
exchange(0,0)
exchange(1,2)
exchange(6,6)
exchange(8,9)
exchange(7,8)
-51
-1
0
1
3
10
18
32
567
789

10
lcc/alpha/osf/tst/sort.2bk Normal file → Executable file
View file

@ -1,5 +1,5 @@
tst/sort.c:23: warning: missing return value
tst/sort.c:30: warning: missing return value
tst/sort.c:37: warning: missing return value
tst/sort.c:41: warning: missing return value
tst/sort.c:65: warning: missing return value
tst/sort.c:23: warning: missing return value
tst/sort.c:30: warning: missing return value
tst/sort.c:37: warning: missing return value
tst/sort.c:41: warning: missing return value
tst/sort.c:65: warning: missing return value

646
lcc/alpha/osf/tst/sort.sbk Normal file → Executable file
View file

@ -1,323 +1,323 @@
.sdata
.globl in
.align 2
in:
.long 0xa
.long 0x20
.long 0xffffffff
.long 0x237
.long 0x3
.long 0x12
.long 0x1
.long 0xffffffcd
.long 0x315
.long 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $16,in
lda $17,10
jsr $26,sort
ldgp $gp,0($26)
mov $31,$14
br L.5
L.2:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
ldl $16,in($27)
jsr $26,putd
ldgp $gp,0($26)
lda $16,10
jsr $26,putchar
ldgp $gp,0($26)
L.3:
lda $14,1($14)
L.5:
mov $14,$27
lda $25,10
cmpult $27,$25,$23
bne $23,L.2
mov $31,$0
L.1:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl putd
.text
.ent putd
putd:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x5004000,-64
.frame $sp,80,$26,48
stq $14,0($sp)
stq $24,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
cmplt $14,$31,$23
beq $23,L.7
lda $16,45
jsr $26,putchar
ldgp $gp,0($26)
negl $14,$14
L.7:
divl $14,10,$27
cmpeq $27,$31,$23
bne $23,L.9
divl $14,10,$16
jsr $26,putd
ldgp $gp,0($26)
L.9:
reml $14,10,$27
lda $16,48($27)
jsr $26,putchar
ldgp $gp,0($26)
mov $31,$0
L.6:
ldq $14,0($sp)
ldq $24,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end putd
.globl sort
.text
.ent sort
sort:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $27,-48+64($sp)
stq $27,xx
mov $27,$16
mov $31,$17
ldl $27,-40+64($sp)
subl $27,1,$27
stl $27,-40+64($sp)
mov $27,$18
jsr $26,quick
ldgp $gp,0($26)
mov $31,$0
L.11:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end sort
.globl quick
.text
.ent quick
quick:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4007800,-64
.frame $sp,96,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
mov $16,$14
mov $17,$13
mov $18,$12
.prologue 1
cmplt $13,$12,$23
bne $23,L.13
br L.12
L.13:
mov $14,$16
mov $13,$17
mov $12,$18
jsr $26,partition
ldgp $gp,0($26)
mov $0,$11
mov $14,$16
mov $13,$17
subl $11,1,$18
jsr $26,quick
ldgp $gp,0($26)
mov $14,$16
lda $17,1($11)
mov $12,$18
jsr $26,quick
ldgp $gp,0($26)
mov $31,$0
L.12:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end quick
.globl partition
.text
.ent partition
partition:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x4007c00,-72
.frame $sp,112,$26,48
stq $10,0($sp)
stq $11,8($sp)
stq $12,16($sp)
stq $13,24($sp)
stq $14,32($sp)
stq $26,40($sp)
mov $16,$14
mov $17,$13
mov $18,$12
.prologue 1
lda $12,1($12)
mov $13,$10
sll $10,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $11,($27)
br L.17
L.16:
lda $13,1($13)
br L.20
L.19:
lda $13,1($13)
L.20:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $27,($27)
cmplt $27,$11,$23
bne $23,L.19
subl $12,1,$12
br L.23
L.22:
subl $12,1,$12
L.23:
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $27,($27)
cmple $27,$11,$23
beq $23,L.22
cmplt $13,$12,$23
beq $23,L.25
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$16
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$17
jsr $26,exchange
ldgp $gp,0($26)
L.25:
L.17:
cmplt $13,$12,$23
bne $23,L.16
sll $10,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$16
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$17
jsr $26,exchange
ldgp $gp,0($26)
mov $12,$0
L.15:
ldq $10,0($sp)
ldq $11,8($sp)
ldq $12,16($sp)
ldq $13,24($sp)
ldq $14,32($sp)
ldq $26,40($sp)
lda $sp,112($sp)
ret
.end partition
.globl exchange
.text
.ent exchange
exchange:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x5006000,-88
.frame $sp,112,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
mov $16,$14
mov $17,$13
.prologue 1
lda $16,L.28
ldq $27,xx
stq $27,-80+112($sp)
mov $14,$25
subq $25,$27,$25
stq $25,-72+112($sp)
divq $25,4,$17
mov $13,$27
ldq $25,-80+112($sp)
subq $27,$25,$27
divq $27,4,$18
jsr $26,printf
ldgp $gp,0($26)
ldl $27,($14)
stl $27,-60+112($sp)
ldl $27,($13)
stl $27,($14)
ldl $27,-60+112($sp)
stl $27,($13)
mov $31,$0
L.27:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,112($sp)
ret
.end exchange
.globl xx
.comm xx,8
.rdata
.align 0
L.28:
.byte 101
.byte 120
.byte 99
.byte 104
.byte 97
.byte 110
.byte 103
.byte 101
.byte 40
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 41
.byte 10
.byte 0
.sdata
.globl in
.align 2
in:
.long 0xa
.long 0x20
.long 0xffffffff
.long 0x237
.long 0x3
.long 0x12
.long 0x1
.long 0xffffffcd
.long 0x315
.long 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $16,in
lda $17,10
jsr $26,sort
ldgp $gp,0($26)
mov $31,$14
br L.5
L.2:
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
ldl $16,in($27)
jsr $26,putd
ldgp $gp,0($26)
lda $16,10
jsr $26,putchar
ldgp $gp,0($26)
L.3:
lda $14,1($14)
L.5:
mov $14,$27
lda $25,10
cmpult $27,$25,$23
bne $23,L.2
mov $31,$0
L.1:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end main
.globl putd
.text
.ent putd
putd:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x5004000,-64
.frame $sp,80,$26,48
stq $14,0($sp)
stq $24,8($sp)
stq $26,16($sp)
mov $16,$14
.prologue 1
cmplt $14,$31,$23
beq $23,L.7
lda $16,45
jsr $26,putchar
ldgp $gp,0($26)
negl $14,$14
L.7:
divl $14,10,$27
cmpeq $27,$31,$23
bne $23,L.9
divl $14,10,$16
jsr $26,putd
ldgp $gp,0($26)
L.9:
reml $14,10,$27
lda $16,48($27)
jsr $26,putchar
ldgp $gp,0($26)
mov $31,$0
L.6:
ldq $14,0($sp)
ldq $24,8($sp)
ldq $26,16($sp)
lda $sp,80($sp)
ret
.end putd
.globl sort
.text
.ent sort
sort:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
stq $17,24($sp)
.prologue 1
ldq $27,-48+64($sp)
stq $27,xx
mov $27,$16
mov $31,$17
ldl $27,-40+64($sp)
subl $27,1,$27
stl $27,-40+64($sp)
mov $27,$18
jsr $26,quick
ldgp $gp,0($26)
mov $31,$0
L.11:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end sort
.globl quick
.text
.ent quick
quick:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4007800,-64
.frame $sp,96,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
mov $16,$14
mov $17,$13
mov $18,$12
.prologue 1
cmplt $13,$12,$23
bne $23,L.13
br L.12
L.13:
mov $14,$16
mov $13,$17
mov $12,$18
jsr $26,partition
ldgp $gp,0($26)
mov $0,$11
mov $14,$16
mov $13,$17
subl $11,1,$18
jsr $26,quick
ldgp $gp,0($26)
mov $14,$16
lda $17,1($11)
mov $12,$18
jsr $26,quick
ldgp $gp,0($26)
mov $31,$0
L.12:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,96($sp)
ret
.end quick
.globl partition
.text
.ent partition
partition:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x4007c00,-72
.frame $sp,112,$26,48
stq $10,0($sp)
stq $11,8($sp)
stq $12,16($sp)
stq $13,24($sp)
stq $14,32($sp)
stq $26,40($sp)
mov $16,$14
mov $17,$13
mov $18,$12
.prologue 1
lda $12,1($12)
mov $13,$10
sll $10,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $11,($27)
br L.17
L.16:
lda $13,1($13)
br L.20
L.19:
lda $13,1($13)
L.20:
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $27,($27)
cmplt $27,$11,$23
bne $23,L.19
subl $12,1,$12
br L.23
L.22:
subl $12,1,$12
L.23:
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$27
ldl $27,($27)
cmple $27,$11,$23
beq $23,L.22
cmplt $13,$12,$23
beq $23,L.25
sll $13,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$16
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$17
jsr $26,exchange
ldgp $gp,0($26)
L.25:
L.17:
cmplt $13,$12,$23
bne $23,L.16
sll $10,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$16
sll $12,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,2,$27
addq $27,$14,$17
jsr $26,exchange
ldgp $gp,0($26)
mov $12,$0
L.15:
ldq $10,0($sp)
ldq $11,8($sp)
ldq $12,16($sp)
ldq $13,24($sp)
ldq $14,32($sp)
ldq $26,40($sp)
lda $sp,112($sp)
ret
.end partition
.globl exchange
.text
.ent exchange
exchange:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x5006000,-88
.frame $sp,112,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
mov $16,$14
mov $17,$13
.prologue 1
lda $16,L.28
ldq $27,xx
stq $27,-80+112($sp)
mov $14,$25
subq $25,$27,$25
stq $25,-72+112($sp)
divq $25,4,$17
mov $13,$27
ldq $25,-80+112($sp)
subq $27,$25,$27
divq $27,4,$18
jsr $26,printf
ldgp $gp,0($26)
ldl $27,($14)
stl $27,-60+112($sp)
ldl $27,($13)
stl $27,($14)
ldl $27,-60+112($sp)
stl $27,($13)
mov $31,$0
L.27:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,112($sp)
ret
.end exchange
.globl xx
.comm xx,8
.rdata
.align 0
L.28:
.byte 101
.byte 120
.byte 99
.byte 104
.byte 97
.byte 110
.byte 103
.byte 101
.byte 40
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 41
.byte 10
.byte 0

0
lcc/alpha/osf/tst/spill.1bk Normal file → Executable file
View file

12
lcc/alpha/osf/tst/spill.2bk Normal file → Executable file
View file

@ -1,6 +1,6 @@
tst/spill.c:1: warning: missing return value
tst/spill.c:3: warning: missing return value
tst/spill.c:5: warning: missing return value
tst/spill.c:7: warning: missing return value
tst/spill.c:9: warning: missing return value
tst/spill.c:17: warning: missing return value
tst/spill.c:1: warning: missing return value
tst/spill.c:3: warning: missing return value
tst/spill.c:5: warning: missing return value
tst/spill.c:7: warning: missing return value
tst/spill.c:9: warning: missing return value
tst/spill.c:17: warning: missing return value

544
lcc/alpha/osf/tst/spill.sbk Normal file → Executable file
View file

@ -1,272 +1,272 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
mov $31,$0
L.1:
lda $sp,64($sp)
ret
.end main
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
jsr $26,f
ldgp $gp,0($26)
ldl $25,-60+80($sp)
addl $25,$0,$27
stl $27,-48+80($sp)
mov $31,$0
L.2:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end f
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
ldl $25,-48+80($sp)
cmpeq $25,$31,$23
bne $23,L.5
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
br L.6
L.5:
lda $14,1
L.6:
ldl $27,-60+80($sp)
addl $27,$14,$27
stl $27,-48+80($sp)
mov $31,$0
L.3:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f2
.globl f3
.text
.ent f3
f3:
ldgp $gp,0($27)
lda $sp,-144($sp)
.mask 0x4007e00,-96
.frame $sp,144,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
stq $16,96($sp)
stq $17,104($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
stl $31,-60+144($sp)
stl $31,-64+144($sp)
stl $31,-68+144($sp)
stl $31,-72+144($sp)
ldq $27,-40+144($sp)
stq $27,-88+144($sp)
lda $25,4($27)
stq $25,-40+144($sp)
ldl $25,-48+144($sp)
cmpeq $25,$31,$23
bne $23,L.9
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-76+144($sp)
br L.10
L.9:
stl $31,-76+144($sp)
L.10:
ldl $27,-76+144($sp)
ldq $25,-88+144($sp)
stl $27,($25)
mov $31,$0
L.7:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,144($sp)
ret
.end f3
.globl f4
.text
.ent f4
f4:
ldgp $gp,0($27)
lda $sp,-128($sp)
.mask 0x4007e00,-80
.frame $sp,128,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
ldl $27,i
sll $27,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldt $f30,a($25)
ldt $f29,b($25)
ldt $f28,L.15
addt $f30,$f29,$f27
cmpteq $f27,$f28,$f1
fbne $f1,L.13
cmpeq $27,$31,$23
bne $23,L.13
subt $f30,$f29,$f30
cmpteq $f30,$f28,$f1
fbne $f1,L.13
lda $27,1
stl $27,-60+128($sp)
br L.14
L.13:
stl $31,-60+128($sp)
L.14:
ldl $27,-60+128($sp)
stl $27,i
mov $31,$0
L.11:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,128($sp)
ret
.end f4
.globl f5
.text
.ent f5
f5:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
ldl $27,k
ldl $25,m
ldq $22,A
mull $27,$25,$8
sll $8,8*(8-4),$8
sra $8,8*(8-4),$8
sll $8,3,$8
addq $8,$22,$8
ldl $7,j
mull $7,$25,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
addq $25,$22,$25
ldl $22,n
ldq $6,B
mull $27,$22,$27
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
addq $27,$6,$27
mull $7,$22,$22
sll $22,8*(8-4),$22
sra $22,8*(8-4),$22
sll $22,3,$22
addq $22,$6,$22
ldt $f30,($8)
ldt $f29,($25)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($22)
mult $f29,$f28,$f29
addt $f30,$f29,$f30
stt $f30,x
ldt $f30,($8)
ldt $f29,($22)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($25)
mult $f29,$f28,$f29
subt $f30,$f29,$f30
stt $f30,x
mov $31,$0
L.16:
lda $sp,64($sp)
ret
.end f5
.globl x
.comm x,8
.globl B
.comm B,8
.globl A
.comm A,8
.globl n
.comm n,4
.globl m
.comm m,4
.globl k
.comm k,4
.globl j
.comm j,4
.globl i
.comm i,4
.globl b
.comm b,80
.globl a
.comm a,80
.rdata
.align 3
L.15:
.long 0x0
.long 0x0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
mov $31,$0
L.1:
lda $sp,64($sp)
ret
.end main
.globl f
.text
.ent f
f:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
jsr $26,f
ldgp $gp,0($26)
ldl $25,-60+80($sp)
addl $25,$0,$27
stl $27,-48+80($sp)
mov $31,$0
L.2:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end f
.globl f2
.text
.ent f2
f2:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
.prologue 1
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-60+80($sp)
ldl $25,-48+80($sp)
cmpeq $25,$31,$23
bne $23,L.5
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
br L.6
L.5:
lda $14,1
L.6:
ldl $27,-60+80($sp)
addl $27,$14,$27
stl $27,-48+80($sp)
mov $31,$0
L.3:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end f2
.globl f3
.text
.ent f3
f3:
ldgp $gp,0($27)
lda $sp,-144($sp)
.mask 0x4007e00,-96
.frame $sp,144,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
stq $16,96($sp)
stq $17,104($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
stl $31,-60+144($sp)
stl $31,-64+144($sp)
stl $31,-68+144($sp)
stl $31,-72+144($sp)
ldq $27,-40+144($sp)
stq $27,-88+144($sp)
lda $25,4($27)
stq $25,-40+144($sp)
ldl $25,-48+144($sp)
cmpeq $25,$31,$23
bne $23,L.9
jsr $26,f
ldgp $gp,0($26)
mov $0,$27
stl $27,-76+144($sp)
br L.10
L.9:
stl $31,-76+144($sp)
L.10:
ldl $27,-76+144($sp)
ldq $25,-88+144($sp)
stl $27,($25)
mov $31,$0
L.7:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,144($sp)
ret
.end f3
.globl f4
.text
.ent f4
f4:
ldgp $gp,0($27)
lda $sp,-128($sp)
.mask 0x4007e00,-80
.frame $sp,128,$26,48
stq $9,0($sp)
stq $10,8($sp)
stq $11,16($sp)
stq $12,24($sp)
stq $13,32($sp)
stq $14,40($sp)
stq $26,48($sp)
.prologue 1
mov $31,$14
mov $31,$13
mov $31,$12
mov $31,$11
mov $31,$10
mov $31,$9
ldl $27,i
sll $27,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
ldt $f30,a($25)
ldt $f29,b($25)
ldt $f28,L.15
addt $f30,$f29,$f27
cmpteq $f27,$f28,$f1
fbne $f1,L.13
cmpeq $27,$31,$23
bne $23,L.13
subt $f30,$f29,$f30
cmpteq $f30,$f28,$f1
fbne $f1,L.13
lda $27,1
stl $27,-60+128($sp)
br L.14
L.13:
stl $31,-60+128($sp)
L.14:
ldl $27,-60+128($sp)
stl $27,i
mov $31,$0
L.11:
ldq $9,0($sp)
ldq $10,8($sp)
ldq $11,16($sp)
ldq $12,24($sp)
ldq $13,32($sp)
ldq $14,40($sp)
ldq $26,48($sp)
lda $sp,128($sp)
ret
.end f4
.globl f5
.text
.ent f5
f5:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
ldl $27,k
ldl $25,m
ldq $22,A
mull $27,$25,$8
sll $8,8*(8-4),$8
sra $8,8*(8-4),$8
sll $8,3,$8
addq $8,$22,$8
ldl $7,j
mull $7,$25,$25
sll $25,8*(8-4),$25
sra $25,8*(8-4),$25
sll $25,3,$25
addq $25,$22,$25
ldl $22,n
ldq $6,B
mull $27,$22,$27
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
addq $27,$6,$27
mull $7,$22,$22
sll $22,8*(8-4),$22
sra $22,8*(8-4),$22
sll $22,3,$22
addq $22,$6,$22
ldt $f30,($8)
ldt $f29,($25)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($22)
mult $f29,$f28,$f29
addt $f30,$f29,$f30
stt $f30,x
ldt $f30,($8)
ldt $f29,($22)
mult $f30,$f29,$f30
ldt $f29,($27)
ldt $f28,($25)
mult $f29,$f28,$f29
subt $f30,$f29,$f30
stt $f30,x
mov $31,$0
L.16:
lda $sp,64($sp)
ret
.end f5
.globl x
.comm x,8
.globl B
.comm B,8
.globl A
.comm A,8
.globl n
.comm n,4
.globl m
.comm m,4
.globl k
.comm k,4
.globl j
.comm j,4
.globl i
.comm i,4
.globl b
.comm b,80
.globl a
.comm a,80
.rdata
.align 3
L.15:
.long 0x0
.long 0x0

12
lcc/alpha/osf/tst/stdarg.1bk Normal file → Executable file
View file

@ -1,6 +1,6 @@
test 1
test 2
test 3
test 4
test 5.000000
{1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4}
test 1
test 2
test 3
test 4
test 5.000000
{1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4} {1 2 3 4}

2
lcc/alpha/osf/tst/stdarg.2bk Normal file → Executable file
View file

@ -1 +1 @@
tst/stdarg.c:51: warning: missing return value
tst/stdarg.c:51: warning: missing return value

860
lcc/alpha/osf/tst/stdarg.sbk Normal file → Executable file
View file

@ -1,430 +1,430 @@
.sdata
.globl x
.align 2
x:
.long 0x1
.long 0x2
.long 0x3
.long 0x4
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-128($sp)
.mask 0x4000000,-72
.frame $sp,128,$26,48
stq $26,56($sp)
.prologue 1
lda $16,L.3
jsr $26,print
ldgp $gp,0($26)
lda $16,L.4
lda $17,L.5
jsr $26,print
ldgp $gp,0($26)
lda $16,L.6
lda $17,3
lda $18,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.7
lda $17,L.8
lda $18,L.9
lda $19,4
lda $20,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.10
lda $17,L.8
lda $18,L.9
ldt $f19,L.11
lda $20,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.12
lda $27,x
mov $27,$1
uldq $17,0($1)
uldq $18,8($1)
mov $27,$1
uldq $19,0($1)
uldq $20,8($1)
mov $27,$1
uldq $21,0($1)
ldl $4,8($1)
ldl $2,12($1)
stl $4,0($30)
stl $2,4($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,8($30)
stl $2,12($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,16($30)
stl $2,20($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,24($30)
stl $2,28($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,32($30)
stl $2,36($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,40($30)
stl $2,44($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,48($30)
stl $2,52($30)
jsr $26,print
ldgp $gp,0($26)
mov $31,$0
L.2:
ldq $26,56($sp)
lda $sp,128($sp)
ret
.end main
.globl print
.text
.ent print
print:
ldgp $gp,0($27)
lda $sp,-160($sp)
.mask 0x4006000,-144
.frame $sp,160,$26,96
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
stq $16,112($sp)
stq $17,120($sp)
stt $f17,72($sp)
stq $18,128($sp)
stt $f18,80($sp)
stq $19,136($sp)
stt $f19,88($sp)
stq $20,144($sp)
stt $f20,96($sp)
stq $21,152($sp)
stt $f21,104($sp)
.prologue 1
lda $27,-48+160($sp)
stq $27,-120+160($sp)
lda $27,-40+160($sp)
ldq $25,-120+160($sp)
subq $27,$25,$27
stl $27,-112+160($sp)
br L.21
L.18:
ldq $27,-48+160($sp)
ldb $27,($27)
cmpeq $27,37,$23
beq $23,L.22
ldq $27,-48+160($sp)
lda $27,1($27)
stq $27,-48+160($sp)
ldb $14,($27)
lda $27,115
cmpeq $14,$27,$23
bne $23,L.74
cmple $14,$27,$23
beq $23,L.100
L.99:
lda $27,98
cmplt $14,$27,$23
bne $23,L.24
lda $27,102
cmple $14,$27,$23
beq $23,L.24
subl $14,98,$27
sll $27,3,$27
ldq $27,L.101($27)
jmp ($27)
.rdata
.align 3
L.101:
.quad L.27
.quad L.41
.quad L.52
.quad L.24
.quad L.85
.text
L.100:
lda $27,119
cmpeq $14,$27,$23
bne $23,L.63
br L.24
L.27:
ldl $27,-112+160($sp)
lda $27,16($27)
stl $27,-112+160($sp)
lda $27,-136+160($sp)
ldl $25,-112+160($sp)
ldq $22,-120+160($sp)
addq $25,$22,$25
lda $1,-16($25)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
ldl $4,8($1)
ldl $2,12($1)
stl $4,8($27)
stl $2,12($27)
lda $16,L.37
ldl $17,-136+160($sp)
ldl $18,-132+160($sp)
ldl $19,-128+160($sp)
ldl $20,-124+160($sp)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.41:
lda $16,L.42
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $27,-8($27)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.52:
lda $16,L.53
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
ldl $17,-8($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.63:
lda $16,L.64
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $27,-8($27)
ldw $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.74:
lda $16,L.75
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
ldq $17,-8($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.85:
lda $16,L.86
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
cmple $27,48,$23
beq $23,L.97
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $13,-56($27)
br L.98
L.97:
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $13,-8($27)
L.98:
ldt $f17,($13)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.24:
lda $16,L.42
ldq $27,-48+160($sp)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.22:
lda $16,L.42
ldq $27,-48+160($sp)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.23:
L.19:
ldq $27,-48+160($sp)
lda $27,1($27)
stq $27,-48+160($sp)
L.21:
ldq $27,-48+160($sp)
ldb $27,($27)
cmpeq $27,$31,$23
beq $23,L.18
mov $31,$0
L.13:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,160($sp)
ret
.end print
.rdata
.align 0
L.86:
.byte 37
.byte 102
.byte 0
.align 0
L.75:
.byte 37
.byte 115
.byte 0
.align 0
L.64:
.byte 37
.byte 120
.byte 0
.align 0
L.53:
.byte 37
.byte 100
.byte 0
.align 0
L.42:
.byte 37
.byte 99
.byte 0
.align 0
L.37:
.byte 123
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 125
.byte 0
.align 0
L.12:
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 10
.byte 0
.align 3
L.11:
.long 0x0
.long 0x40140000
.align 0
L.10:
.byte 37
.byte 115
.byte 37
.byte 115
.byte 32
.byte 37
.byte 102
.byte 37
.byte 99
.byte 0
.align 0
L.9:
.byte 115
.byte 116
.byte 0
.align 0
L.8:
.byte 116
.byte 101
.byte 0
.align 0
L.7:
.byte 37
.byte 115
.byte 37
.byte 115
.byte 32
.byte 37
.byte 119
.byte 37
.byte 99
.byte 0
.align 0
L.6:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 37
.byte 100
.byte 37
.byte 99
.byte 0
.align 0
L.5:
.byte 50
.byte 0
.align 0
L.4:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.3:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 49
.byte 10
.byte 0
.sdata
.globl x
.align 2
x:
.long 0x1
.long 0x2
.long 0x3
.long 0x4
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-128($sp)
.mask 0x4000000,-72
.frame $sp,128,$26,48
stq $26,56($sp)
.prologue 1
lda $16,L.3
jsr $26,print
ldgp $gp,0($26)
lda $16,L.4
lda $17,L.5
jsr $26,print
ldgp $gp,0($26)
lda $16,L.6
lda $17,3
lda $18,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.7
lda $17,L.8
lda $18,L.9
lda $19,4
lda $20,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.10
lda $17,L.8
lda $18,L.9
ldt $f19,L.11
lda $20,10
jsr $26,print
ldgp $gp,0($26)
lda $16,L.12
lda $27,x
mov $27,$1
uldq $17,0($1)
uldq $18,8($1)
mov $27,$1
uldq $19,0($1)
uldq $20,8($1)
mov $27,$1
uldq $21,0($1)
ldl $4,8($1)
ldl $2,12($1)
stl $4,0($30)
stl $2,4($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,8($30)
stl $2,12($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,16($30)
stl $2,20($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,24($30)
stl $2,28($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,32($30)
stl $2,36($30)
mov $27,$1
ldl $4,0($1)
ldl $2,4($1)
stl $4,40($30)
stl $2,44($30)
ldl $4,8($1)
ldl $2,12($1)
stl $4,48($30)
stl $2,52($30)
jsr $26,print
ldgp $gp,0($26)
mov $31,$0
L.2:
ldq $26,56($sp)
lda $sp,128($sp)
ret
.end main
.globl print
.text
.ent print
print:
ldgp $gp,0($27)
lda $sp,-160($sp)
.mask 0x4006000,-144
.frame $sp,160,$26,96
stq $13,0($sp)
stq $14,8($sp)
stq $26,16($sp)
stq $16,112($sp)
stq $17,120($sp)
stt $f17,72($sp)
stq $18,128($sp)
stt $f18,80($sp)
stq $19,136($sp)
stt $f19,88($sp)
stq $20,144($sp)
stt $f20,96($sp)
stq $21,152($sp)
stt $f21,104($sp)
.prologue 1
lda $27,-48+160($sp)
stq $27,-120+160($sp)
lda $27,-40+160($sp)
ldq $25,-120+160($sp)
subq $27,$25,$27
stl $27,-112+160($sp)
br L.21
L.18:
ldq $27,-48+160($sp)
ldb $27,($27)
cmpeq $27,37,$23
beq $23,L.22
ldq $27,-48+160($sp)
lda $27,1($27)
stq $27,-48+160($sp)
ldb $14,($27)
lda $27,115
cmpeq $14,$27,$23
bne $23,L.74
cmple $14,$27,$23
beq $23,L.100
L.99:
lda $27,98
cmplt $14,$27,$23
bne $23,L.24
lda $27,102
cmple $14,$27,$23
beq $23,L.24
subl $14,98,$27
sll $27,3,$27
ldq $27,L.101($27)
jmp ($27)
.rdata
.align 3
L.101:
.quad L.27
.quad L.41
.quad L.52
.quad L.24
.quad L.85
.text
L.100:
lda $27,119
cmpeq $14,$27,$23
bne $23,L.63
br L.24
L.27:
ldl $27,-112+160($sp)
lda $27,16($27)
stl $27,-112+160($sp)
lda $27,-136+160($sp)
ldl $25,-112+160($sp)
ldq $22,-120+160($sp)
addq $25,$22,$25
lda $1,-16($25)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
ldl $4,8($1)
ldl $2,12($1)
stl $4,8($27)
stl $2,12($27)
lda $16,L.37
ldl $17,-136+160($sp)
ldl $18,-132+160($sp)
ldl $19,-128+160($sp)
ldl $20,-124+160($sp)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.41:
lda $16,L.42
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $27,-8($27)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.52:
lda $16,L.53
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
ldl $17,-8($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.63:
lda $16,L.64
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $27,-8($27)
ldw $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.74:
lda $16,L.75
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
ldq $17,-8($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.85:
lda $16,L.86
ldl $27,-112+160($sp)
lda $27,8($27)
stl $27,-112+160($sp)
ldl $27,-112+160($sp)
cmple $27,48,$23
beq $23,L.97
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $13,-56($27)
br L.98
L.97:
ldl $27,-112+160($sp)
ldq $25,-120+160($sp)
addq $27,$25,$27
lda $13,-8($27)
L.98:
ldt $f17,($13)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.24:
lda $16,L.42
ldq $27,-48+160($sp)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
br L.23
L.22:
lda $16,L.42
ldq $27,-48+160($sp)
ldb $17,($27)
jsr $26,printf
ldgp $gp,0($26)
L.23:
L.19:
ldq $27,-48+160($sp)
lda $27,1($27)
stq $27,-48+160($sp)
L.21:
ldq $27,-48+160($sp)
ldb $27,($27)
cmpeq $27,$31,$23
beq $23,L.18
mov $31,$0
L.13:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $26,16($sp)
lda $sp,160($sp)
ret
.end print
.rdata
.align 0
L.86:
.byte 37
.byte 102
.byte 0
.align 0
L.75:
.byte 37
.byte 115
.byte 0
.align 0
L.64:
.byte 37
.byte 120
.byte 0
.align 0
L.53:
.byte 37
.byte 100
.byte 0
.align 0
L.42:
.byte 37
.byte 99
.byte 0
.align 0
L.37:
.byte 123
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 32
.byte 37
.byte 100
.byte 125
.byte 0
.align 0
L.12:
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 32
.byte 37
.byte 98
.byte 10
.byte 0
.align 3
L.11:
.long 0x0
.long 0x40140000
.align 0
L.10:
.byte 37
.byte 115
.byte 37
.byte 115
.byte 32
.byte 37
.byte 102
.byte 37
.byte 99
.byte 0
.align 0
L.9:
.byte 115
.byte 116
.byte 0
.align 0
L.8:
.byte 116
.byte 101
.byte 0
.align 0
L.7:
.byte 37
.byte 115
.byte 37
.byte 115
.byte 32
.byte 37
.byte 119
.byte 37
.byte 99
.byte 0
.align 0
L.6:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 37
.byte 100
.byte 37
.byte 99
.byte 0
.align 0
L.5:
.byte 50
.byte 0
.align 0
L.4:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.3:
.byte 116
.byte 101
.byte 115
.byte 116
.byte 32
.byte 49
.byte 10
.byte 0

10
lcc/alpha/osf/tst/struct.1bk Normal file → Executable file
View file

@ -1,5 +1,5 @@
(-1,-1) is not within [10,10; 310,310]
(1,1) is not within [10,10; 310,310]
(20,300) is within [10,10; 310,310]
(500,400) is not within [10,10; 310,310]
ab
(-1,-1) is not within [10,10; 310,310]
(1,1) is not within [10,10; 310,310]
(20,300) is within [10,10; 310,310]
(500,400) is not within [10,10; 310,310]
ab

4
lcc/alpha/osf/tst/struct.2bk Normal file → Executable file
View file

@ -1,2 +1,2 @@
tst/struct.c:49: warning: missing return value
tst/struct.c:68: warning: missing return value
tst/struct.c:49: warning: missing return value
tst/struct.c:68: warning: missing return value

886
lcc/alpha/osf/tst/struct.sbk Normal file → Executable file
View file

@ -1,443 +1,443 @@
.globl addpoint
.text
.text
.ent addpoint
addpoint:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
stq $17,24($sp)
stq $18,32($sp)
.prologue 1
ldl $27,-40+64($sp)
ldl $25,-32+64($sp)
addl $27,$25,$27
stl $27,-40+64($sp)
ldl $27,-36+64($sp)
ldl $25,-28+64($sp)
addl $27,$25,$27
stl $27,-36+64($sp)
lda $1,-40+64($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
L.1:
lda $sp,64($sp)
ret
.end addpoint
.globl canonrect
.text
.ent canonrect
canonrect:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x4007800,-80
.frame $sp,112,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
stq $17,72($sp)
stq $18,80($sp)
.prologue 1
ldl $27,-40+112($sp)
ldl $25,-32+112($sp)
cmplt $27,$25,$23
beq $23,L.10
ldl $14,-40+112($sp)
br L.11
L.10:
ldl $14,-32+112($sp)
L.11:
stl $14,-72+112($sp)
ldl $27,-36+112($sp)
ldl $25,-28+112($sp)
cmplt $27,$25,$23
beq $23,L.20
ldl $13,-36+112($sp)
br L.21
L.20:
ldl $13,-28+112($sp)
L.21:
stl $13,-68+112($sp)
ldl $27,-40+112($sp)
ldl $25,-32+112($sp)
cmple $27,$25,$23
bne $23,L.26
ldl $12,-40+112($sp)
br L.27
L.26:
ldl $12,-32+112($sp)
L.27:
stl $12,-64+112($sp)
ldl $27,-36+112($sp)
ldl $25,-28+112($sp)
cmple $27,$25,$23
bne $23,L.37
ldl $11,-36+112($sp)
br L.38
L.37:
ldl $11,-28+112($sp)
L.38:
stl $11,-60+112($sp)
lda $1,-72+112($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
ldl $4,8($1)
ldl $2,12($1)
stl $4,8($16)
stl $2,12($16)
L.5:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,112($sp)
ret
.end canonrect
.globl makepoint
.text
.ent makepoint
makepoint:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
stl $17,-64+64($sp)
stl $18,-60+64($sp)
lda $1,-64+64($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
L.39:
lda $sp,64($sp)
ret
.end makepoint
.globl makerect
.text
.ent makerect
makerect:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
stq $17,40($sp)
stq $18,48($sp)
.prologue 1
lda $27,-72+80($sp)
lda $1,-40+80($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-64+80($sp)
lda $1,-32+80($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
ldq $16,-48+80($sp)
lda $1,-72+80($sp)
uldq $17,0($1)
uldq $18,8($1)
jsr $26,canonrect
ldgp $gp,0($26)
L.42:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end makerect
.globl ptinrect
.text
.ent ptinrect
ptinrect:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
stq $17,40($sp)
stq $18,48($sp)
.prologue 1
ldl $27,-48+80($sp)
ldl $25,-40+80($sp)
cmplt $27,$25,$23
bne $23,L.53
ldl $25,-32+80($sp)
cmplt $27,$25,$23
beq $23,L.53
ldl $27,-44+80($sp)
ldl $25,-36+80($sp)
cmplt $27,$25,$23
bne $23,L.53
ldl $27,-44+80($sp)
ldl $25,-28+80($sp)
cmplt $27,$25,$23
beq $23,L.53
lda $14,1
br L.54
L.53:
mov $31,$14
L.54:
mov $14,$0
L.45:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end ptinrect
.sdata
.globl y
.align 0
y:
.byte 97
.byte 98
.byte 0
.globl odd
.text
.text
.ent odd
odd:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
.prologue 1
lda $27,-59+80($sp)
lda $1,-48+80($sp)
ldb $4,0($1)
ldb $2,1($1)
stb $4,0($27)
stb $2,1($27)
ldb $4,2($1)
stb $4,2($27)
lda $16,L.56
lda $17,-59+80($sp)
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.55:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end odd
.rdata
.align 2
L.58:
.long 0x0
.long 0x0
.align 2
L.59:
.long 0x140
.long 0x140
.align 2
L.60:
.long 0xffffffff
.long 0xffffffff
.long 0x1
.long 0x1
.long 0x14
.long 0x12c
.long 0x1f4
.long 0x190
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-176($sp)
.mask 0x4004000,-168
.frame $sp,176,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $27,-120+176($sp)
lda $1,L.58
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-128+176($sp)
lda $1,L.59
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-88+176($sp)
lda $1,L.60
addq $1,32,$1
addq $27,32,$3
L.76:
addq $1,-8,$1
addq $3,-8,$3
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($3)
stl $2,4($3)
cmpult $27,$3,$23
bne $23,L.76
lda $16,-136+176($sp)
lda $27,-10
mov $27,$17
mov $27,$18
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,-144+176($sp)
lda $1,-128+176($sp)
uldq $17,0($1)
lda $1,-136+176($sp)
uldq $18,0($1)
jsr $26,addpoint
ldgp $gp,0($26)
lda $16,-152+176($sp)
lda $27,10
mov $27,$17
mov $27,$18
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,-160+176($sp)
lda $1,-120+176($sp)
uldq $17,0($1)
lda $1,-152+176($sp)
uldq $18,0($1)
jsr $26,addpoint
ldgp $gp,0($26)
lda $16,-104+176($sp)
lda $1,-144+176($sp)
uldq $17,0($1)
lda $1,-160+176($sp)
uldq $18,0($1)
jsr $26,makerect
ldgp $gp,0($26)
mov $31,$14
br L.64
L.61:
lda $16,-112+176($sp)
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
lda $25,-88+176($sp)
addq $27,$25,$25
ldl $17,($25)
lda $25,-84+176($sp)
addq $27,$25,$27
ldl $18,($27)
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,L.65
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
lda $25,-88+176($sp)
addq $27,$25,$27
ldl $17,($27)
ldl $18,-108+176($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $1,-112+176($sp)
uldq $16,0($1)
lda $1,-104+176($sp)
uldq $17,0($1)
uldq $18,8($1)
jsr $26,ptinrect
ldgp $gp,0($26)
cmpeq $0,$31,$23
beq $23,L.68
lda $16,L.70
jsr $26,printf
ldgp $gp,0($26)
L.68:
lda $16,L.71
ldl $17,-104+176($sp)
ldl $18,-100+176($sp)
ldl $19,-96+176($sp)
ldl $20,-92+176($sp)
jsr $26,printf
ldgp $gp,0($26)
L.62:
lda $14,1($14)
L.64:
mov $14,$27
lda $25,4
cmpult $27,$25,$23
bne $23,L.61
lda $1,y
uldq $16,0($1)
jsr $26,odd
ldgp $gp,0($26)
mov $31,$16
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.57:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,176($sp)
ret
.end main
.rdata
.align 0
L.71:
.byte 119
.byte 105
.byte 116
.byte 104
.byte 105
.byte 110
.byte 32
.byte 91
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 59
.byte 32
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 93
.byte 10
.byte 0
.align 0
L.70:
.byte 110
.byte 111
.byte 116
.byte 32
.byte 0
.align 0
L.65:
.byte 40
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 41
.byte 32
.byte 105
.byte 115
.byte 32
.byte 0
.align 0
L.56:
.byte 37
.byte 115
.byte 10
.byte 0
.globl addpoint
.text
.text
.ent addpoint
addpoint:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
stq $17,24($sp)
stq $18,32($sp)
.prologue 1
ldl $27,-40+64($sp)
ldl $25,-32+64($sp)
addl $27,$25,$27
stl $27,-40+64($sp)
ldl $27,-36+64($sp)
ldl $25,-28+64($sp)
addl $27,$25,$27
stl $27,-36+64($sp)
lda $1,-40+64($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
L.1:
lda $sp,64($sp)
ret
.end addpoint
.globl canonrect
.text
.ent canonrect
canonrect:
ldgp $gp,0($27)
lda $sp,-112($sp)
.mask 0x4007800,-80
.frame $sp,112,$26,48
stq $11,0($sp)
stq $12,8($sp)
stq $13,16($sp)
stq $14,24($sp)
stq $26,32($sp)
stq $17,72($sp)
stq $18,80($sp)
.prologue 1
ldl $27,-40+112($sp)
ldl $25,-32+112($sp)
cmplt $27,$25,$23
beq $23,L.10
ldl $14,-40+112($sp)
br L.11
L.10:
ldl $14,-32+112($sp)
L.11:
stl $14,-72+112($sp)
ldl $27,-36+112($sp)
ldl $25,-28+112($sp)
cmplt $27,$25,$23
beq $23,L.20
ldl $13,-36+112($sp)
br L.21
L.20:
ldl $13,-28+112($sp)
L.21:
stl $13,-68+112($sp)
ldl $27,-40+112($sp)
ldl $25,-32+112($sp)
cmple $27,$25,$23
bne $23,L.26
ldl $12,-40+112($sp)
br L.27
L.26:
ldl $12,-32+112($sp)
L.27:
stl $12,-64+112($sp)
ldl $27,-36+112($sp)
ldl $25,-28+112($sp)
cmple $27,$25,$23
bne $23,L.37
ldl $11,-36+112($sp)
br L.38
L.37:
ldl $11,-28+112($sp)
L.38:
stl $11,-60+112($sp)
lda $1,-72+112($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
ldl $4,8($1)
ldl $2,12($1)
stl $4,8($16)
stl $2,12($16)
L.5:
ldq $11,0($sp)
ldq $12,8($sp)
ldq $13,16($sp)
ldq $14,24($sp)
ldq $26,32($sp)
lda $sp,112($sp)
ret
.end canonrect
.globl makepoint
.text
.ent makepoint
makepoint:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
stl $17,-64+64($sp)
stl $18,-60+64($sp)
lda $1,-64+64($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($16)
stl $2,4($16)
L.39:
lda $sp,64($sp)
ret
.end makepoint
.globl makerect
.text
.ent makerect
makerect:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
stq $17,40($sp)
stq $18,48($sp)
.prologue 1
lda $27,-72+80($sp)
lda $1,-40+80($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-64+80($sp)
lda $1,-32+80($sp)
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
ldq $16,-48+80($sp)
lda $1,-72+80($sp)
uldq $17,0($1)
uldq $18,8($1)
jsr $26,canonrect
ldgp $gp,0($26)
L.42:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end makerect
.globl ptinrect
.text
.ent ptinrect
ptinrect:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
stq $17,40($sp)
stq $18,48($sp)
.prologue 1
ldl $27,-48+80($sp)
ldl $25,-40+80($sp)
cmplt $27,$25,$23
bne $23,L.53
ldl $25,-32+80($sp)
cmplt $27,$25,$23
beq $23,L.53
ldl $27,-44+80($sp)
ldl $25,-36+80($sp)
cmplt $27,$25,$23
bne $23,L.53
ldl $27,-44+80($sp)
ldl $25,-28+80($sp)
cmplt $27,$25,$23
beq $23,L.53
lda $14,1
br L.54
L.53:
mov $31,$14
L.54:
mov $14,$0
L.45:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end ptinrect
.sdata
.globl y
.align 0
y:
.byte 97
.byte 98
.byte 0
.globl odd
.text
.text
.ent odd
odd:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4000000,-80
.frame $sp,80,$26,48
stq $26,0($sp)
stq $16,32($sp)
.prologue 1
lda $27,-59+80($sp)
lda $1,-48+80($sp)
ldb $4,0($1)
ldb $2,1($1)
stb $4,0($27)
stb $2,1($27)
ldb $4,2($1)
stb $4,2($27)
lda $16,L.56
lda $17,-59+80($sp)
jsr $26,printf
ldgp $gp,0($26)
mov $31,$0
L.55:
ldq $26,0($sp)
lda $sp,80($sp)
ret
.end odd
.rdata
.align 2
L.58:
.long 0x0
.long 0x0
.align 2
L.59:
.long 0x140
.long 0x140
.align 2
L.60:
.long 0xffffffff
.long 0xffffffff
.long 0x1
.long 0x1
.long 0x14
.long 0x12c
.long 0x1f4
.long 0x190
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-176($sp)
.mask 0x4004000,-168
.frame $sp,176,$26,48
stq $14,0($sp)
stq $26,8($sp)
.prologue 1
lda $27,-120+176($sp)
lda $1,L.58
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-128+176($sp)
lda $1,L.59
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($27)
stl $2,4($27)
lda $27,-88+176($sp)
lda $1,L.60
addq $1,32,$1
addq $27,32,$3
L.76:
addq $1,-8,$1
addq $3,-8,$3
ldl $4,0($1)
ldl $2,4($1)
stl $4,0($3)
stl $2,4($3)
cmpult $27,$3,$23
bne $23,L.76
lda $16,-136+176($sp)
lda $27,-10
mov $27,$17
mov $27,$18
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,-144+176($sp)
lda $1,-128+176($sp)
uldq $17,0($1)
lda $1,-136+176($sp)
uldq $18,0($1)
jsr $26,addpoint
ldgp $gp,0($26)
lda $16,-152+176($sp)
lda $27,10
mov $27,$17
mov $27,$18
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,-160+176($sp)
lda $1,-120+176($sp)
uldq $17,0($1)
lda $1,-152+176($sp)
uldq $18,0($1)
jsr $26,addpoint
ldgp $gp,0($26)
lda $16,-104+176($sp)
lda $1,-144+176($sp)
uldq $17,0($1)
lda $1,-160+176($sp)
uldq $18,0($1)
jsr $26,makerect
ldgp $gp,0($26)
mov $31,$14
br L.64
L.61:
lda $16,-112+176($sp)
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
lda $25,-88+176($sp)
addq $27,$25,$25
ldl $17,($25)
lda $25,-84+176($sp)
addq $27,$25,$27
ldl $18,($27)
jsr $26,makepoint
ldgp $gp,0($26)
lda $16,L.65
sll $14,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,3,$27
lda $25,-88+176($sp)
addq $27,$25,$27
ldl $17,($27)
ldl $18,-108+176($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $1,-112+176($sp)
uldq $16,0($1)
lda $1,-104+176($sp)
uldq $17,0($1)
uldq $18,8($1)
jsr $26,ptinrect
ldgp $gp,0($26)
cmpeq $0,$31,$23
beq $23,L.68
lda $16,L.70
jsr $26,printf
ldgp $gp,0($26)
L.68:
lda $16,L.71
ldl $17,-104+176($sp)
ldl $18,-100+176($sp)
ldl $19,-96+176($sp)
ldl $20,-92+176($sp)
jsr $26,printf
ldgp $gp,0($26)
L.62:
lda $14,1($14)
L.64:
mov $14,$27
lda $25,4
cmpult $27,$25,$23
bne $23,L.61
lda $1,y
uldq $16,0($1)
jsr $26,odd
ldgp $gp,0($26)
mov $31,$16
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.57:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,176($sp)
ret
.end main
.rdata
.align 0
L.71:
.byte 119
.byte 105
.byte 116
.byte 104
.byte 105
.byte 110
.byte 32
.byte 91
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 59
.byte 32
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 93
.byte 10
.byte 0
.align 0
L.70:
.byte 110
.byte 111
.byte 116
.byte 32
.byte 0
.align 0
L.65:
.byte 40
.byte 37
.byte 100
.byte 44
.byte 37
.byte 100
.byte 41
.byte 32
.byte 105
.byte 115
.byte 32
.byte 0
.align 0
L.56:
.byte 37
.byte 115
.byte 10
.byte 0

152
lcc/alpha/osf/tst/switch.1bk Normal file → Executable file
View file

@ -1,76 +1,76 @@
b = 0x8
f = 0xc
n = 0xa
r = 0xd
t = 0x9
v = 0xb
x = 0x78
f:
x = 0
x = 1
x = 2
x = 2
x = 2
x = 2
x = 2
x = 7
x = 8
x = 9
x = 9
x = 9
x = 9
x = 9
x = 9
x = 9
x = 16
x = 17
x = 18
x = 19
x = 20
g:
1 1
1 2
2 3
2 4
2 5
3 6
d 6
3 7
d 7
3 8
d 8
d 9
d 10
h:
i = 8
i = 16
i = 120
i = 128
i = 248
i = 264
i = 272
i = 280
i = 288
i = 296
i = 304
i = 312
488 defaults
x = 0x1000000
x = 0x2000000
x = 0x3000000
x = 0x4000000
x = 0x5000000
x = 0x6000000 (default)
x = 0x7000000 (default)
0
1
2
3
4
5
0
1
2
3
4
5
b = 0x8
f = 0xc
n = 0xa
r = 0xd
t = 0x9
v = 0xb
x = 0x78
f:
x = 0
x = 1
x = 2
x = 2
x = 2
x = 2
x = 2
x = 7
x = 8
x = 9
x = 9
x = 9
x = 9
x = 9
x = 9
x = 9
x = 16
x = 17
x = 18
x = 19
x = 20
g:
1 1
1 2
2 3
2 4
2 5
3 6
d 6
3 7
d 7
3 8
d 8
d 9
d 10
h:
i = 8
i = 16
i = 120
i = 128
i = 248
i = 264
i = 272
i = 280
i = 288
i = 296
i = 304
i = 312
488 defaults
x = 0x1000000
x = 0x2000000
x = 0x3000000
x = 0x4000000
x = 0x5000000
x = 0x6000000 (default)
x = 0x7000000 (default)
0
1
2
3
4
5
0
1
2
3
4
5

14
lcc/alpha/osf/tst/switch.2bk Normal file → Executable file
View file

@ -1,7 +1,7 @@
tst/switch.c:55: warning: missing return value
tst/switch.c:73: warning: missing return value
tst/switch.c:97: warning: missing return value
tst/switch.c:101: warning: overflow in converting constant expression from `int' to `unsigned int'
tst/switch.c:102: warning: overflow in converting constant expression from `int' to `unsigned int'
tst/switch.c:112: warning: missing return value
tst/switch.c:137: warning: missing return value
tst/switch.c:55: warning: missing return value
tst/switch.c:73: warning: missing return value
tst/switch.c:97: warning: missing return value
tst/switch.c:101: warning: overflow in converting constant expression from `int' to `unsigned int'
tst/switch.c:102: warning: overflow in converting constant expression from `int' to `unsigned int'
tst/switch.c:112: warning: missing return value
tst/switch.c:137: warning: missing return value

1806
lcc/alpha/osf/tst/switch.sbk Normal file → Executable file

File diff suppressed because it is too large Load diff

148
lcc/alpha/osf/tst/wf1.1bk Normal file → Executable file
View file

@ -1,74 +1,74 @@
5 a
2 and
5 buf
16 c
8 char
1 compare
4 cond
5 count
1 d
1 die
3 else
1 entry
1 eof
4 err
1 error
1 exit
1 folded
1 for
1 free
1 frequencies
1 frequency
1 get
2 getchar
3 getword
14 if
2 in
1 index
1 input
1 install
8 int
1 into
1 is
4 isletter
1 it
1 itself
5 left
1 letter
7 lookup
1 main
2 malloc
1 message
2 n
1 necessary
12 next
9 node
4 of
1 on
1 or
1 otherwise
2 out
8 p
3 print
2 printf
16 return
5 right
4 root
25 s
2 storage
3 strcmp
1 strcpy
1 strlen
8 struct
1 structures
2 subtree
1 t
5 tprint
9 tree
1 uses
1 version
1 wf
3 while
21 word
9 words
2 z
5 a
2 and
5 buf
16 c
8 char
1 compare
4 cond
5 count
1 d
1 die
3 else
1 entry
1 eof
4 err
1 error
1 exit
1 folded
1 for
1 free
1 frequencies
1 frequency
1 get
2 getchar
3 getword
14 if
2 in
1 index
1 input
1 install
8 int
1 into
1 is
4 isletter
1 it
1 itself
5 left
1 letter
7 lookup
1 main
2 malloc
1 message
2 n
1 necessary
12 next
9 node
4 of
1 on
1 or
1 otherwise
2 out
8 p
3 print
2 printf
16 return
5 right
4 root
25 s
2 storage
3 strcmp
1 strcpy
1 strlen
8 struct
1 structures
2 subtree
1 t
5 tprint
9 tree
1 uses
1 version
1 wf
3 while
21 word
9 words
2 z

4
lcc/alpha/osf/tst/wf1.2bk Normal file → Executable file
View file

@ -1,2 +1,2 @@
tst/wf1.c:29: warning: missing return value
tst/wf1.c:87: warning: missing return value
tst/wf1.c:29: warning: missing return value
tst/wf1.c:87: warning: missing return value

800
lcc/alpha/osf/tst/wf1.sbk Normal file → Executable file
View file

@ -1,400 +1,400 @@
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4000000,-96
.frame $sp,96,$26,48
stq $26,0($sp)
.prologue 1
stq $31,-88+96($sp)
stl $31,next
br L.3
L.2:
lda $16,-76+96($sp)
lda $17,-88+96($sp)
jsr $26,lookup
ldgp $gp,0($26)
ldl $25,($0)
lda $25,1($25)
stl $25,($0)
L.3:
lda $16,-76+96($sp)
jsr $26,getword
ldgp $gp,0($26)
cmpeq $0,$31,$23
beq $23,L.2
ldq $16,-88+96($sp)
jsr $26,tprint
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,96($sp)
ret
.end main
.globl err
.text
.ent err
err:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
lda $16,L.6
ldq $17,-48+64($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $16,1
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.5:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end err
.globl getword
.text
.ent getword
getword:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5006000,-72
.frame $sp,96,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
stq $16,48($sp)
.prologue 1
L.8:
L.9:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
lda $25,-1
cmpeq $27,$25,$23
bne $23,L.11
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
cmpeq $0,$31,$23
bne $23,L.8
L.11:
ldq $13,-48+96($sp)
br L.15
L.12:
mov $13,$27
lda $13,1($27)
mov $14,$25
stb $25,($27)
L.13:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$14
L.15:
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
mov $0,$14
cmpeq $0,$31,$23
beq $23,L.12
stb $31,($13)
mov $13,$27
ldq $25,-48+96($sp)
cmpule $27,$25,$23
bne $23,L.16
lda $0,1
br L.7
L.16:
mov $31,$0
L.7:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,96($sp)
ret
.end getword
.globl isletter
.text
.ent isletter
isletter:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
lda $27,65
cmplt $16,$27,$23
bne $23,L.19
lda $27,90
cmple $16,$27,$23
beq $23,L.19
lda $16,32($16)
L.19:
lda $27,97
cmplt $16,$27,$23
bne $23,L.21
lda $27,122
cmple $16,$27,$23
beq $23,L.21
mov $16,$0
br L.18
L.21:
mov $31,$0
L.18:
lda $sp,64($sp)
ret
.end isletter
.globl lookup
.text
.ent lookup
lookup:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
mov $17,$14
.prologue 1
ldq $27,($14)
cmpeq $27,$31,$23
bne $23,L.24
ldq $16,-48+80($sp)
ldq $27,($14)
ldq $17,24($27)
jsr $26,strcmp
ldgp $gp,0($26)
stl $0,-60+80($sp)
ldl $27,-60+80($sp)
cmplt $27,$31,$23
beq $23,L.26
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,8($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.26:
ldl $27,-60+80($sp)
cmple $27,$31,$23
bne $23,L.28
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,16($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.28:
ldq $0,($14)
br L.23
L.24:
ldl $27,next
lda $25,2000
cmplt $27,$25,$23
bne $23,L.30
lda $16,L.32
jsr $26,err
ldgp $gp,0($26)
L.30:
ldl $27,next
sll $27,5,$27
stl $31,words($27)
ldl $27,next
sll $27,5,$27
stq $31,words+16($27)
stq $31,words+8($27)
ldq $16,-48+80($sp)
jsr $26,strlen
ldgp $gp,0($26)
mov $0,$27
lda $16,1($27)
jsr $26,malloc
ldgp $gp,0($26)
ldl $25,next
sll $25,5,$25
stq $0,words+24($25)
ldl $27,next
sll $27,5,$27
ldq $27,words+24($27)
cmpeq $27,$31,$23
beq $23,L.36
lda $16,L.39
jsr $26,err
ldgp $gp,0($26)
L.36:
ldl $27,next
sll $27,5,$27
ldq $16,words+24($27)
ldq $17,-48+80($sp)
jsr $26,strcpy
ldgp $gp,0($26)
ldl $27,next
lda $25,1($27)
stl $25,next
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,5,$27
lda $27,words($27)
stq $27,($14)
mov $27,$0
L.23:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end lookup
.globl tprint
.text
.ent tprint
tprint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
mov $16,$14
.prologue 1
mov $14,$27
cmpeq $27,$31,$23
bne $23,L.42
ldq $16,8($14)
jsr $26,tprint
ldgp $gp,0($26)
lda $16,L.44
ldl $17,($14)
ldq $18,24($14)
jsr $26,printf
ldgp $gp,0($26)
ldq $16,16($14)
jsr $26,tprint
ldgp $gp,0($26)
L.42:
mov $31,$0
L.41:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end tprint
.globl strcmp
.text
.ent strcmp
strcmp:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
br L.47
L.46:
mov $16,$27
lda $16,1($27)
ldb $27,($27)
cmpeq $27,$31,$23
beq $23,L.49
mov $31,$0
br L.45
L.49:
lda $17,1($17)
L.47:
ldb $27,($16)
ldb $25,($17)
cmpeq $27,$25,$23
bne $23,L.46
ldb $27,($16)
cmpeq $27,$31,$23
beq $23,L.51
lda $0,-1
br L.45
L.51:
ldb $27,($17)
cmpeq $27,$31,$23
beq $23,L.53
lda $0,1
br L.45
L.53:
ldb $27,($16)
ldb $25,($17)
subl $27,$25,$0
L.45:
lda $sp,64($sp)
ret
.end strcmp
.globl next
.comm next,4
.globl words
.comm words,64000
.rdata
.align 0
L.44:
.byte 37
.byte 100
.byte 9
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.39:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 119
.byte 111
.byte 114
.byte 100
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.32:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 110
.byte 111
.byte 100
.byte 101
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.6:
.byte 63
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4000000,-96
.frame $sp,96,$26,48
stq $26,0($sp)
.prologue 1
stq $31,-88+96($sp)
stl $31,next
br L.3
L.2:
lda $16,-76+96($sp)
lda $17,-88+96($sp)
jsr $26,lookup
ldgp $gp,0($26)
ldl $25,($0)
lda $25,1($25)
stl $25,($0)
L.3:
lda $16,-76+96($sp)
jsr $26,getword
ldgp $gp,0($26)
cmpeq $0,$31,$23
beq $23,L.2
ldq $16,-88+96($sp)
jsr $26,tprint
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,96($sp)
ret
.end main
.globl err
.text
.ent err
err:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
lda $16,L.6
ldq $17,-48+64($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $16,1
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.5:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end err
.globl getword
.text
.ent getword
getword:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5006000,-72
.frame $sp,96,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
stq $16,48($sp)
.prologue 1
L.8:
L.9:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
lda $25,-1
cmpeq $27,$25,$23
bne $23,L.11
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
cmpeq $0,$31,$23
bne $23,L.8
L.11:
ldq $13,-48+96($sp)
br L.15
L.12:
mov $13,$27
lda $13,1($27)
mov $14,$25
stb $25,($27)
L.13:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$14
L.15:
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
mov $0,$14
cmpeq $0,$31,$23
beq $23,L.12
stb $31,($13)
mov $13,$27
ldq $25,-48+96($sp)
cmpule $27,$25,$23
bne $23,L.16
lda $0,1
br L.7
L.16:
mov $31,$0
L.7:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,96($sp)
ret
.end getword
.globl isletter
.text
.ent isletter
isletter:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
lda $27,65
cmplt $16,$27,$23
bne $23,L.19
lda $27,90
cmple $16,$27,$23
beq $23,L.19
lda $16,32($16)
L.19:
lda $27,97
cmplt $16,$27,$23
bne $23,L.21
lda $27,122
cmple $16,$27,$23
beq $23,L.21
mov $16,$0
br L.18
L.21:
mov $31,$0
L.18:
lda $sp,64($sp)
ret
.end isletter
.globl lookup
.text
.ent lookup
lookup:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
mov $17,$14
.prologue 1
ldq $27,($14)
cmpeq $27,$31,$23
bne $23,L.24
ldq $16,-48+80($sp)
ldq $27,($14)
ldq $17,24($27)
jsr $26,strcmp
ldgp $gp,0($26)
stl $0,-60+80($sp)
ldl $27,-60+80($sp)
cmplt $27,$31,$23
beq $23,L.26
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,8($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.26:
ldl $27,-60+80($sp)
cmple $27,$31,$23
bne $23,L.28
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,16($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.28:
ldq $0,($14)
br L.23
L.24:
ldl $27,next
lda $25,2000
cmplt $27,$25,$23
bne $23,L.30
lda $16,L.32
jsr $26,err
ldgp $gp,0($26)
L.30:
ldl $27,next
sll $27,5,$27
stl $31,words($27)
ldl $27,next
sll $27,5,$27
stq $31,words+16($27)
stq $31,words+8($27)
ldq $16,-48+80($sp)
jsr $26,strlen
ldgp $gp,0($26)
mov $0,$27
lda $16,1($27)
jsr $26,malloc
ldgp $gp,0($26)
ldl $25,next
sll $25,5,$25
stq $0,words+24($25)
ldl $27,next
sll $27,5,$27
ldq $27,words+24($27)
cmpeq $27,$31,$23
beq $23,L.36
lda $16,L.39
jsr $26,err
ldgp $gp,0($26)
L.36:
ldl $27,next
sll $27,5,$27
ldq $16,words+24($27)
ldq $17,-48+80($sp)
jsr $26,strcpy
ldgp $gp,0($26)
ldl $27,next
lda $25,1($27)
stl $25,next
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,5,$27
lda $27,words($27)
stq $27,($14)
mov $27,$0
L.23:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end lookup
.globl tprint
.text
.ent tprint
tprint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
mov $16,$14
.prologue 1
mov $14,$27
cmpeq $27,$31,$23
bne $23,L.42
ldq $16,8($14)
jsr $26,tprint
ldgp $gp,0($26)
lda $16,L.44
ldl $17,($14)
ldq $18,24($14)
jsr $26,printf
ldgp $gp,0($26)
ldq $16,16($14)
jsr $26,tprint
ldgp $gp,0($26)
L.42:
mov $31,$0
L.41:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end tprint
.globl strcmp
.text
.ent strcmp
strcmp:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
br L.47
L.46:
mov $16,$27
lda $16,1($27)
ldb $27,($27)
cmpeq $27,$31,$23
beq $23,L.49
mov $31,$0
br L.45
L.49:
lda $17,1($17)
L.47:
ldb $27,($16)
ldb $25,($17)
cmpeq $27,$25,$23
bne $23,L.46
ldb $27,($16)
cmpeq $27,$31,$23
beq $23,L.51
lda $0,-1
br L.45
L.51:
ldb $27,($17)
cmpeq $27,$31,$23
beq $23,L.53
lda $0,1
br L.45
L.53:
ldb $27,($16)
ldb $25,($17)
subl $27,$25,$0
L.45:
lda $sp,64($sp)
ret
.end strcmp
.globl next
.comm next,4
.globl words
.comm words,64000
.rdata
.align 0
L.44:
.byte 37
.byte 100
.byte 9
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.39:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 119
.byte 111
.byte 114
.byte 100
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.32:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 110
.byte 111
.byte 100
.byte 101
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.6:
.byte 63
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0

20
lcc/alpha/osf/tst/yacc.1bk Normal file → Executable file
View file

@ -1,10 +1,10 @@
a
b
load
negate
push 5
c
load
multiply
add
store
a
b
load
negate
push 5
c
load
multiply
add
store

6
lcc/alpha/osf/tst/yacc.2bk Normal file → Executable file
View file

@ -1,3 +1,3 @@
tst/yacc.c:345: warning: missing return value
tst/yacc.c:349: warning: missing return value
tst/yacc.c:359: warning: missing return value
tst/yacc.c:345: warning: missing return value
tst/yacc.c:349: warning: missing return value
tst/yacc.c:359: warning: missing return value

4804
lcc/alpha/osf/tst/yacc.sbk Normal file → Executable file

File diff suppressed because it is too large Load diff

0
lcc/bin/lcc.exe Normal file → Executable file
View file

0
lcc/bin/q3cpp.exe Normal file → Executable file
View file

0
lcc/bin/q3rcc.exe Normal file → Executable file
View file

6
lcc/buildnt.bat Normal file → Executable file
View file

@ -1,3 +1,3 @@
call vcvars32
set BUILDDIR=bin
nmake -f makefile.nt all
call vcvars32
set BUILDDIR=bin
nmake -f makefile.nt all

8
lcc/buildnt.sh Normal file → Executable file
View file

@ -1,4 +1,4 @@
#!/bin/sh
export BUILDDIR=.\\out
mkdir out
nmake -f makefile.nt all
#!/bin/sh
export BUILDDIR=.\\out
mkdir out
nmake -f makefile.nt all

644
lcc/cpp/cpp.c Normal file → Executable file
View file

@ -1,322 +1,322 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdarg.h>
#include "cpp.h"
char rcsid[] = "cpp.c - faked rcsid";
#define OUTS 16384
char outbuf[OUTS];
char *outp = outbuf;
Source *cursource;
int nerrs;
struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" };
char *curtime;
int incdepth;
int ifdepth;
int ifsatisfied[NIF];
int skipping;
int
main(int argc, char **argv)
{
Tokenrow tr;
time_t t;
char ebuf[BUFSIZ];
setbuf(stderr, ebuf);
t = time(NULL);
curtime = ctime(&t);
maketokenrow(3, &tr);
expandlex();
setup(argc, argv);
fixlex();
iniths();
genline();
process(&tr);
flushout();
fflush(stderr);
exit(nerrs > 0);
return 0;
}
void
process(Tokenrow *trp)
{
int anymacros = 0;
for (;;) {
if (trp->tp >= trp->lp) {
trp->tp = trp->lp = trp->bp;
outp = outbuf;
anymacros |= gettokens(trp, 1);
trp->tp = trp->bp;
}
if (trp->tp->type == END) {
if (--incdepth>=0) {
if (cursource->ifdepth)
error(ERROR,
"Unterminated conditional in #include");
unsetsource();
cursource->line += cursource->lineinc;
trp->tp = trp->lp;
genline();
continue;
}
if (ifdepth)
error(ERROR, "Unterminated #if/#ifdef/#ifndef");
break;
}
if (trp->tp->type==SHARP) {
trp->tp += 1;
control(trp);
} else if (!skipping && anymacros)
expandrow(trp, NULL);
if (skipping)
setempty(trp);
puttokens(trp);
anymacros = 0;
cursource->line += cursource->lineinc;
if (cursource->lineinc>1) {
genline();
}
}
}
void
control(Tokenrow *trp)
{
Nlist *np;
Token *tp;
tp = trp->tp;
if (tp->type!=NAME) {
if (tp->type==NUMBER)
goto kline;
if (tp->type != NL)
error(ERROR, "Unidentifiable control line");
return; /* else empty line */
}
if ((np = lookup(tp, 0))==NULL || (np->flag&ISKW)==0 && !skipping) {
error(WARNING, "Unknown preprocessor control %t", tp);
return;
}
if (skipping) {
switch (np->val) {
case KENDIF:
if (--ifdepth<skipping)
skipping = 0;
--cursource->ifdepth;
setempty(trp);
return;
case KIFDEF:
case KIFNDEF:
case KIF:
if (++ifdepth >= NIF)
error(FATAL, "#if too deeply nested");
++cursource->ifdepth;
return;
case KELIF:
case KELSE:
if (ifdepth<=skipping)
break;
return;
default:
return;
}
}
switch (np->val) {
case KDEFINE:
dodefine(trp);
break;
case KUNDEF:
tp += 1;
if (tp->type!=NAME || trp->lp - trp->bp != 4) {
error(ERROR, "Syntax error in #undef");
break;
}
if ((np = lookup(tp, 0)) != NULL)
np->flag &= ~ISDEFINED;
break;
case KPRAGMA:
return;
case KIFDEF:
case KIFNDEF:
case KIF:
if (++ifdepth >= NIF)
error(FATAL, "#if too deeply nested");
++cursource->ifdepth;
ifsatisfied[ifdepth] = 0;
if (eval(trp, np->val))
ifsatisfied[ifdepth] = 1;
else
skipping = ifdepth;
break;
case KELIF:
if (ifdepth==0) {
error(ERROR, "#elif with no #if");
return;
}
if (ifsatisfied[ifdepth]==2)
error(ERROR, "#elif after #else");
if (eval(trp, np->val)) {
if (ifsatisfied[ifdepth])
skipping = ifdepth;
else {
skipping = 0;
ifsatisfied[ifdepth] = 1;
}
} else
skipping = ifdepth;
break;
case KELSE:
if (ifdepth==0 || cursource->ifdepth==0) {
error(ERROR, "#else with no #if");
return;
}
if (ifsatisfied[ifdepth]==2)
error(ERROR, "#else after #else");
if (trp->lp - trp->bp != 3)
error(ERROR, "Syntax error in #else");
skipping = ifsatisfied[ifdepth]? ifdepth: 0;
ifsatisfied[ifdepth] = 2;
break;
case KENDIF:
if (ifdepth==0 || cursource->ifdepth==0) {
error(ERROR, "#endif with no #if");
return;
}
--ifdepth;
--cursource->ifdepth;
if (trp->lp - trp->bp != 3)
error(WARNING, "Syntax error in #endif");
break;
case KERROR:
trp->tp = tp+1;
error(WARNING, "#error directive: %r", trp);
break;
case KLINE:
trp->tp = tp+1;
expandrow(trp, "<line>");
tp = trp->bp+2;
kline:
if (tp+1>=trp->lp || tp->type!=NUMBER || tp+3<trp->lp
|| (tp+3==trp->lp && ((tp+1)->type!=STRING)||*(tp+1)->t=='L')){
error(ERROR, "Syntax error in #line");
return;
}
cursource->line = atol((char*)tp->t)-1;
if (cursource->line<0 || cursource->line>=32768)
error(WARNING, "#line specifies number out of range");
tp = tp+1;
if (tp+1<trp->lp)
cursource->filename=(char*)newstring(tp->t+1,tp->len-2,0);
return;
case KDEFINED:
error(ERROR, "Bad syntax for control line");
break;
case KINCLUDE:
doinclude(trp);
trp->lp = trp->bp;
return;
case KEVAL:
eval(trp, np->val);
break;
default:
error(ERROR, "Preprocessor control `%t' not yet implemented", tp);
break;
}
setempty(trp);
return;
}
void *
domalloc(int size)
{
void *p = malloc(size);
if (p==NULL)
error(FATAL, "Out of memory from malloc");
return p;
}
void
dofree(void *p)
{
free(p);
}
void
error(enum errtype type, char *string, ...)
{
va_list ap;
char *cp, *ep;
Token *tp;
Tokenrow *trp;
Source *s;
int i;
fprintf(stderr, "cpp: ");
for (s=cursource; s; s=s->next)
if (*s->filename)
fprintf(stderr, "%s:%d ", s->filename, s->line);
va_start(ap, string);
for (ep=string; *ep; ep++) {
if (*ep=='%') {
switch (*++ep) {
case 's':
cp = va_arg(ap, char *);
fprintf(stderr, "%s", cp);
break;
case 'd':
i = va_arg(ap, int);
fprintf(stderr, "%d", i);
break;
case 't':
tp = va_arg(ap, Token *);
fprintf(stderr, "%.*s", tp->len, tp->t);
break;
case 'r':
trp = va_arg(ap, Tokenrow *);
for (tp=trp->tp; tp<trp->lp&&tp->type!=NL; tp++) {
if (tp>trp->tp && tp->wslen)
fputc(' ', stderr);
fprintf(stderr, "%.*s", tp->len, tp->t);
}
break;
default:
fputc(*ep, stderr);
break;
}
} else
fputc(*ep, stderr);
}
va_end(ap);
fputc('\n', stderr);
if (type==FATAL)
exit(1);
if (type!=WARNING)
nerrs = 1;
fflush(stderr);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdarg.h>
#include "cpp.h"
char rcsid[] = "cpp.c - faked rcsid";
#define OUTS 16384
char outbuf[OUTS];
char *outp = outbuf;
Source *cursource;
int nerrs;
struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" };
char *curtime;
int incdepth;
int ifdepth;
int ifsatisfied[NIF];
int skipping;
int
main(int argc, char **argv)
{
Tokenrow tr;
time_t t;
char ebuf[BUFSIZ];
setbuf(stderr, ebuf);
t = time(NULL);
curtime = ctime(&t);
maketokenrow(3, &tr);
expandlex();
setup(argc, argv);
fixlex();
iniths();
genline();
process(&tr);
flushout();
fflush(stderr);
exit(nerrs > 0);
return 0;
}
void
process(Tokenrow *trp)
{
int anymacros = 0;
for (;;) {
if (trp->tp >= trp->lp) {
trp->tp = trp->lp = trp->bp;
outp = outbuf;
anymacros |= gettokens(trp, 1);
trp->tp = trp->bp;
}
if (trp->tp->type == END) {
if (--incdepth>=0) {
if (cursource->ifdepth)
error(ERROR,
"Unterminated conditional in #include");
unsetsource();
cursource->line += cursource->lineinc;
trp->tp = trp->lp;
genline();
continue;
}
if (ifdepth)
error(ERROR, "Unterminated #if/#ifdef/#ifndef");
break;
}
if (trp->tp->type==SHARP) {
trp->tp += 1;
control(trp);
} else if (!skipping && anymacros)
expandrow(trp, NULL);
if (skipping)
setempty(trp);
puttokens(trp);
anymacros = 0;
cursource->line += cursource->lineinc;
if (cursource->lineinc>1) {
genline();
}
}
}
void
control(Tokenrow *trp)
{
Nlist *np;
Token *tp;
tp = trp->tp;
if (tp->type!=NAME) {
if (tp->type==NUMBER)
goto kline;
if (tp->type != NL)
error(ERROR, "Unidentifiable control line");
return; /* else empty line */
}
if ((np = lookup(tp, 0))==NULL || (np->flag&ISKW)==0 && !skipping) {
error(WARNING, "Unknown preprocessor control %t", tp);
return;
}
if (skipping) {
switch (np->val) {
case KENDIF:
if (--ifdepth<skipping)
skipping = 0;
--cursource->ifdepth;
setempty(trp);
return;
case KIFDEF:
case KIFNDEF:
case KIF:
if (++ifdepth >= NIF)
error(FATAL, "#if too deeply nested");
++cursource->ifdepth;
return;
case KELIF:
case KELSE:
if (ifdepth<=skipping)
break;
return;
default:
return;
}
}
switch (np->val) {
case KDEFINE:
dodefine(trp);
break;
case KUNDEF:
tp += 1;
if (tp->type!=NAME || trp->lp - trp->bp != 4) {
error(ERROR, "Syntax error in #undef");
break;
}
if ((np = lookup(tp, 0)) != NULL)
np->flag &= ~ISDEFINED;
break;
case KPRAGMA:
return;
case KIFDEF:
case KIFNDEF:
case KIF:
if (++ifdepth >= NIF)
error(FATAL, "#if too deeply nested");
++cursource->ifdepth;
ifsatisfied[ifdepth] = 0;
if (eval(trp, np->val))
ifsatisfied[ifdepth] = 1;
else
skipping = ifdepth;
break;
case KELIF:
if (ifdepth==0) {
error(ERROR, "#elif with no #if");
return;
}
if (ifsatisfied[ifdepth]==2)
error(ERROR, "#elif after #else");
if (eval(trp, np->val)) {
if (ifsatisfied[ifdepth])
skipping = ifdepth;
else {
skipping = 0;
ifsatisfied[ifdepth] = 1;
}
} else
skipping = ifdepth;
break;
case KELSE:
if (ifdepth==0 || cursource->ifdepth==0) {
error(ERROR, "#else with no #if");
return;
}
if (ifsatisfied[ifdepth]==2)
error(ERROR, "#else after #else");
if (trp->lp - trp->bp != 3)
error(ERROR, "Syntax error in #else");
skipping = ifsatisfied[ifdepth]? ifdepth: 0;
ifsatisfied[ifdepth] = 2;
break;
case KENDIF:
if (ifdepth==0 || cursource->ifdepth==0) {
error(ERROR, "#endif with no #if");
return;
}
--ifdepth;
--cursource->ifdepth;
if (trp->lp - trp->bp != 3)
error(WARNING, "Syntax error in #endif");
break;
case KERROR:
trp->tp = tp+1;
error(WARNING, "#error directive: %r", trp);
break;
case KLINE:
trp->tp = tp+1;
expandrow(trp, "<line>");
tp = trp->bp+2;
kline:
if (tp+1>=trp->lp || tp->type!=NUMBER || tp+3<trp->lp
|| (tp+3==trp->lp && ((tp+1)->type!=STRING)||*(tp+1)->t=='L')){
error(ERROR, "Syntax error in #line");
return;
}
cursource->line = atol((char*)tp->t)-1;
if (cursource->line<0 || cursource->line>=32768)
error(WARNING, "#line specifies number out of range");
tp = tp+1;
if (tp+1<trp->lp)
cursource->filename=(char*)newstring(tp->t+1,tp->len-2,0);
return;
case KDEFINED:
error(ERROR, "Bad syntax for control line");
break;
case KINCLUDE:
doinclude(trp);
trp->lp = trp->bp;
return;
case KEVAL:
eval(trp, np->val);
break;
default:
error(ERROR, "Preprocessor control `%t' not yet implemented", tp);
break;
}
setempty(trp);
return;
}
void *
domalloc(int size)
{
void *p = malloc(size);
if (p==NULL)
error(FATAL, "Out of memory from malloc");
return p;
}
void
dofree(void *p)
{
free(p);
}
void
error(enum errtype type, char *string, ...)
{
va_list ap;
char *cp, *ep;
Token *tp;
Tokenrow *trp;
Source *s;
int i;
fprintf(stderr, "cpp: ");
for (s=cursource; s; s=s->next)
if (*s->filename)
fprintf(stderr, "%s:%d ", s->filename, s->line);
va_start(ap, string);
for (ep=string; *ep; ep++) {
if (*ep=='%') {
switch (*++ep) {
case 's':
cp = va_arg(ap, char *);
fprintf(stderr, "%s", cp);
break;
case 'd':
i = va_arg(ap, int);
fprintf(stderr, "%d", i);
break;
case 't':
tp = va_arg(ap, Token *);
fprintf(stderr, "%.*s", tp->len, tp->t);
break;
case 'r':
trp = va_arg(ap, Tokenrow *);
for (tp=trp->tp; tp<trp->lp&&tp->type!=NL; tp++) {
if (tp>trp->tp && tp->wslen)
fputc(' ', stderr);
fprintf(stderr, "%.*s", tp->len, tp->t);
}
break;
default:
fputc(*ep, stderr);
break;
}
} else
fputc(*ep, stderr);
}
va_end(ap);
fputc('\n', stderr);
if (type==FATAL)
exit(1);
if (type!=WARNING)
nerrs = 1;
fflush(stderr);
}

326
lcc/cpp/cpp.h Normal file → Executable file
View file

@ -1,163 +1,163 @@
#define INS 32768 /* input buffer */
#define OBS 4096 /* outbut buffer */
#define NARG 32 /* Max number arguments to a macro */
#define NINCLUDE 32 /* Max number of include directories (-I) */
#define NIF 32 /* depth of nesting of #if */
#ifndef EOF
#define EOF (-1)
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef __alpha
typedef unsigned char uchar;
#endif
enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP,
EQ, NEQ, LEQ, GEQ, LSH, RSH, LAND, LOR, PPLUS, MMINUS,
ARROW, SBRA, SKET, LP, RP, DOT, AND, STAR, PLUS, MINUS,
TILDE, NOT, SLASH, PCT, LT, GT, CIRC, OR, QUEST,
COLON, ASGN, COMMA, SHARP, SEMIC, CBRA, CKET,
ASPLUS, ASMINUS, ASSTAR, ASSLASH, ASPCT, ASCIRC, ASLSH,
ASRSH, ASOR, ASAND, ELLIPS,
DSHARP1, NAME1, DEFINED, UMINUS };
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
KUNDEF, KLINE, KERROR, KPRAGMA, KDEFINED,
KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL };
#define ISDEFINED 01 /* has #defined value */
#define ISKW 02 /* is PP keyword */
#define ISUNCHANGE 04 /* can't be #defined in PP */
#define ISMAC 010 /* builtin macro, e.g. __LINE__ */
#define EOB 0xFE /* sentinel for end of input buffer */
#define EOFC 0xFD /* sentinel for end of input file */
#define XPWS 1 /* token flag: white space to assure token sep. */
typedef struct token {
unsigned char type;
unsigned char flag;
unsigned short hideset;
unsigned int wslen;
unsigned int len;
uchar *t;
} Token;
typedef struct tokenrow {
Token *tp; /* current one to scan */
Token *bp; /* base (allocated value) */
Token *lp; /* last+1 token used */
int max; /* number allocated */
} Tokenrow;
typedef struct source {
char *filename; /* name of file of the source */
int line; /* current line number */
int lineinc; /* adjustment for \\n lines */
uchar *inb; /* input buffer */
uchar *inp; /* input pointer */
uchar *inl; /* end of input */
int fd; /* input source */
int ifdepth; /* conditional nesting in include */
struct source *next; /* stack for #include */
} Source;
typedef struct nlist {
struct nlist *next;
uchar *name;
int len;
Tokenrow *vp; /* value as macro */
Tokenrow *ap; /* list of argument names, if any */
char val; /* value as preprocessor name */
char flag; /* is defined, is pp name */
} Nlist;
typedef struct includelist {
char deleted;
char always;
char *file;
} Includelist;
#define new(t) (t *)domalloc(sizeof(t))
#define quicklook(a,b) (namebit[(a)&077] & (1<<((b)&037)))
#define quickset(a,b) namebit[(a)&077] |= (1<<((b)&037))
extern unsigned long namebit[077+1];
enum errtype { WARNING, ERROR, FATAL };
void expandlex(void);
void fixlex(void);
void setup(int, char **);
int gettokens(Tokenrow *, int);
int comparetokens(Tokenrow *, Tokenrow *);
Source *setsource(char *, int, char *);
void unsetsource(void);
void puttokens(Tokenrow *);
void process(Tokenrow *);
void *domalloc(int);
void dofree(void *);
void error(enum errtype, char *, ...);
void flushout(void);
int fillbuf(Source *);
int trigraph(Source *);
int foldline(Source *);
Nlist *lookup(Token *, int);
void control(Tokenrow *);
void dodefine(Tokenrow *);
void doadefine(Tokenrow *, int);
void doinclude(Tokenrow *);
void doif(Tokenrow *, enum kwtype);
void expand(Tokenrow *, Nlist *);
void builtin(Tokenrow *, int);
int gatherargs(Tokenrow *, Tokenrow **, int *);
void substargs(Nlist *, Tokenrow *, Tokenrow **);
void expandrow(Tokenrow *, char *);
void maketokenrow(int, Tokenrow *);
Tokenrow *copytokenrow(Tokenrow *, Tokenrow *);
Token *growtokenrow(Tokenrow *);
Tokenrow *normtokenrow(Tokenrow *);
void adjustrow(Tokenrow *, int);
void movetokenrow(Tokenrow *, Tokenrow *);
void insertrow(Tokenrow *, int, Tokenrow *);
void peektokens(Tokenrow *, char *);
void doconcat(Tokenrow *);
Tokenrow *stringify(Tokenrow *);
int lookuparg(Nlist *, Token *);
long eval(Tokenrow *, int);
void genline(void);
void setempty(Tokenrow *);
void makespace(Tokenrow *);
char *outnum(char *, int);
int digit(int);
uchar *newstring(uchar *, int, int);
int checkhideset(int, Nlist *);
void prhideset(int);
int newhideset(int, Nlist *);
int unionhideset(int, int);
void iniths(void);
void setobjname(char *);
#define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp)
extern char *outp;
extern Token nltoken;
extern Source *cursource;
extern char *curtime;
extern int incdepth;
extern int ifdepth;
extern int ifsatisfied[NIF];
extern int Mflag;
extern int skipping;
extern int verbose;
extern int Cplusplus;
extern Nlist *kwdefined;
extern Includelist includelist[NINCLUDE];
extern char wd[];
extern int creat(char *, int);
extern int open(char *, int);
extern int close(int);
extern int dup2(int, int);
extern int write(int, char *, size_t);
extern int read(int, char *, size_t);
#define INS 32768 /* input buffer */
#define OBS 4096 /* outbut buffer */
#define NARG 32 /* Max number arguments to a macro */
#define NINCLUDE 32 /* Max number of include directories (-I) */
#define NIF 32 /* depth of nesting of #if */
#ifndef EOF
#define EOF (-1)
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef __alpha
typedef unsigned char uchar;
#endif
enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP,
EQ, NEQ, LEQ, GEQ, LSH, RSH, LAND, LOR, PPLUS, MMINUS,
ARROW, SBRA, SKET, LP, RP, DOT, AND, STAR, PLUS, MINUS,
TILDE, NOT, SLASH, PCT, LT, GT, CIRC, OR, QUEST,
COLON, ASGN, COMMA, SHARP, SEMIC, CBRA, CKET,
ASPLUS, ASMINUS, ASSTAR, ASSLASH, ASPCT, ASCIRC, ASLSH,
ASRSH, ASOR, ASAND, ELLIPS,
DSHARP1, NAME1, DEFINED, UMINUS };
enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
KUNDEF, KLINE, KERROR, KPRAGMA, KDEFINED,
KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL };
#define ISDEFINED 01 /* has #defined value */
#define ISKW 02 /* is PP keyword */
#define ISUNCHANGE 04 /* can't be #defined in PP */
#define ISMAC 010 /* builtin macro, e.g. __LINE__ */
#define EOB 0xFE /* sentinel for end of input buffer */
#define EOFC 0xFD /* sentinel for end of input file */
#define XPWS 1 /* token flag: white space to assure token sep. */
typedef struct token {
unsigned char type;
unsigned char flag;
unsigned short hideset;
unsigned int wslen;
unsigned int len;
uchar *t;
} Token;
typedef struct tokenrow {
Token *tp; /* current one to scan */
Token *bp; /* base (allocated value) */
Token *lp; /* last+1 token used */
int max; /* number allocated */
} Tokenrow;
typedef struct source {
char *filename; /* name of file of the source */
int line; /* current line number */
int lineinc; /* adjustment for \\n lines */
uchar *inb; /* input buffer */
uchar *inp; /* input pointer */
uchar *inl; /* end of input */
int fd; /* input source */
int ifdepth; /* conditional nesting in include */
struct source *next; /* stack for #include */
} Source;
typedef struct nlist {
struct nlist *next;
uchar *name;
int len;
Tokenrow *vp; /* value as macro */
Tokenrow *ap; /* list of argument names, if any */
char val; /* value as preprocessor name */
char flag; /* is defined, is pp name */
} Nlist;
typedef struct includelist {
char deleted;
char always;
char *file;
} Includelist;
#define new(t) (t *)domalloc(sizeof(t))
#define quicklook(a,b) (namebit[(a)&077] & (1<<((b)&037)))
#define quickset(a,b) namebit[(a)&077] |= (1<<((b)&037))
extern unsigned long namebit[077+1];
enum errtype { WARNING, ERROR, FATAL };
void expandlex(void);
void fixlex(void);
void setup(int, char **);
int gettokens(Tokenrow *, int);
int comparetokens(Tokenrow *, Tokenrow *);
Source *setsource(char *, int, char *);
void unsetsource(void);
void puttokens(Tokenrow *);
void process(Tokenrow *);
void *domalloc(int);
void dofree(void *);
void error(enum errtype, char *, ...);
void flushout(void);
int fillbuf(Source *);
int trigraph(Source *);
int foldline(Source *);
Nlist *lookup(Token *, int);
void control(Tokenrow *);
void dodefine(Tokenrow *);
void doadefine(Tokenrow *, int);
void doinclude(Tokenrow *);
void doif(Tokenrow *, enum kwtype);
void expand(Tokenrow *, Nlist *);
void builtin(Tokenrow *, int);
int gatherargs(Tokenrow *, Tokenrow **, int *);
void substargs(Nlist *, Tokenrow *, Tokenrow **);
void expandrow(Tokenrow *, char *);
void maketokenrow(int, Tokenrow *);
Tokenrow *copytokenrow(Tokenrow *, Tokenrow *);
Token *growtokenrow(Tokenrow *);
Tokenrow *normtokenrow(Tokenrow *);
void adjustrow(Tokenrow *, int);
void movetokenrow(Tokenrow *, Tokenrow *);
void insertrow(Tokenrow *, int, Tokenrow *);
void peektokens(Tokenrow *, char *);
void doconcat(Tokenrow *);
Tokenrow *stringify(Tokenrow *);
int lookuparg(Nlist *, Token *);
long eval(Tokenrow *, int);
void genline(void);
void setempty(Tokenrow *);
void makespace(Tokenrow *);
char *outnum(char *, int);
int digit(int);
uchar *newstring(uchar *, int, int);
int checkhideset(int, Nlist *);
void prhideset(int);
int newhideset(int, Nlist *);
int unionhideset(int, int);
void iniths(void);
void setobjname(char *);
#define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp)
extern char *outp;
extern Token nltoken;
extern Source *cursource;
extern char *curtime;
extern int incdepth;
extern int ifdepth;
extern int ifsatisfied[NIF];
extern int Mflag;
extern int skipping;
extern int verbose;
extern int Cplusplus;
extern Nlist *kwdefined;
extern Includelist includelist[NINCLUDE];
extern char wd[];
extern int creat(char *, int);
extern int open(char *, int);
extern int close(int);
extern int dup2(int, int);
extern int write(int, char *, size_t);
extern int read(int, char *, size_t);

1040
lcc/cpp/eval.c Normal file → Executable file

File diff suppressed because it is too large Load diff

104
lcc/cpp/getopt.c Normal file → Executable file
View file

@ -1,52 +1,52 @@
#include <stdio.h>
#define EPR fprintf(stderr,
#define ERR(str, chr) if(opterr){EPR "%s%c\n", str, chr);}
int opterr = 1;
int optind = 1;
int optopt;
char *optarg;
char *strchr();
int
getopt (int argc, char *const argv[], const char *opts)
{
static int sp = 1;
int c;
char *cp;
if (sp == 1)
if (optind >= argc ||
argv[optind][0] != '-' || argv[optind][1] == '\0')
return -1;
else if (strcmp(argv[optind], "--") == 0) {
optind++;
return -1;
}
optopt = c = argv[optind][sp];
if (c == ':' || (cp=strchr(opts, c)) == 0) {
ERR (": illegal option -- ", c);
if (argv[optind][++sp] == '\0') {
optind++;
sp = 1;
}
return '?';
}
if (*++cp == ':') {
if (argv[optind][sp+1] != '\0')
optarg = &argv[optind++][sp+1];
else if (++optind >= argc) {
ERR (": option requires an argument -- ", c);
sp = 1;
return '?';
} else
optarg = argv[optind++];
sp = 1;
} else {
if (argv[optind][++sp] == '\0') {
sp = 1;
optind++;
}
optarg = 0;
}
return c;
}
#include <stdio.h>
#define EPR fprintf(stderr,
#define ERR(str, chr) if(opterr){EPR "%s%c\n", str, chr);}
int opterr = 1;
int optind = 1;
int optopt;
char *optarg;
char *strchr();
int
getopt (int argc, char *const argv[], const char *opts)
{
static int sp = 1;
int c;
char *cp;
if (sp == 1)
if (optind >= argc ||
argv[optind][0] != '-' || argv[optind][1] == '\0')
return -1;
else if (strcmp(argv[optind], "--") == 0) {
optind++;
return -1;
}
optopt = c = argv[optind][sp];
if (c == ':' || (cp=strchr(opts, c)) == 0) {
ERR (": illegal option -- ", c);
if (argv[optind][++sp] == '\0') {
optind++;
sp = 1;
}
return '?';
}
if (*++cp == ':') {
if (argv[optind][sp+1] != '\0')
optarg = &argv[optind++][sp+1];
else if (++optind >= argc) {
ERR (": option requires an argument -- ", c);
sp = 1;
return '?';
} else
optarg = argv[optind++];
sp = 1;
} else {
if (argv[optind][++sp] == '\0') {
sp = 1;
optind++;
}
optarg = 0;
}
return c;
}

224
lcc/cpp/hideset.c Normal file → Executable file
View file

@ -1,112 +1,112 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
/*
* A hideset is a null-terminated array of Nlist pointers.
* They are referred to by indices in the hidesets array.
* Hideset 0 is empty.
*/
#define HSSIZ 32
typedef Nlist **Hideset;
Hideset *hidesets;
int nhidesets = 0;
int maxhidesets = 3;
int inserths(Hideset, Hideset, Nlist *);
/*
* Test for membership in a hideset
*/
int
checkhideset(int hs, Nlist *np)
{
Hideset hsp;
if (hs>=nhidesets)
abort();
for (hsp = hidesets[hs]; *hsp; hsp++) {
if (*hsp == np)
return 1;
}
return 0;
}
/*
* Return the (possibly new) hideset obtained by adding np to hs.
*/
int
newhideset(int hs, Nlist *np)
{
int i, len;
Nlist *nhs[HSSIZ+3];
Hideset hs1, hs2;
len = inserths(nhs, hidesets[hs], np);
for (i=0; i<nhidesets; i++) {
for (hs1=nhs, hs2=hidesets[i]; *hs1==*hs2; hs1++, hs2++)
if (*hs1 == NULL)
return i;
}
if (len>=HSSIZ)
return hs;
if (nhidesets >= maxhidesets) {
maxhidesets = 3*maxhidesets/2+1;
hidesets = (Hideset *)realloc(hidesets, (sizeof (Hideset *))*maxhidesets);
if (hidesets == NULL)
error(FATAL, "Out of memory from realloc");
}
hs1 = (Hideset)domalloc(len*sizeof(Hideset));
memmove(hs1, nhs, len*sizeof(Hideset));
hidesets[nhidesets] = hs1;
return nhidesets++;
}
int
inserths(Hideset dhs, Hideset shs, Nlist *np)
{
Hideset odhs = dhs;
while (*shs && *shs < np)
*dhs++ = *shs++;
if (*shs != np)
*dhs++ = np;
do {
*dhs++ = *shs;
} while (*shs++);
return dhs - odhs;
}
/*
* Hideset union
*/
int
unionhideset(int hs1, int hs2)
{
Hideset hp;
for (hp = hidesets[hs2]; *hp; hp++)
hs1 = newhideset(hs1, *hp);
return hs1;
}
void
iniths(void)
{
hidesets = (Hideset *)domalloc(maxhidesets*sizeof(Hideset *));
hidesets[0] = (Hideset)domalloc(sizeof(Hideset));
*hidesets[0] = NULL;
nhidesets++;
}
void
prhideset(int hs)
{
Hideset np;
for (np = hidesets[hs]; *np; np++) {
fprintf(stderr, (char*)(*np)->name, (*np)->len);
fprintf(stderr, " ");
}
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
/*
* A hideset is a null-terminated array of Nlist pointers.
* They are referred to by indices in the hidesets array.
* Hideset 0 is empty.
*/
#define HSSIZ 32
typedef Nlist **Hideset;
Hideset *hidesets;
int nhidesets = 0;
int maxhidesets = 3;
int inserths(Hideset, Hideset, Nlist *);
/*
* Test for membership in a hideset
*/
int
checkhideset(int hs, Nlist *np)
{
Hideset hsp;
if (hs>=nhidesets)
abort();
for (hsp = hidesets[hs]; *hsp; hsp++) {
if (*hsp == np)
return 1;
}
return 0;
}
/*
* Return the (possibly new) hideset obtained by adding np to hs.
*/
int
newhideset(int hs, Nlist *np)
{
int i, len;
Nlist *nhs[HSSIZ+3];
Hideset hs1, hs2;
len = inserths(nhs, hidesets[hs], np);
for (i=0; i<nhidesets; i++) {
for (hs1=nhs, hs2=hidesets[i]; *hs1==*hs2; hs1++, hs2++)
if (*hs1 == NULL)
return i;
}
if (len>=HSSIZ)
return hs;
if (nhidesets >= maxhidesets) {
maxhidesets = 3*maxhidesets/2+1;
hidesets = (Hideset *)realloc(hidesets, (sizeof (Hideset *))*maxhidesets);
if (hidesets == NULL)
error(FATAL, "Out of memory from realloc");
}
hs1 = (Hideset)domalloc(len*sizeof(Hideset));
memmove(hs1, nhs, len*sizeof(Hideset));
hidesets[nhidesets] = hs1;
return nhidesets++;
}
int
inserths(Hideset dhs, Hideset shs, Nlist *np)
{
Hideset odhs = dhs;
while (*shs && *shs < np)
*dhs++ = *shs++;
if (*shs != np)
*dhs++ = np;
do {
*dhs++ = *shs;
} while (*shs++);
return dhs - odhs;
}
/*
* Hideset union
*/
int
unionhideset(int hs1, int hs2)
{
Hideset hp;
for (hp = hidesets[hs2]; *hp; hp++)
hs1 = newhideset(hs1, *hp);
return hs1;
}
void
iniths(void)
{
hidesets = (Hideset *)domalloc(maxhidesets*sizeof(Hideset *));
hidesets[0] = (Hideset)domalloc(sizeof(Hideset));
*hidesets[0] = NULL;
nhidesets++;
}
void
prhideset(int hs)
{
Hideset np;
for (np = hidesets[hs]; *np; np++) {
fprintf(stderr, (char*)(*np)->name, (*np)->len);
fprintf(stderr, " ");
}
}

244
lcc/cpp/include.c Normal file → Executable file
View file

@ -1,122 +1,122 @@
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
Includelist includelist[NINCLUDE];
extern char *objname;
void
doinclude(Tokenrow *trp)
{
char fname[256], iname[256];
Includelist *ip;
int angled, len, fd, i;
trp->tp += 1;
if (trp->tp>=trp->lp)
goto syntax;
if (trp->tp->type!=STRING && trp->tp->type!=LT) {
len = trp->tp - trp->bp;
expandrow(trp, "<include>");
trp->tp = trp->bp+len;
}
if (trp->tp->type==STRING) {
len = trp->tp->len-2;
if (len > sizeof(fname) - 1)
len = sizeof(fname) - 1;
strncpy(fname, (char*)trp->tp->t+1, len);
angled = 0;
} else if (trp->tp->type==LT) {
len = 0;
trp->tp++;
while (trp->tp->type!=GT) {
if (trp->tp>trp->lp || len+trp->tp->len+2 >= sizeof(fname))
goto syntax;
strncpy(fname+len, (char*)trp->tp->t, trp->tp->len);
len += trp->tp->len;
trp->tp++;
}
angled = 1;
} else
goto syntax;
trp->tp += 2;
if (trp->tp < trp->lp || len==0)
goto syntax;
fname[len] = '\0';
if (fname[0]=='/') {
fd = open(fname, 0);
strcpy(iname, fname);
} else for (fd = -1,i=NINCLUDE-1; i>=0; i--) {
ip = &includelist[i];
if (ip->file==NULL || ip->deleted || (angled && ip->always==0))
continue;
if (strlen(fname)+strlen(ip->file)+2 > sizeof(iname))
continue;
strcpy(iname, ip->file);
strcat(iname, "/");
strcat(iname, fname);
if ((fd = open(iname, 0)) >= 0)
break;
}
if ( Mflag>1 || !angled&&Mflag==1 ) {
write(1,objname,strlen(objname));
write(1,iname,strlen(iname));
write(1,"\n",1);
}
if (fd >= 0) {
if (++incdepth > 10)
error(FATAL, "#include too deeply nested");
setsource((char*)newstring((uchar*)iname, strlen(iname), 0), fd, NULL);
genline();
} else {
trp->tp = trp->bp+2;
error(ERROR, "Could not find include file %r", trp);
}
return;
syntax:
error(ERROR, "Syntax error in #include");
return;
}
/*
* Generate a line directive for cursource
*/
void
genline(void)
{
static Token ta = { UNCLASS };
static Tokenrow tr = { &ta, &ta, &ta+1, 1 };
uchar *p;
ta.t = p = (uchar*)outp;
strcpy((char*)p, "#line ");
p += sizeof("#line ")-1;
p = (uchar*)outnum((char*)p, cursource->line);
*p++ = ' '; *p++ = '"';
if (cursource->filename[0]!='/' && wd[0]) {
strcpy((char*)p, wd);
p += strlen(wd);
*p++ = '/';
}
strcpy((char*)p, cursource->filename);
p += strlen((char*)p);
*p++ = '"'; *p++ = '\n';
ta.len = (char*)p-outp;
outp = (char*)p;
tr.tp = tr.bp;
puttokens(&tr);
}
void
setobjname(char *f)
{
int n = strlen(f);
objname = (char*)domalloc(n+5);
strcpy(objname,f);
if(objname[n-2]=='.'){
strcpy(objname+n-1,"$O: ");
}else{
strcpy(objname+n,"$O: ");
}
}
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
Includelist includelist[NINCLUDE];
extern char *objname;
void
doinclude(Tokenrow *trp)
{
char fname[256], iname[256];
Includelist *ip;
int angled, len, fd, i;
trp->tp += 1;
if (trp->tp>=trp->lp)
goto syntax;
if (trp->tp->type!=STRING && trp->tp->type!=LT) {
len = trp->tp - trp->bp;
expandrow(trp, "<include>");
trp->tp = trp->bp+len;
}
if (trp->tp->type==STRING) {
len = trp->tp->len-2;
if (len > sizeof(fname) - 1)
len = sizeof(fname) - 1;
strncpy(fname, (char*)trp->tp->t+1, len);
angled = 0;
} else if (trp->tp->type==LT) {
len = 0;
trp->tp++;
while (trp->tp->type!=GT) {
if (trp->tp>trp->lp || len+trp->tp->len+2 >= sizeof(fname))
goto syntax;
strncpy(fname+len, (char*)trp->tp->t, trp->tp->len);
len += trp->tp->len;
trp->tp++;
}
angled = 1;
} else
goto syntax;
trp->tp += 2;
if (trp->tp < trp->lp || len==0)
goto syntax;
fname[len] = '\0';
if (fname[0]=='/') {
fd = open(fname, 0);
strcpy(iname, fname);
} else for (fd = -1,i=NINCLUDE-1; i>=0; i--) {
ip = &includelist[i];
if (ip->file==NULL || ip->deleted || (angled && ip->always==0))
continue;
if (strlen(fname)+strlen(ip->file)+2 > sizeof(iname))
continue;
strcpy(iname, ip->file);
strcat(iname, "/");
strcat(iname, fname);
if ((fd = open(iname, 0)) >= 0)
break;
}
if ( Mflag>1 || !angled&&Mflag==1 ) {
write(1,objname,strlen(objname));
write(1,iname,strlen(iname));
write(1,"\n",1);
}
if (fd >= 0) {
if (++incdepth > 10)
error(FATAL, "#include too deeply nested");
setsource((char*)newstring((uchar*)iname, strlen(iname), 0), fd, NULL);
genline();
} else {
trp->tp = trp->bp+2;
error(ERROR, "Could not find include file %r", trp);
}
return;
syntax:
error(ERROR, "Syntax error in #include");
return;
}
/*
* Generate a line directive for cursource
*/
void
genline(void)
{
static Token ta = { UNCLASS };
static Tokenrow tr = { &ta, &ta, &ta+1, 1 };
uchar *p;
ta.t = p = (uchar*)outp;
strcpy((char*)p, "#line ");
p += sizeof("#line ")-1;
p = (uchar*)outnum((char*)p, cursource->line);
*p++ = ' '; *p++ = '"';
if (cursource->filename[0]!='/' && wd[0]) {
strcpy((char*)p, wd);
p += strlen(wd);
*p++ = '/';
}
strcpy((char*)p, cursource->filename);
p += strlen((char*)p);
*p++ = '"'; *p++ = '\n';
ta.len = (char*)p-outp;
outp = (char*)p;
tr.tp = tr.bp;
puttokens(&tr);
}
void
setobjname(char *f)
{
int n = strlen(f);
objname = (char*)domalloc(n+5);
strcpy(objname,f);
if(objname[n-2]=='.'){
strcpy(objname+n-1,"$O: ");
}else{
strcpy(objname+n,"$O: ");
}
}

1162
lcc/cpp/lex.c Normal file → Executable file

File diff suppressed because it is too large Load diff

1030
lcc/cpp/macro.c Normal file → Executable file

File diff suppressed because it is too large Load diff

208
lcc/cpp/nlist.c Normal file → Executable file
View file

@ -1,104 +1,104 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
extern int getopt(int, char *const *, const char *);
extern char *optarg;
extern int optind;
extern int verbose;
extern int Cplusplus;
Nlist *kwdefined;
char wd[128];
#define NLSIZE 128
static Nlist *nlist[NLSIZE];
struct kwtab {
char *kw;
int val;
int flag;
} kwtab[] = {
"if", KIF, ISKW,
"ifdef", KIFDEF, ISKW,
"ifndef", KIFNDEF, ISKW,
"elif", KELIF, ISKW,
"else", KELSE, ISKW,
"endif", KENDIF, ISKW,
"include", KINCLUDE, ISKW,
"define", KDEFINE, ISKW,
"undef", KUNDEF, ISKW,
"line", KLINE, ISKW,
"error", KERROR, ISKW,
"pragma", KPRAGMA, ISKW,
"eval", KEVAL, ISKW,
"defined", KDEFINED, ISDEFINED+ISUNCHANGE,
"__LINE__", KLINENO, ISMAC+ISUNCHANGE,
"__FILE__", KFILE, ISMAC+ISUNCHANGE,
"__DATE__", KDATE, ISMAC+ISUNCHANGE,
"__TIME__", KTIME, ISMAC+ISUNCHANGE,
"__STDC__", KSTDC, ISUNCHANGE,
NULL
};
unsigned long namebit[077+1];
Nlist *np;
void
setup_kwtab(void)
{
struct kwtab *kp;
Nlist *np;
Token t;
static Token deftoken[1] = {{ NAME, 0, 0, 0, 7, (uchar*)"defined" }};
static Tokenrow deftr = { deftoken, deftoken, deftoken+1, 1 };
for (kp=kwtab; kp->kw; kp++) {
t.t = (uchar*)kp->kw;
t.len = strlen(kp->kw);
np = lookup(&t, 1);
np->flag = kp->flag;
np->val = kp->val;
if (np->val == KDEFINED) {
kwdefined = np;
np->val = NAME;
np->vp = &deftr;
np->ap = 0;
}
}
}
Nlist *
lookup(Token *tp, int install)
{
unsigned int h;
Nlist *np;
uchar *cp, *cpe;
h = 0;
for (cp=tp->t, cpe=cp+tp->len; cp<cpe; )
h += *cp++;
h %= NLSIZE;
np = nlist[h];
while (np) {
if (*tp->t==*np->name && tp->len==np->len
&& strncmp((char*)tp->t, (char*)np->name, tp->len)==0)
return np;
np = np->next;
}
if (install) {
np = new(Nlist);
np->vp = NULL;
np->ap = NULL;
np->flag = 0;
np->val = 0;
np->len = tp->len;
np->name = newstring(tp->t, tp->len, 0);
np->next = nlist[h];
nlist[h] = np;
quickset(tp->t[0], tp->len>1? tp->t[1]:0);
return np;
}
return NULL;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
extern int getopt(int, char *const *, const char *);
extern char *optarg;
extern int optind;
extern int verbose;
extern int Cplusplus;
Nlist *kwdefined;
char wd[128];
#define NLSIZE 128
static Nlist *nlist[NLSIZE];
struct kwtab {
char *kw;
int val;
int flag;
} kwtab[] = {
"if", KIF, ISKW,
"ifdef", KIFDEF, ISKW,
"ifndef", KIFNDEF, ISKW,
"elif", KELIF, ISKW,
"else", KELSE, ISKW,
"endif", KENDIF, ISKW,
"include", KINCLUDE, ISKW,
"define", KDEFINE, ISKW,
"undef", KUNDEF, ISKW,
"line", KLINE, ISKW,
"error", KERROR, ISKW,
"pragma", KPRAGMA, ISKW,
"eval", KEVAL, ISKW,
"defined", KDEFINED, ISDEFINED+ISUNCHANGE,
"__LINE__", KLINENO, ISMAC+ISUNCHANGE,
"__FILE__", KFILE, ISMAC+ISUNCHANGE,
"__DATE__", KDATE, ISMAC+ISUNCHANGE,
"__TIME__", KTIME, ISMAC+ISUNCHANGE,
"__STDC__", KSTDC, ISUNCHANGE,
NULL
};
unsigned long namebit[077+1];
Nlist *np;
void
setup_kwtab(void)
{
struct kwtab *kp;
Nlist *np;
Token t;
static Token deftoken[1] = {{ NAME, 0, 0, 0, 7, (uchar*)"defined" }};
static Tokenrow deftr = { deftoken, deftoken, deftoken+1, 1 };
for (kp=kwtab; kp->kw; kp++) {
t.t = (uchar*)kp->kw;
t.len = strlen(kp->kw);
np = lookup(&t, 1);
np->flag = kp->flag;
np->val = kp->val;
if (np->val == KDEFINED) {
kwdefined = np;
np->val = NAME;
np->vp = &deftr;
np->ap = 0;
}
}
}
Nlist *
lookup(Token *tp, int install)
{
unsigned int h;
Nlist *np;
uchar *cp, *cpe;
h = 0;
for (cp=tp->t, cpe=cp+tp->len; cp<cpe; )
h += *cp++;
h %= NLSIZE;
np = nlist[h];
while (np) {
if (*tp->t==*np->name && tp->len==np->len
&& strncmp((char*)tp->t, (char*)np->name, tp->len)==0)
return np;
np = np->next;
}
if (install) {
np = new(Nlist);
np->vp = NULL;
np->ap = NULL;
np->flag = 0;
np->val = 0;
np->len = tp->len;
np->name = newstring(tp->t, tp->len, 0);
np->next = nlist[h];
nlist[h] = np;
quickset(tp->t[0], tp->len>1? tp->t[1]:0);
return np;
}
return NULL;
}

740
lcc/cpp/tokens.c Normal file → Executable file
View file

@ -1,370 +1,370 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
static char wbuf[2*OBS];
static char *wbp = wbuf;
/*
* 1 for tokens that don't need whitespace when they get inserted
* by macro expansion
*/
static const char wstab[] = {
0, /* END */
0, /* UNCLASS */
0, /* NAME */
0, /* NUMBER */
0, /* STRING */
0, /* CCON */
1, /* NL */
0, /* WS */
0, /* DSHARP */
0, /* EQ */
0, /* NEQ */
0, /* LEQ */
0, /* GEQ */
0, /* LSH */
0, /* RSH */
0, /* LAND */
0, /* LOR */
0, /* PPLUS */
0, /* MMINUS */
0, /* ARROW */
1, /* SBRA */
1, /* SKET */
1, /* LP */
1, /* RP */
0, /* DOT */
0, /* AND */
0, /* STAR */
0, /* PLUS */
0, /* MINUS */
0, /* TILDE */
0, /* NOT */
0, /* SLASH */
0, /* PCT */
0, /* LT */
0, /* GT */
0, /* CIRC */
0, /* OR */
0, /* QUEST */
0, /* COLON */
0, /* ASGN */
1, /* COMMA */
0, /* SHARP */
1, /* SEMIC */
1, /* CBRA */
1, /* CKET */
0, /* ASPLUS */
0, /* ASMINUS */
0, /* ASSTAR */
0, /* ASSLASH */
0, /* ASPCT */
0, /* ASCIRC */
0, /* ASLSH */
0, /* ASRSH */
0, /* ASOR */
0, /* ASAND */
0, /* ELLIPS */
0, /* DSHARP1 */
0, /* NAME1 */
0, /* DEFINED */
0, /* UMINUS */
};
void
maketokenrow(int size, Tokenrow *trp)
{
trp->max = size;
if (size>0)
trp->bp = (Token *)domalloc(size*sizeof(Token));
else
trp->bp = NULL;
trp->tp = trp->bp;
trp->lp = trp->bp;
}
Token *
growtokenrow(Tokenrow *trp)
{
int ncur = trp->tp - trp->bp;
int nlast = trp->lp - trp->bp;
trp->max = 3*trp->max/2 + 1;
trp->bp = (Token *)realloc(trp->bp, trp->max*sizeof(Token));
if (trp->bp == NULL)
error(FATAL, "Out of memory from realloc");
trp->lp = &trp->bp[nlast];
trp->tp = &trp->bp[ncur];
return trp->lp;
}
/*
* Compare a row of tokens, ignoring the content of WS; return !=0 if different
*/
int
comparetokens(Tokenrow *tr1, Tokenrow *tr2)
{
Token *tp1, *tp2;
tp1 = tr1->tp;
tp2 = tr2->tp;
if (tr1->lp-tp1 != tr2->lp-tp2)
return 1;
for (; tp1<tr1->lp ; tp1++, tp2++) {
if (tp1->type != tp2->type
|| (tp1->wslen==0) != (tp2->wslen==0)
|| tp1->len != tp2->len
|| strncmp((char*)tp1->t, (char*)tp2->t, tp1->len)!=0)
return 1;
}
return 0;
}
/*
* replace ntok tokens starting at dtr->tp with the contents of str.
* tp ends up pointing just beyond the replacement.
* Canonical whitespace is assured on each side.
*/
void
insertrow(Tokenrow *dtr, int ntok, Tokenrow *str)
{
int nrtok = rowlen(str);
dtr->tp += ntok;
adjustrow(dtr, nrtok-ntok);
dtr->tp -= ntok;
movetokenrow(dtr, str);
makespace(dtr);
dtr->tp += nrtok;
makespace(dtr);
}
/*
* make sure there is WS before trp->tp, if tokens might merge in the output
*/
void
makespace(Tokenrow *trp)
{
uchar *tt;
Token *tp = trp->tp;
if (tp >= trp->lp)
return;
if (tp->wslen) {
if (tp->flag&XPWS
&& (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])) {
tp->wslen = 0;
return;
}
tp->t[-1] = ' ';
return;
}
if (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])
return;
tt = newstring(tp->t, tp->len, 1);
*tt++ = ' ';
tp->t = tt;
tp->wslen = 1;
tp->flag |= XPWS;
}
/*
* Copy an entire tokenrow into another, at tp.
* It is assumed that there is enough space.
* Not strictly conforming.
*/
void
movetokenrow(Tokenrow *dtr, Tokenrow *str)
{
int nby;
/* nby = sizeof(Token) * (str->lp - str->bp); */
nby = (char *)str->lp - (char *)str->bp;
memmove(dtr->tp, str->bp, nby);
}
/*
* Move the tokens in a row, starting at tr->tp, rightward by nt tokens;
* nt may be negative (left move).
* The row may need to be grown.
* Non-strictly conforming because of the (char *), but easily fixed
*/
void
adjustrow(Tokenrow *trp, int nt)
{
int nby, size;
if (nt==0)
return;
size = (trp->lp - trp->bp) + nt;
while (size > trp->max)
growtokenrow(trp);
/* nby = sizeof(Token) * (trp->lp - trp->tp); */
nby = (char *)trp->lp - (char *)trp->tp;
if (nby)
memmove(trp->tp+nt, trp->tp, nby);
trp->lp += nt;
}
/*
* Copy a row of tokens into the destination holder, allocating
* the space for the contents. Return the destination.
*/
Tokenrow *
copytokenrow(Tokenrow *dtr, Tokenrow *str)
{
int len = rowlen(str);
maketokenrow(len, dtr);
movetokenrow(dtr, str);
dtr->lp += len;
return dtr;
}
/*
* Produce a copy of a row of tokens. Start at trp->tp.
* The value strings are copied as well. The first token
* has WS available.
*/
Tokenrow *
normtokenrow(Tokenrow *trp)
{
Token *tp;
Tokenrow *ntrp = new(Tokenrow);
int len;
len = trp->lp - trp->tp;
if (len<=0)
len = 1;
maketokenrow(len, ntrp);
for (tp=trp->tp; tp < trp->lp; tp++) {
*ntrp->lp = *tp;
if (tp->len) {
ntrp->lp->t = newstring(tp->t, tp->len, 1);
*ntrp->lp->t++ = ' ';
if (tp->wslen)
ntrp->lp->wslen = 1;
}
ntrp->lp++;
}
if (ntrp->lp > ntrp->bp)
ntrp->bp->wslen = 0;
return ntrp;
}
/*
* Debugging
*/
void
peektokens(Tokenrow *trp, char *str)
{
Token *tp;
tp = trp->tp;
flushout();
if (str)
fprintf(stderr, "%s ", str);
if (tp<trp->bp || tp>trp->lp)
fprintf(stderr, "(tp offset %d) ", tp-trp->bp);
for (tp=trp->bp; tp<trp->lp && tp<trp->bp+32; tp++) {
if (tp->type!=NL) {
int c = tp->t[tp->len];
tp->t[tp->len] = 0;
fprintf(stderr, "%s", tp->t);
tp->t[tp->len] = c;
}
if (tp->type==NAME) {
fprintf(stderr, tp==trp->tp?"{*":"{");
prhideset(tp->hideset);
fprintf(stderr, "} ");
} else
fprintf(stderr, tp==trp->tp?"{%x*} ":"{%x} ", tp->type);
}
fprintf(stderr, "\n");
fflush(stderr);
}
void
puttokens(Tokenrow *trp)
{
Token *tp;
int len;
uchar *p;
if (verbose)
peektokens(trp, "");
tp = trp->bp;
for (; tp<trp->lp; tp++) {
len = tp->len+tp->wslen;
p = tp->t-tp->wslen;
while (tp<trp->lp-1 && p+len == (tp+1)->t - (tp+1)->wslen) {
tp++;
len += tp->wslen+tp->len;
}
if (len>OBS/2) { /* handle giant token */
if (wbp > wbuf)
write(1, wbuf, wbp-wbuf);
write(1, (char *)p, len);
wbp = wbuf;
} else {
memcpy(wbp, p, len);
wbp += len;
}
if (wbp >= &wbuf[OBS]) {
write(1, wbuf, OBS);
if (wbp > &wbuf[OBS])
memcpy(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
wbp -= OBS;
}
}
trp->tp = tp;
if (cursource->fd==0)
flushout();
}
void
flushout(void)
{
if (wbp>wbuf) {
write(1, wbuf, wbp-wbuf);
wbp = wbuf;
}
}
/*
* turn a row into just a newline
*/
void
setempty(Tokenrow *trp)
{
trp->tp = trp->bp;
trp->lp = trp->bp+1;
*trp->bp = nltoken;
}
/*
* generate a number
*/
char *
outnum(char *p, int n)
{
if (n>=10)
p = outnum(p, n/10);
*p++ = n%10 + '0';
return p;
}
/*
* allocate and initialize a new string from s, of length l, at offset o
* Null terminated.
*/
uchar *
newstring(uchar *s, int l, int o)
{
uchar *ns = (uchar *)domalloc(l+o+1);
ns[l+o] = '\0';
return (uchar*)strncpy((char*)ns+o, (char*)s, l) - o;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
static char wbuf[2*OBS];
static char *wbp = wbuf;
/*
* 1 for tokens that don't need whitespace when they get inserted
* by macro expansion
*/
static const char wstab[] = {
0, /* END */
0, /* UNCLASS */
0, /* NAME */
0, /* NUMBER */
0, /* STRING */
0, /* CCON */
1, /* NL */
0, /* WS */
0, /* DSHARP */
0, /* EQ */
0, /* NEQ */
0, /* LEQ */
0, /* GEQ */
0, /* LSH */
0, /* RSH */
0, /* LAND */
0, /* LOR */
0, /* PPLUS */
0, /* MMINUS */
0, /* ARROW */
1, /* SBRA */
1, /* SKET */
1, /* LP */
1, /* RP */
0, /* DOT */
0, /* AND */
0, /* STAR */
0, /* PLUS */
0, /* MINUS */
0, /* TILDE */
0, /* NOT */
0, /* SLASH */
0, /* PCT */
0, /* LT */
0, /* GT */
0, /* CIRC */
0, /* OR */
0, /* QUEST */
0, /* COLON */
0, /* ASGN */
1, /* COMMA */
0, /* SHARP */
1, /* SEMIC */
1, /* CBRA */
1, /* CKET */
0, /* ASPLUS */
0, /* ASMINUS */
0, /* ASSTAR */
0, /* ASSLASH */
0, /* ASPCT */
0, /* ASCIRC */
0, /* ASLSH */
0, /* ASRSH */
0, /* ASOR */
0, /* ASAND */
0, /* ELLIPS */
0, /* DSHARP1 */
0, /* NAME1 */
0, /* DEFINED */
0, /* UMINUS */
};
void
maketokenrow(int size, Tokenrow *trp)
{
trp->max = size;
if (size>0)
trp->bp = (Token *)domalloc(size*sizeof(Token));
else
trp->bp = NULL;
trp->tp = trp->bp;
trp->lp = trp->bp;
}
Token *
growtokenrow(Tokenrow *trp)
{
int ncur = trp->tp - trp->bp;
int nlast = trp->lp - trp->bp;
trp->max = 3*trp->max/2 + 1;
trp->bp = (Token *)realloc(trp->bp, trp->max*sizeof(Token));
if (trp->bp == NULL)
error(FATAL, "Out of memory from realloc");
trp->lp = &trp->bp[nlast];
trp->tp = &trp->bp[ncur];
return trp->lp;
}
/*
* Compare a row of tokens, ignoring the content of WS; return !=0 if different
*/
int
comparetokens(Tokenrow *tr1, Tokenrow *tr2)
{
Token *tp1, *tp2;
tp1 = tr1->tp;
tp2 = tr2->tp;
if (tr1->lp-tp1 != tr2->lp-tp2)
return 1;
for (; tp1<tr1->lp ; tp1++, tp2++) {
if (tp1->type != tp2->type
|| (tp1->wslen==0) != (tp2->wslen==0)
|| tp1->len != tp2->len
|| strncmp((char*)tp1->t, (char*)tp2->t, tp1->len)!=0)
return 1;
}
return 0;
}
/*
* replace ntok tokens starting at dtr->tp with the contents of str.
* tp ends up pointing just beyond the replacement.
* Canonical whitespace is assured on each side.
*/
void
insertrow(Tokenrow *dtr, int ntok, Tokenrow *str)
{
int nrtok = rowlen(str);
dtr->tp += ntok;
adjustrow(dtr, nrtok-ntok);
dtr->tp -= ntok;
movetokenrow(dtr, str);
makespace(dtr);
dtr->tp += nrtok;
makespace(dtr);
}
/*
* make sure there is WS before trp->tp, if tokens might merge in the output
*/
void
makespace(Tokenrow *trp)
{
uchar *tt;
Token *tp = trp->tp;
if (tp >= trp->lp)
return;
if (tp->wslen) {
if (tp->flag&XPWS
&& (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])) {
tp->wslen = 0;
return;
}
tp->t[-1] = ' ';
return;
}
if (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])
return;
tt = newstring(tp->t, tp->len, 1);
*tt++ = ' ';
tp->t = tt;
tp->wslen = 1;
tp->flag |= XPWS;
}
/*
* Copy an entire tokenrow into another, at tp.
* It is assumed that there is enough space.
* Not strictly conforming.
*/
void
movetokenrow(Tokenrow *dtr, Tokenrow *str)
{
int nby;
/* nby = sizeof(Token) * (str->lp - str->bp); */
nby = (char *)str->lp - (char *)str->bp;
memmove(dtr->tp, str->bp, nby);
}
/*
* Move the tokens in a row, starting at tr->tp, rightward by nt tokens;
* nt may be negative (left move).
* The row may need to be grown.
* Non-strictly conforming because of the (char *), but easily fixed
*/
void
adjustrow(Tokenrow *trp, int nt)
{
int nby, size;
if (nt==0)
return;
size = (trp->lp - trp->bp) + nt;
while (size > trp->max)
growtokenrow(trp);
/* nby = sizeof(Token) * (trp->lp - trp->tp); */
nby = (char *)trp->lp - (char *)trp->tp;
if (nby)
memmove(trp->tp+nt, trp->tp, nby);
trp->lp += nt;
}
/*
* Copy a row of tokens into the destination holder, allocating
* the space for the contents. Return the destination.
*/
Tokenrow *
copytokenrow(Tokenrow *dtr, Tokenrow *str)
{
int len = rowlen(str);
maketokenrow(len, dtr);
movetokenrow(dtr, str);
dtr->lp += len;
return dtr;
}
/*
* Produce a copy of a row of tokens. Start at trp->tp.
* The value strings are copied as well. The first token
* has WS available.
*/
Tokenrow *
normtokenrow(Tokenrow *trp)
{
Token *tp;
Tokenrow *ntrp = new(Tokenrow);
int len;
len = trp->lp - trp->tp;
if (len<=0)
len = 1;
maketokenrow(len, ntrp);
for (tp=trp->tp; tp < trp->lp; tp++) {
*ntrp->lp = *tp;
if (tp->len) {
ntrp->lp->t = newstring(tp->t, tp->len, 1);
*ntrp->lp->t++ = ' ';
if (tp->wslen)
ntrp->lp->wslen = 1;
}
ntrp->lp++;
}
if (ntrp->lp > ntrp->bp)
ntrp->bp->wslen = 0;
return ntrp;
}
/*
* Debugging
*/
void
peektokens(Tokenrow *trp, char *str)
{
Token *tp;
tp = trp->tp;
flushout();
if (str)
fprintf(stderr, "%s ", str);
if (tp<trp->bp || tp>trp->lp)
fprintf(stderr, "(tp offset %d) ", tp-trp->bp);
for (tp=trp->bp; tp<trp->lp && tp<trp->bp+32; tp++) {
if (tp->type!=NL) {
int c = tp->t[tp->len];
tp->t[tp->len] = 0;
fprintf(stderr, "%s", tp->t);
tp->t[tp->len] = c;
}
if (tp->type==NAME) {
fprintf(stderr, tp==trp->tp?"{*":"{");
prhideset(tp->hideset);
fprintf(stderr, "} ");
} else
fprintf(stderr, tp==trp->tp?"{%x*} ":"{%x} ", tp->type);
}
fprintf(stderr, "\n");
fflush(stderr);
}
void
puttokens(Tokenrow *trp)
{
Token *tp;
int len;
uchar *p;
if (verbose)
peektokens(trp, "");
tp = trp->bp;
for (; tp<trp->lp; tp++) {
len = tp->len+tp->wslen;
p = tp->t-tp->wslen;
while (tp<trp->lp-1 && p+len == (tp+1)->t - (tp+1)->wslen) {
tp++;
len += tp->wslen+tp->len;
}
if (len>OBS/2) { /* handle giant token */
if (wbp > wbuf)
write(1, wbuf, wbp-wbuf);
write(1, (char *)p, len);
wbp = wbuf;
} else {
memcpy(wbp, p, len);
wbp += len;
}
if (wbp >= &wbuf[OBS]) {
write(1, wbuf, OBS);
if (wbp > &wbuf[OBS])
memcpy(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
wbp -= OBS;
}
}
trp->tp = tp;
if (cursource->fd==0)
flushout();
}
void
flushout(void)
{
if (wbp>wbuf) {
write(1, wbuf, wbp-wbuf);
wbp = wbuf;
}
}
/*
* turn a row into just a newline
*/
void
setempty(Tokenrow *trp)
{
trp->tp = trp->bp;
trp->lp = trp->bp+1;
*trp->bp = nltoken;
}
/*
* generate a number
*/
char *
outnum(char *p, int n)
{
if (n>=10)
p = outnum(p, n/10);
*p++ = n%10 + '0';
return p;
}
/*
* allocate and initialize a new string from s, of length l, at offset o
* Null terminated.
*/
uchar *
newstring(uchar *s, int l, int o)
{
uchar *ns = (uchar *)domalloc(l+o+1);
ns[l+o] = '\0';
return (uchar*)strncpy((char*)ns+o, (char*)s, l) - o;
}

232
lcc/cpp/unix.c Normal file → Executable file
View file

@ -1,116 +1,116 @@
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
extern int getopt(int, char *const *, const char *);
extern char *optarg, rcsid[];
extern int optind;
int verbose;
int Mflag; /* only print active include files */
char *objname; /* "src.$O: " */
int Cplusplus = 1;
void
setup(int argc, char **argv)
{
int c, fd, i;
char *fp, *dp;
Tokenrow tr;
extern void setup_kwtab(void);
setup_kwtab();
while ((c = getopt(argc, argv, "MNOVv+I:D:U:F:lg")) != -1)
switch (c) {
case 'N':
for (i=0; i<NINCLUDE; i++)
if (includelist[i].always==1)
includelist[i].deleted = 1;
break;
case 'I':
for (i=NINCLUDE-2; i>=0; i--) {
if (includelist[i].file==NULL) {
includelist[i].always = 1;
includelist[i].file = optarg;
break;
}
}
if (i<0)
error(FATAL, "Too many -I directives");
break;
case 'D':
case 'U':
setsource("<cmdarg>", -1, optarg);
maketokenrow(3, &tr);
gettokens(&tr, 1);
doadefine(&tr, c);
unsetsource();
break;
case 'M':
Mflag++;
break;
case 'v':
fprintf(stderr, "%s %s\n", argv[0], rcsid);
break;
case 'V':
verbose++;
break;
case '+':
Cplusplus++;
break;
default:
break;
}
dp = ".";
fp = "<stdin>";
fd = 0;
if (optind<argc) {
if ((fp = strrchr(argv[optind], '/')) != NULL) {
int len = fp - argv[optind];
dp = (char*)newstring((uchar*)argv[optind], len+1, 0);
dp[len] = '\0';
}
fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
if ((fd = open(fp, 0)) <= 0)
error(FATAL, "Can't open input file %s", fp);
}
if (optind+1<argc) {
int fdo = creat(argv[optind+1], 0666);
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
dup2(fdo, 1);
}
if(Mflag)
setobjname(fp);
includelist[NINCLUDE-1].always = 0;
includelist[NINCLUDE-1].file = dp;
setsource(fp, fd, NULL);
}
/* memmove is defined here because some vendors don't provide it at
all and others do a terrible job (like calling malloc) */
void *
memmove(void *dp, const void *sp, size_t n)
{
unsigned char *cdp, *csp;
if (n<=0)
return 0;
cdp = dp;
csp = (unsigned char *)sp;
if (cdp < csp) {
do {
*cdp++ = *csp++;
} while (--n);
} else {
cdp += n;
csp += n;
do {
*--cdp = *--csp;
} while (--n);
}
return 0;
}
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "cpp.h"
extern int getopt(int, char *const *, const char *);
extern char *optarg, rcsid[];
extern int optind;
int verbose;
int Mflag; /* only print active include files */
char *objname; /* "src.$O: " */
int Cplusplus = 1;
void
setup(int argc, char **argv)
{
int c, fd, i;
char *fp, *dp;
Tokenrow tr;
extern void setup_kwtab(void);
setup_kwtab();
while ((c = getopt(argc, argv, "MNOVv+I:D:U:F:lg")) != -1)
switch (c) {
case 'N':
for (i=0; i<NINCLUDE; i++)
if (includelist[i].always==1)
includelist[i].deleted = 1;
break;
case 'I':
for (i=NINCLUDE-2; i>=0; i--) {
if (includelist[i].file==NULL) {
includelist[i].always = 1;
includelist[i].file = optarg;
break;
}
}
if (i<0)
error(FATAL, "Too many -I directives");
break;
case 'D':
case 'U':
setsource("<cmdarg>", -1, optarg);
maketokenrow(3, &tr);
gettokens(&tr, 1);
doadefine(&tr, c);
unsetsource();
break;
case 'M':
Mflag++;
break;
case 'v':
fprintf(stderr, "%s %s\n", argv[0], rcsid);
break;
case 'V':
verbose++;
break;
case '+':
Cplusplus++;
break;
default:
break;
}
dp = ".";
fp = "<stdin>";
fd = 0;
if (optind<argc) {
if ((fp = strrchr(argv[optind], '/')) != NULL) {
int len = fp - argv[optind];
dp = (char*)newstring((uchar*)argv[optind], len+1, 0);
dp[len] = '\0';
}
fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0);
if ((fd = open(fp, 0)) <= 0)
error(FATAL, "Can't open input file %s", fp);
}
if (optind+1<argc) {
int fdo = creat(argv[optind+1], 0666);
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
dup2(fdo, 1);
}
if(Mflag)
setobjname(fp);
includelist[NINCLUDE-1].always = 0;
includelist[NINCLUDE-1].file = dp;
setsource(fp, fd, NULL);
}
/* memmove is defined here because some vendors don't provide it at
all and others do a terrible job (like calling malloc) */
void *
memmove(void *dp, const void *sp, size_t n)
{
unsigned char *cdp, *csp;
if (n<=0)
return 0;
cdp = dp;
csp = (unsigned char *)sp;
if (cdp < csp) {
do {
*cdp++ = *csp++;
} while (--n);
} else {
cdp += n;
csp += n;
do {
*--cdp = *--csp;
} while (--n);
}
return 0;
}

2
lcc/custom.mk Normal file → Executable file
View file

@ -1 +1 @@
BUILDDIR=/tmp
BUILDDIR=/tmp

1508
lcc/doc/4.html Normal file → Executable file

File diff suppressed because it is too large Load diff

166
lcc/doc/bprint.1 Normal file → Executable file
View file

@ -1,83 +1,83 @@
.\" $Id: bprint.1 145 2001-10-17 21:53:10Z timo $
.TH BPRINT 1 "local \- $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $"
.SH NAME
bprint \- expression profiler
.SH SYNOPSIS
.B bprint
[
.I option ...
]
[
.I file ...
]
.SH DESCRIPTION
.I bprint
produces on the standard output a listing of the programs compiled by
.I lcc
with the
.B \-b
option.
Executing an
.B a.out
so compiled appends profiling data to
.BR prof.out .
The first token of each expression in the listing is preceded
by the number of times it was executed
enclosed in angle brackets as determined from the data in
.BR prof.out .
.I bprint
interprets the following options.
.TP
.B \-c
Compress the
.B prof.out
file, which otherwise grows with every execution of
.BR a.out .
.TP
.B \-b
Print an annotated listing as described above.
.TP
.B \-n
Include line numbers in the listing.
.TP
.B \-f
Print only the number of invocations of each function.
A second
.B \-f
summarizes call sites instead of callers.
.TP
.BI \-I \*Sdir
specifies additional directories in which to seek
files given in
.B prof.out
that do not begin with `/'.
.PP
If any file names are given, only the requested data for those files are printed
in the order presented.
If no options are given,
.B \-b
is assumed.
.SH FILES
.PP
.ta \w'$LCCDIR/liblcc.{a,lib}XX'u
.nf
prof.out profiling data
$LCCDIR/liblcc.{a,lib} \fIlcc\fP-specific library
.SH "SEE ALSO"
.IR lcc (1),
.IR prof (1)
.SH BUGS
Macros and comments can confuse
.I bprint
because it uses post-expansion source coordinates
to annotate pre-expansion source files.
If
.I bprint
sees that it's about to print a statement count
.I inside
a number or identifier, it moves the count to just
.I before
the token.
.PP
Can't cope with an ill-formed
.BR prof.out .
.\" $Id: bprint.1 145 2001-10-17 21:53:10Z timo $
.TH BPRINT 1 "local \- $Date: 2001-10-17 16:53:10 -0500 (Wed, 17 Oct 2001) $"
.SH NAME
bprint \- expression profiler
.SH SYNOPSIS
.B bprint
[
.I option ...
]
[
.I file ...
]
.SH DESCRIPTION
.I bprint
produces on the standard output a listing of the programs compiled by
.I lcc
with the
.B \-b
option.
Executing an
.B a.out
so compiled appends profiling data to
.BR prof.out .
The first token of each expression in the listing is preceded
by the number of times it was executed
enclosed in angle brackets as determined from the data in
.BR prof.out .
.I bprint
interprets the following options.
.TP
.B \-c
Compress the
.B prof.out
file, which otherwise grows with every execution of
.BR a.out .
.TP
.B \-b
Print an annotated listing as described above.
.TP
.B \-n
Include line numbers in the listing.
.TP
.B \-f
Print only the number of invocations of each function.
A second
.B \-f
summarizes call sites instead of callers.
.TP
.BI \-I \*Sdir
specifies additional directories in which to seek
files given in
.B prof.out
that do not begin with `/'.
.PP
If any file names are given, only the requested data for those files are printed
in the order presented.
If no options are given,
.B \-b
is assumed.
.SH FILES
.PP
.ta \w'$LCCDIR/liblcc.{a,lib}XX'u
.nf
prof.out profiling data
$LCCDIR/liblcc.{a,lib} \fIlcc\fP-specific library
.SH "SEE ALSO"
.IR lcc (1),
.IR prof (1)
.SH BUGS
Macros and comments can confuse
.I bprint
because it uses post-expansion source coordinates
to annotate pre-expansion source files.
If
.I bprint
sees that it's about to print a statement count
.I inside
a number or identifier, it moves the count to just
.I before
the token.
.PP
Can't cope with an ill-formed
.BR prof.out .

0
lcc/doc/bprint.pdf Normal file → Executable file
View file

1592
lcc/doc/install.html Normal file → Executable file

File diff suppressed because it is too large Load diff

1210
lcc/doc/lcc.1 Normal file → Executable file

File diff suppressed because it is too large Load diff

0
lcc/doc/lcc.pdf Normal file → Executable file
View file

950
lcc/etc/bprint.c Normal file → Executable file
View file

@ -1,475 +1,475 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* bprint [ -c | -Idir... | -f | -b | -n ] [ file... ]
* annotate listings of files with prof.out data
*/
#define NDIRS (sizeof dirs/sizeof dirs[0] - 1)
#define NEW(p,a) ((p) = alloc(sizeof *(p)))
#define newarray(m,n,a) alloc((m)*(n))
#define NELEMS(a) ((int)(sizeof (a)/sizeof ((a)[0])))
#define MAXTOKEN 64
struct count { /* count data: */
int x, y; /* source coordinate */
int count; /* associated execution count */
};
char *progname;
int number;
char *dirs[20];
int fcount;
struct file { /* per-file prof.out data: */
struct file *link; /* link to next file */
char *name; /* file name */
int size; /* size of counts[] */
int count; /* counts[0..count-1] hold valid data */
struct count *counts; /* count data */
struct func { /* function data: */
struct func *link; /* link to next function */
char *name; /* function name */
struct count count; /* total number of calls */
struct caller { /* caller data: */
struct caller *link; /* link to next caller */
char *name; /* caller's name */
char *file; /* call site: file, x, y */
int x, y;
int count; /* number of calls from this site */
} *callers;
} *funcs; /* list of functions */
} *filelist;
FILE *fp;
extern int process(char *);
extern int findfunc(char *, char *);
extern int findcount(char *, int, int);
void *alloc(unsigned);
char *string(char *);
int process(char *);
void emitdata(char *);
void printfile(struct file *, int);
void printfuncs(struct file *, int);
/* alloc - allocate n bytes or die */
void *alloc(unsigned n) {
void *new = malloc(n);
assert(new);
return new;
}
/* emitdata - write prof.out data to file */
void emitdata(char *file) {
FILE *fp;
if (fp = fopen(file, "w")) {
struct file *p;
for (p = filelist; p; p = p->link) {
int i;
struct func *q;
struct caller *r;
fprintf(fp, "1\n%s\n", p->name);
for (i = 0, q = p->funcs; q; i++, q = q->link)
if (r = q->callers)
for (i--; r; r = r->link)
i++;
fprintf(fp, "%d\n", i);
for (q = p->funcs; q; q = q->link)
if (q->count.count == 0 || !q->callers)
fprintf(fp, "%s 1 %d %d %d ? ? 0 0\n", q->name, q->count.x,
q->count.y, q->count.count);
else
for (r = q->callers; r; r = r->link)
fprintf(fp, "%s 1 %d %d %d %s %s %d %d\n", q->name, q->count.x,
q->count.y, r->count, r->name, r->file, r->x, r->y);
fprintf(fp, "%d\n", p->count);
for (i = 0; i < p->count; i++)
fprintf(fp, "1 %d %d %d\n", p->counts[i].x,
p->counts[i].y, p->counts[i].count);
}
fclose(fp);
} else
fprintf(stderr, "%s: can't create `%s'\n", progname, file);
}
/* openfile - open name for reading, searching -I directories */
FILE *openfile(char *name) {
int i;
FILE *fp;
if (*name != '/')
for (i = 0; dirs[i]; i++) {
char buf[200];
sprintf(buf, "%s/%s", dirs[i], name);
if (fp = fopen(buf, "r"))
return fp;
}
return fopen(name, "r");
}
/* printfile - print annotated listing for p */
void printfile(struct file *p, int nf) {
int lineno;
FILE *fp;
char *s, buf[512];
struct count *u = p->counts, *r, *uend;
if (u == 0 || p->count <= 0)
return;
uend = &p->counts[p->count];
if ((fp = openfile(p->name)) == NULL) {
fprintf(stderr, "%s: can't open `%s'\n", progname, p->name);
return;
}
if (nf)
printf("%s%s:\n\n", nf == 1 ? "" : "\f", p->name);
for (lineno = 1; fgets(buf, sizeof buf, fp); lineno++) {
if (number)
printf("%d\t", lineno);
while (u < uend && u->y < lineno)
u++;
for (s = buf; *s; ) {
char *t = s + 1;
while (u < uend && u->y == lineno && u->x < s - buf)
u++;
if (isalnum(*s) || *s == '_')
while (isalnum(*t) || *t == '_')
t++;
while (u < uend && u->y == lineno && u->x < t - buf) {
printf("<%d>", u->count);
for (r = u++; u < uend && u->x == r->x && u->y == r->y && u->count == r->count; u++)
;
}
while (s < t)
putchar(*s++);
}
if (*s)
printf("%s", s);
}
fclose(fp);
}
/* printfuncs - summarize data for functions in p */
void printfuncs(struct file *p, int nf) {
struct func *q;
if (nf)
printf("%s:\n", p->name);
for (q = p->funcs; q; q = q->link)
if (fcount <= 1 || q->count.count == 0 || !q->callers)
printf("%d\t%s\n", q->count.count, q->name);
else {
struct caller *r;
for (r = q->callers; r; r = r->link)
printf("%d\t%s\tfrom %s\tin %s:%d.%d\n", r->count, q->name, r->name,
r->file, r->y, r->x + 1);
}
}
/* string - save a copy of str, if necessary */
char *string(char *str) {
static struct string { struct string *link; char str[1]; } *list;
struct string *p;
for (p = list; p; p = p->link)
if (strcmp(p->str, str) == 0)
return p->str;
p = (struct string *)alloc(strlen(str) + sizeof *p);
strcpy(p->str, str);
p->link = list;
list = p;
return p->str;
}
/* acaller - add caller and site (file,x,y) to callee's callers list */
static void acaller(char *caller, char *file, int x, int y, int count, struct func *callee) {
struct caller *q;
assert(callee);
for (q = callee->callers; q && (caller != q->name
|| file != q->file || x != q->x || y != q->y); q = q->link)
;
if (!q) {
struct caller **r;
NEW(q, PERM);
q->name = caller;
q->file = file;
q->x = x;
q->y = y;
q->count = 0;
for (r = &callee->callers; *r && (strcmp(q->name, (*r)->name) > 0
|| strcmp(q->file, (*r)->file) > 0 || q->y > (*r)->y || q->y > (*r)->y); r = &(*r)->link)
;
q->link = *r;
*r = q;
}
q->count += count;
}
/* compare - return <0, 0, >0 if a<b, a==b, a>b, resp. */
static int compare(struct count *a, struct count *b) {
if (a->y == b->y)
return a->x - b->x;
return a->y - b->y;
}
/* findfile - return file name's file list entry, or 0 */
static struct file *findfile(char *name) {
struct file *p;
for (p = filelist; p; p = p->link)
if (p->name == name)
return p;
return 0;
}
/* afunction - add function name and its data to file's function list */
static struct func *afunction(char *name, char *file, int x, int y, int count) {
struct file *p = findfile(file);
struct func *q;
assert(p);
for (q = p->funcs; q && name != q->name; q = q->link)
;
if (!q) {
struct func **r;
NEW(q, PERM);
q->name = name;
q->count.x = x;
q->count.y = y;
q->count.count = 0;
q->callers = 0;
for (r = &p->funcs; *r && compare(&q->count, &(*r)->count) > 0; r = &(*r)->link)
;
q->link = *r;
*r = q;
}
q->count.count += count;
return q;
}
/* apoint - append execution point i to file's data */
static void apoint(int i, char *file, int x, int y, int count) {
struct file *p = findfile(file);
assert(p);
if (i >= p->size) {
int j;
if (p->size == 0) {
p->size = i >= 200 ? 2*i : 200;
p->counts = newarray(p->size, sizeof *p->counts, PERM);
} else {
struct count *new;
p->size = 2*i;
new = newarray(p->size, sizeof *new, PERM);
for (j = 0; j < p->count; j++)
new[j] = p->counts[j];
p->counts = new;
}
for (j = p->count; j < p->size; j++) {
static struct count z;
p->counts[j] = z;
}
}
p->counts[i].x = x;
p->counts[i].y = y;
p->counts[i].count += count;
if (i >= p->count)
p->count = i + 1;
}
/* findcount - return count associated with (file,x,y) or -1 */
int findcount(char *file, int x, int y) {
static struct file *cursor;
if (cursor == 0 || cursor->name != file)
cursor = findfile(file);
if (cursor) {
int l, u;
struct count *c = cursor->counts;
for (l = 0, u = cursor->count - 1; l <= u; ) {
int k = (l + u)/2;
if (c[k].y > y || c[k].y == y && c[k].x > x)
u = k - 1;
else if (c[k].y < y || c[k].y == y && c[k].x < x)
l = k + 1;
else
return c[k].count;
}
}
return -1;
}
/* findfunc - return count associated with function name in file or -1 */
int findfunc(char *name, char *file) {
static struct file *cursor;
if (cursor == 0 || cursor->name != file)
cursor = findfile(file);
if (cursor) {
struct func *p;
for (p = cursor->funcs; p; p = p->link)
if (p->name == name)
return p->count.count;
}
return -1;
}
/* getd - read a nonnegative number */
static int getd(void) {
int c, n = 0;
while ((c = getc(fp)) != EOF && (c == ' ' || c == '\n' || c == '\t'))
;
if (c >= '0' && c <= '9') {
do
n = 10*n + (c - '0');
while ((c = getc(fp)) >= '0' && c <= '9');
return n;
}
return -1;
}
/* getstr - read a string */
static char *getstr(void) {
int c;
char buf[MAXTOKEN], *s = buf;
while ((c = getc(fp)) != EOF && c != ' ' && c != '\n' && c != '\t')
if (s - buf < (int)sizeof buf - 2)
*s++ = c;
*s = 0;
return s == buf ? (char *)0 : string(buf);
}
/* gather - read prof.out data from fd */
static int gather(void) {
int i, nfiles, nfuncs, npoints;
char *files[64];
if ((nfiles = getd()) < 0)
return 0;
assert(nfiles < NELEMS(files));
for (i = 0; i < nfiles; i++) {
if ((files[i] = getstr()) == 0)
return -1;
if (!findfile(files[i])) {
struct file *new;
NEW(new, PERM);
new->name = files[i];
new->size = new->count = 0;
new->counts = 0;
new->funcs = 0;
new->link = filelist;
filelist = new;
}
}
if ((nfuncs = getd()) < 0)
return -1;
for (i = 0; i < nfuncs; i++) {
struct func *q;
char *name, *file;
int f, x, y, count;
if ((name = getstr()) == 0 || (f = getd()) <= 0
|| (x = getd()) < 0 || (y = getd()) < 0 || (count = getd()) < 0)
return -1;
q = afunction(name, files[f-1], x, y, count);
if ((name = getstr()) == 0 || (file = getstr()) == 0
|| (x = getd()) < 0 || (y = getd()) < 0)
return -1;
if (*name != '?')
acaller(name, file, x, y, count, q);
}
if ((npoints = getd()) < 0)
return -1;
for (i = 0; i < npoints; i++) {
int f, x, y, count;
if ((f = getd()) < 0 || (x = getd()) < 0 || (y = getd()) < 0
|| (count = getd()) < 0)
return -1;
if (f)
apoint(i, files[f-1], x, y, count);
}
return 1;
}
/* process - read prof.out data from file */
int process(char *file) {
int more;
if ((fp = fopen(file, "r")) != NULL) {
struct file *p;
while ((more = gather()) > 0)
;
fclose(fp);
if (more < 0)
return more;
for (p = filelist; p; p = p->link)
qsort(p->counts, p->count, sizeof *p->counts,
(int (*)(const void *, const void *))
compare);
return 1;
}
return 0;
}
int main(int argc, char *argv[]) {
int i;
struct file *p;
void (*f)(struct file *, int) = printfile;
progname = argv[0];
if ((i = process("prof.out")) <= 0) {
fprintf(stderr, "%s: can't %s `%s'\n", progname,
i == 0 ? "open" : "interpret", "prof.out");
exit(1);
}
for (i = 1; i < argc && *argv[i] == '-'; i++)
if (strcmp(argv[i], "-c") == 0) {
emitdata("prof.out");
exit(0);
} else if (strcmp(argv[i], "-b") == 0)
f = printfile;
else if (strcmp(argv[i], "-f") == 0) {
fcount++;
f = printfuncs;
} else if (strcmp(argv[i], "-n") == 0)
number++;
else if (strncmp(argv[i], "-I", 2) == 0) {
int j;
for (j = 0; j < NDIRS && dirs[j]; j++)
;
if (j < NDIRS)
dirs[j] = &argv[i][2];
else
fprintf(stderr, "%s: too many -I options\n", progname);
} else {
fprintf(stderr, "usage: %s [ -c | -b | -n | -f | -Idir... ] [ file... ]\n", progname);
exit(1);
}
for (p = filelist; p; p = p->link)
qsort(p->counts, p->count, sizeof *p->counts,
(int (*)(const void *, const void *))compare);
if (i < argc) {
int nf = i < argc - 1 ? 1 : 0;
for ( ; i < argc; i++, nf ? nf++ : 0)
if (p = findfile(string(argv[i])))
(*f)(p, nf);
else
fprintf(stderr, "%s: no data for `%s'\n", progname, argv[i]);
} else {
int nf = filelist && filelist->link ? 1 : 0;
for (p = filelist; p; p = p->link, nf ? nf++ : 0)
(*f)(p, nf);
}
return 0;
}
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* bprint [ -c | -Idir... | -f | -b | -n ] [ file... ]
* annotate listings of files with prof.out data
*/
#define NDIRS (sizeof dirs/sizeof dirs[0] - 1)
#define NEW(p,a) ((p) = alloc(sizeof *(p)))
#define newarray(m,n,a) alloc((m)*(n))
#define NELEMS(a) ((int)(sizeof (a)/sizeof ((a)[0])))
#define MAXTOKEN 64
struct count { /* count data: */
int x, y; /* source coordinate */
int count; /* associated execution count */
};
char *progname;
int number;
char *dirs[20];
int fcount;
struct file { /* per-file prof.out data: */
struct file *link; /* link to next file */
char *name; /* file name */
int size; /* size of counts[] */
int count; /* counts[0..count-1] hold valid data */
struct count *counts; /* count data */
struct func { /* function data: */
struct func *link; /* link to next function */
char *name; /* function name */
struct count count; /* total number of calls */
struct caller { /* caller data: */
struct caller *link; /* link to next caller */
char *name; /* caller's name */
char *file; /* call site: file, x, y */
int x, y;
int count; /* number of calls from this site */
} *callers;
} *funcs; /* list of functions */
} *filelist;
FILE *fp;
extern int process(char *);
extern int findfunc(char *, char *);
extern int findcount(char *, int, int);
void *alloc(unsigned);
char *string(char *);
int process(char *);
void emitdata(char *);
void printfile(struct file *, int);
void printfuncs(struct file *, int);
/* alloc - allocate n bytes or die */
void *alloc(unsigned n) {
void *new = malloc(n);
assert(new);
return new;
}
/* emitdata - write prof.out data to file */
void emitdata(char *file) {
FILE *fp;
if (fp = fopen(file, "w")) {
struct file *p;
for (p = filelist; p; p = p->link) {
int i;
struct func *q;
struct caller *r;
fprintf(fp, "1\n%s\n", p->name);
for (i = 0, q = p->funcs; q; i++, q = q->link)
if (r = q->callers)
for (i--; r; r = r->link)
i++;
fprintf(fp, "%d\n", i);
for (q = p->funcs; q; q = q->link)
if (q->count.count == 0 || !q->callers)
fprintf(fp, "%s 1 %d %d %d ? ? 0 0\n", q->name, q->count.x,
q->count.y, q->count.count);
else
for (r = q->callers; r; r = r->link)
fprintf(fp, "%s 1 %d %d %d %s %s %d %d\n", q->name, q->count.x,
q->count.y, r->count, r->name, r->file, r->x, r->y);
fprintf(fp, "%d\n", p->count);
for (i = 0; i < p->count; i++)
fprintf(fp, "1 %d %d %d\n", p->counts[i].x,
p->counts[i].y, p->counts[i].count);
}
fclose(fp);
} else
fprintf(stderr, "%s: can't create `%s'\n", progname, file);
}
/* openfile - open name for reading, searching -I directories */
FILE *openfile(char *name) {
int i;
FILE *fp;
if (*name != '/')
for (i = 0; dirs[i]; i++) {
char buf[200];
sprintf(buf, "%s/%s", dirs[i], name);
if (fp = fopen(buf, "r"))
return fp;
}
return fopen(name, "r");
}
/* printfile - print annotated listing for p */
void printfile(struct file *p, int nf) {
int lineno;
FILE *fp;
char *s, buf[512];
struct count *u = p->counts, *r, *uend;
if (u == 0 || p->count <= 0)
return;
uend = &p->counts[p->count];
if ((fp = openfile(p->name)) == NULL) {
fprintf(stderr, "%s: can't open `%s'\n", progname, p->name);
return;
}
if (nf)
printf("%s%s:\n\n", nf == 1 ? "" : "\f", p->name);
for (lineno = 1; fgets(buf, sizeof buf, fp); lineno++) {
if (number)
printf("%d\t", lineno);
while (u < uend && u->y < lineno)
u++;
for (s = buf; *s; ) {
char *t = s + 1;
while (u < uend && u->y == lineno && u->x < s - buf)
u++;
if (isalnum(*s) || *s == '_')
while (isalnum(*t) || *t == '_')
t++;
while (u < uend && u->y == lineno && u->x < t - buf) {
printf("<%d>", u->count);
for (r = u++; u < uend && u->x == r->x && u->y == r->y && u->count == r->count; u++)
;
}
while (s < t)
putchar(*s++);
}
if (*s)
printf("%s", s);
}
fclose(fp);
}
/* printfuncs - summarize data for functions in p */
void printfuncs(struct file *p, int nf) {
struct func *q;
if (nf)
printf("%s:\n", p->name);
for (q = p->funcs; q; q = q->link)
if (fcount <= 1 || q->count.count == 0 || !q->callers)
printf("%d\t%s\n", q->count.count, q->name);
else {
struct caller *r;
for (r = q->callers; r; r = r->link)
printf("%d\t%s\tfrom %s\tin %s:%d.%d\n", r->count, q->name, r->name,
r->file, r->y, r->x + 1);
}
}
/* string - save a copy of str, if necessary */
char *string(char *str) {
static struct string { struct string *link; char str[1]; } *list;
struct string *p;
for (p = list; p; p = p->link)
if (strcmp(p->str, str) == 0)
return p->str;
p = (struct string *)alloc(strlen(str) + sizeof *p);
strcpy(p->str, str);
p->link = list;
list = p;
return p->str;
}
/* acaller - add caller and site (file,x,y) to callee's callers list */
static void acaller(char *caller, char *file, int x, int y, int count, struct func *callee) {
struct caller *q;
assert(callee);
for (q = callee->callers; q && (caller != q->name
|| file != q->file || x != q->x || y != q->y); q = q->link)
;
if (!q) {
struct caller **r;
NEW(q, PERM);
q->name = caller;
q->file = file;
q->x = x;
q->y = y;
q->count = 0;
for (r = &callee->callers; *r && (strcmp(q->name, (*r)->name) > 0
|| strcmp(q->file, (*r)->file) > 0 || q->y > (*r)->y || q->y > (*r)->y); r = &(*r)->link)
;
q->link = *r;
*r = q;
}
q->count += count;
}
/* compare - return <0, 0, >0 if a<b, a==b, a>b, resp. */
static int compare(struct count *a, struct count *b) {
if (a->y == b->y)
return a->x - b->x;
return a->y - b->y;
}
/* findfile - return file name's file list entry, or 0 */
static struct file *findfile(char *name) {
struct file *p;
for (p = filelist; p; p = p->link)
if (p->name == name)
return p;
return 0;
}
/* afunction - add function name and its data to file's function list */
static struct func *afunction(char *name, char *file, int x, int y, int count) {
struct file *p = findfile(file);
struct func *q;
assert(p);
for (q = p->funcs; q && name != q->name; q = q->link)
;
if (!q) {
struct func **r;
NEW(q, PERM);
q->name = name;
q->count.x = x;
q->count.y = y;
q->count.count = 0;
q->callers = 0;
for (r = &p->funcs; *r && compare(&q->count, &(*r)->count) > 0; r = &(*r)->link)
;
q->link = *r;
*r = q;
}
q->count.count += count;
return q;
}
/* apoint - append execution point i to file's data */
static void apoint(int i, char *file, int x, int y, int count) {
struct file *p = findfile(file);
assert(p);
if (i >= p->size) {
int j;
if (p->size == 0) {
p->size = i >= 200 ? 2*i : 200;
p->counts = newarray(p->size, sizeof *p->counts, PERM);
} else {
struct count *new;
p->size = 2*i;
new = newarray(p->size, sizeof *new, PERM);
for (j = 0; j < p->count; j++)
new[j] = p->counts[j];
p->counts = new;
}
for (j = p->count; j < p->size; j++) {
static struct count z;
p->counts[j] = z;
}
}
p->counts[i].x = x;
p->counts[i].y = y;
p->counts[i].count += count;
if (i >= p->count)
p->count = i + 1;
}
/* findcount - return count associated with (file,x,y) or -1 */
int findcount(char *file, int x, int y) {
static struct file *cursor;
if (cursor == 0 || cursor->name != file)
cursor = findfile(file);
if (cursor) {
int l, u;
struct count *c = cursor->counts;
for (l = 0, u = cursor->count - 1; l <= u; ) {
int k = (l + u)/2;
if (c[k].y > y || c[k].y == y && c[k].x > x)
u = k - 1;
else if (c[k].y < y || c[k].y == y && c[k].x < x)
l = k + 1;
else
return c[k].count;
}
}
return -1;
}
/* findfunc - return count associated with function name in file or -1 */
int findfunc(char *name, char *file) {
static struct file *cursor;
if (cursor == 0 || cursor->name != file)
cursor = findfile(file);
if (cursor) {
struct func *p;
for (p = cursor->funcs; p; p = p->link)
if (p->name == name)
return p->count.count;
}
return -1;
}
/* getd - read a nonnegative number */
static int getd(void) {
int c, n = 0;
while ((c = getc(fp)) != EOF && (c == ' ' || c == '\n' || c == '\t'))
;
if (c >= '0' && c <= '9') {
do
n = 10*n + (c - '0');
while ((c = getc(fp)) >= '0' && c <= '9');
return n;
}
return -1;
}
/* getstr - read a string */
static char *getstr(void) {
int c;
char buf[MAXTOKEN], *s = buf;
while ((c = getc(fp)) != EOF && c != ' ' && c != '\n' && c != '\t')
if (s - buf < (int)sizeof buf - 2)
*s++ = c;
*s = 0;
return s == buf ? (char *)0 : string(buf);
}
/* gather - read prof.out data from fd */
static int gather(void) {
int i, nfiles, nfuncs, npoints;
char *files[64];
if ((nfiles = getd()) < 0)
return 0;
assert(nfiles < NELEMS(files));
for (i = 0; i < nfiles; i++) {
if ((files[i] = getstr()) == 0)
return -1;
if (!findfile(files[i])) {
struct file *new;
NEW(new, PERM);
new->name = files[i];
new->size = new->count = 0;
new->counts = 0;
new->funcs = 0;
new->link = filelist;
filelist = new;
}
}
if ((nfuncs = getd()) < 0)
return -1;
for (i = 0; i < nfuncs; i++) {
struct func *q;
char *name, *file;
int f, x, y, count;
if ((name = getstr()) == 0 || (f = getd()) <= 0
|| (x = getd()) < 0 || (y = getd()) < 0 || (count = getd()) < 0)
return -1;
q = afunction(name, files[f-1], x, y, count);
if ((name = getstr()) == 0 || (file = getstr()) == 0
|| (x = getd()) < 0 || (y = getd()) < 0)
return -1;
if (*name != '?')
acaller(name, file, x, y, count, q);
}
if ((npoints = getd()) < 0)
return -1;
for (i = 0; i < npoints; i++) {
int f, x, y, count;
if ((f = getd()) < 0 || (x = getd()) < 0 || (y = getd()) < 0
|| (count = getd()) < 0)
return -1;
if (f)
apoint(i, files[f-1], x, y, count);
}
return 1;
}
/* process - read prof.out data from file */
int process(char *file) {
int more;
if ((fp = fopen(file, "r")) != NULL) {
struct file *p;
while ((more = gather()) > 0)
;
fclose(fp);
if (more < 0)
return more;
for (p = filelist; p; p = p->link)
qsort(p->counts, p->count, sizeof *p->counts,
(int (*)(const void *, const void *))
compare);
return 1;
}
return 0;
}
int main(int argc, char *argv[]) {
int i;
struct file *p;
void (*f)(struct file *, int) = printfile;
progname = argv[0];
if ((i = process("prof.out")) <= 0) {
fprintf(stderr, "%s: can't %s `%s'\n", progname,
i == 0 ? "open" : "interpret", "prof.out");
exit(1);
}
for (i = 1; i < argc && *argv[i] == '-'; i++)
if (strcmp(argv[i], "-c") == 0) {
emitdata("prof.out");
exit(0);
} else if (strcmp(argv[i], "-b") == 0)
f = printfile;
else if (strcmp(argv[i], "-f") == 0) {
fcount++;
f = printfuncs;
} else if (strcmp(argv[i], "-n") == 0)
number++;
else if (strncmp(argv[i], "-I", 2) == 0) {
int j;
for (j = 0; j < NDIRS && dirs[j]; j++)
;
if (j < NDIRS)
dirs[j] = &argv[i][2];
else
fprintf(stderr, "%s: too many -I options\n", progname);
} else {
fprintf(stderr, "usage: %s [ -c | -b | -n | -f | -Idir... ] [ file... ]\n", progname);
exit(1);
}
for (p = filelist; p; p = p->link)
qsort(p->counts, p->count, sizeof *p->counts,
(int (*)(const void *, const void *))compare);
if (i < argc) {
int nf = i < argc - 1 ? 1 : 0;
for ( ; i < argc; i++, nf ? nf++ : 0)
if (p = findfile(string(argv[i])))
(*f)(p, nf);
else
fprintf(stderr, "%s: no data for `%s'\n", progname, argv[i]);
} else {
int nf = filelist && filelist->link ? 1 : 0;
for (p = filelist; p; p = p->link, nf ? nf++ : 0)
(*f)(p, nf);
}
return 0;
}

100
lcc/etc/gcc-solaris.c Normal file → Executable file
View file

@ -1,50 +1,50 @@
/* SPARCs running Solaris 2.5.1 w/GCC tools
at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
#ifndef GCCDIR
#define GCCDIR "/usr/local/gnu/bin/"
#endif
#ifndef GCCLIB
#define GCCLIB "/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp",
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I" GCCLIB "include", "-I/usr/include", 0 };
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
"$1", "$2", "$3", 0 };
char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 };
char *ld[] = { GCCDIR "ld", "-o", "$3", "$1",
GCCLIB "crti.o", GCCLIB "crt1.o",
GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
"-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
ld[10] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-pg") == 0) {
ld[8] = GCCLIB "gmon.o";
} else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}
/* SPARCs running Solaris 2.5.1 w/GCC tools
at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
#ifndef GCCDIR
#define GCCDIR "/usr/local/gnu/bin/"
#endif
#ifndef GCCLIB
#define GCCLIB "/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp",
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I" GCCLIB "include", "-I/usr/include", 0 };
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
"$1", "$2", "$3", 0 };
char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 };
char *ld[] = { GCCDIR "ld", "-o", "$3", "$1",
GCCLIB "crti.o", GCCLIB "crt1.o",
GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc",
"-L" GCCLIB, "-lgcc", "-lm", "-lc", "",
GCCLIB "crtend.o", GCCLIB "crtn.o", 0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
ld[10] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-pg") == 0) {
ld[8] = GCCLIB "gmon.o";
} else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}

128
lcc/etc/irix.c Normal file → Executable file
View file

@ -1,64 +1,64 @@
/* SGI big endian MIPSes running IRIX 5.2 at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1",
"-DLANGUAGE_C",
"-DMIPSEB",
"-DSYSTYPE_SVR4",
"-D_CFE",
"-D_LANGUAGE_C",
"-D_MIPSEB",
"-D_MIPS_FPSET=16",
"-D_MIPS_ISA=_MIPS_ISA_MIPS1",
"-D_MIPS_SIM=_MIPS_SIM_ABI32",
"-D_MIPS_SZINT=32",
"-D_MIPS_SZLONG=32",
"-D_MIPS_SZPTR=32",
"-D_SGI_SOURCE",
"-D_SVR4_SOURCE",
"-D_SYSTYPE_SVR4",
"-D__host_mips",
"-D__mips=1",
"-D__sgi",
"-D__unix",
"-Dhost_mips",
"-Dmips",
"-Dsgi",
"-Dunix",
"$1", "$2", "$3", 0 };
char *com[] = { LCCDIR "rcc", "-target=mips/irix", "$1", "$2", "$3", "", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "-nocpp", "-KPIC", "$2", 0 };
char *ld[] = { "/usr/bin/ld", "-require_dynamic_link", "_rld_new_interface",
"-elf", "-_SYSTYPE_SVR4", "-Wx,-G", "0", "-g0", "-KPIC", "-dont_warn_unused",
"-o", "$3", "/usr/lib/crt1.o", "-L/usr/local/lib",
"$1", "$2", "", "-L" LCCDIR, "-llcc", "-lc", "-lm", "/usr/lib/crtn.o", 0
};
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/rcc");
ld[17] = concat("-L", &arg[8]);
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-p") == 0)
ld[12] = "/usr/lib/mcrt1.o";
else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}
/* SGI big endian MIPSes running IRIX 5.2 at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1",
"-DLANGUAGE_C",
"-DMIPSEB",
"-DSYSTYPE_SVR4",
"-D_CFE",
"-D_LANGUAGE_C",
"-D_MIPSEB",
"-D_MIPS_FPSET=16",
"-D_MIPS_ISA=_MIPS_ISA_MIPS1",
"-D_MIPS_SIM=_MIPS_SIM_ABI32",
"-D_MIPS_SZINT=32",
"-D_MIPS_SZLONG=32",
"-D_MIPS_SZPTR=32",
"-D_SGI_SOURCE",
"-D_SVR4_SOURCE",
"-D_SYSTYPE_SVR4",
"-D__host_mips",
"-D__mips=1",
"-D__sgi",
"-D__unix",
"-Dhost_mips",
"-Dmips",
"-Dsgi",
"-Dunix",
"$1", "$2", "$3", 0 };
char *com[] = { LCCDIR "rcc", "-target=mips/irix", "$1", "$2", "$3", "", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "-nocpp", "-KPIC", "$2", 0 };
char *ld[] = { "/usr/bin/ld", "-require_dynamic_link", "_rld_new_interface",
"-elf", "-_SYSTYPE_SVR4", "-Wx,-G", "0", "-g0", "-KPIC", "-dont_warn_unused",
"-o", "$3", "/usr/lib/crt1.o", "-L/usr/local/lib",
"$1", "$2", "", "-L" LCCDIR, "-llcc", "-lc", "-lm", "/usr/lib/crtn.o", 0
};
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/rcc");
ld[17] = concat("-L", &arg[8]);
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-p") == 0)
ld[12] = "/usr/lib/mcrt1.o";
else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}

1586
lcc/etc/lcc.c Normal file → Executable file

File diff suppressed because it is too large Load diff

148
lcc/etc/linux.c Normal file → Executable file
View file

@ -1,74 +1,74 @@
/* x86s running Linux */
#include <string.h>
static char rcsid[] = "Dummy rcsid";
/*
TTimo - 10-18-2001
our binaries are named q3lcc q3rcc and q3cpp
removed hardcoded paths
removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
*/
#ifndef LCCDIR
#define LCCDIR ""
//#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
char inputs[256] = "";
// TTimo experimental: do not compile with the __linux__ define, we are doing bytecode!
char *cpp[] = { LCCDIR "q3cpp",
"-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
"-Dunix", "-Di386", "-Dlinux",
"-D__unix__", "-D__i386__", "-D__signed__=signed",
"$1", "$2", "$3", 0 };
char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include",
"-I" SYSTEM "include", 0 };
char *com[] = {LCCDIR "q3rcc", "-target=x86/linux", "$1", "$2", "$3", 0 };
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 };
// NOTE TTimo I don't think we have any use with the native linkage
// our target is always bytecode..
char *ld[] = {
/* 0 */ "/usr/bin/ld", "-m", "elf_i386", "-dynamic-linker",
/* 4 */ "/lib/ld-linux.so.2", "-o", "$3",
/* 7 */ "/usr/lib/crt1.o", "/usr/lib/crti.o",
/* 9 */ SYSTEM "crtbegin.o",
"$1", "$2",
/* 12 */ "-L" LCCDIR,
/* 13 */ "-llcc",
/* 14 */ "-L" LCCDIR "/gcc", "-lgcc", "-lc", "-lm",
/* 18 */ "",
/* 19 */ SYSTEM "crtend.o", "/usr/lib/crtn.o",
/* 20 */ "-L" SYSTEM,
0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/gcc/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
ld[9] = concat(&arg[8], "/gcc/crtbegin.o");
ld[12] = concat("-L", &arg[8]);
ld[14] = concat("-L", concat(&arg[8], "/gcc"));
ld[19] = concat(&arg[8], "/gcc/crtend.o");
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
ld[7] = "/usr/lib/gcrt1.o";
ld[18] = "-lgmon";
} else if (strcmp(arg, "-b") == 0)
;
else if (strcmp(arg, "-g") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else if (strcmp(arg, "-static") == 0) {
ld[3] = "-static";
ld[4] = "";
} else
return 0;
return 1;
}
/* x86s running Linux */
#include <string.h>
static char rcsid[] = "Dummy rcsid";
/*
TTimo - 10-18-2001
our binaries are named q3lcc q3rcc and q3cpp
removed hardcoded paths
removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!)
*/
#ifndef LCCDIR
#define LCCDIR ""
//#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
char inputs[256] = "";
// TTimo experimental: do not compile with the __linux__ define, we are doing bytecode!
char *cpp[] = { LCCDIR "q3cpp",
"-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
"-Dunix", "-Di386", "-Dlinux",
"-D__unix__", "-D__i386__", "-D__signed__=signed",
"$1", "$2", "$3", 0 };
char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include",
"-I" SYSTEM "include", 0 };
char *com[] = {LCCDIR "q3rcc", "-target=x86/linux", "$1", "$2", "$3", 0 };
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 };
// NOTE TTimo I don't think we have any use with the native linkage
// our target is always bytecode..
char *ld[] = {
/* 0 */ "/usr/bin/ld", "-m", "elf_i386", "-dynamic-linker",
/* 4 */ "/lib/ld-linux.so.2", "-o", "$3",
/* 7 */ "/usr/lib/crt1.o", "/usr/lib/crti.o",
/* 9 */ SYSTEM "crtbegin.o",
"$1", "$2",
/* 12 */ "-L" LCCDIR,
/* 13 */ "-llcc",
/* 14 */ "-L" LCCDIR "/gcc", "-lgcc", "-lc", "-lm",
/* 18 */ "",
/* 19 */ SYSTEM "crtend.o", "/usr/lib/crtn.o",
/* 20 */ "-L" SYSTEM,
0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/gcc/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
include[1] = concat("-I", concat(&arg[8], "/gcc/include"));
ld[9] = concat(&arg[8], "/gcc/crtbegin.o");
ld[12] = concat("-L", &arg[8]);
ld[14] = concat("-L", concat(&arg[8], "/gcc"));
ld[19] = concat(&arg[8], "/gcc/crtend.o");
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
ld[7] = "/usr/lib/gcrt1.o";
ld[18] = "-lgmon";
} else if (strcmp(arg, "-b") == 0)
;
else if (strcmp(arg, "-g") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else if (strcmp(arg, "-static") == 0) {
ld[3] = "-static";
ld[4] = "";
} else
return 0;
return 1;
}

380
lcc/etc/ops.c Normal file → Executable file
View file

@ -1,190 +1,190 @@
#include "c.h"
/* ops [ {csilhfdxp}=n ]...
* prints lcc dag operator set for a given set of type sizes.
*/
static char list[] = { 'c', 's', 'i', 'l', 'h', 'f', 'd', 'x', 'p', 0 };
static int sizes[] = { 1, 2, 4, 4, 8, 4, 8, 16, 8 };
static int doop(int op, int type, const char *sz, const char *opname) {
int count = 0;
static int last;
if (op == LOAD)
return 0;
if (last != 0 && last != op)
printf("\n");
last = op;
if (type == B || type == V) {
printf(" %s=%d", opname, op + type);
count++;
} else {
int i, done = 0;
const char *s;
for (i = 0; sz[i] != '\0' && (s = strchr(list, sz[i])) != NULL; i++) {
int n = sizes[s-list];
if ((done&(1<<n)) == 0) {
printf(" %s%d=%d", opname, n, op + type + sizeop(n));
count++;
}
done |= 1<<n;
}
}
printf("\n");
return count;
}
int main(int argc, char *argv[]) {
int i, count = 0;
for (i = 1; i < argc; i++) {
char c, *s;
int n;
if (sscanf(argv[i], "%c=%d", &c, &n) == 2
&& n > 0 && (s = strchr(list, c)) != NULL)
sizes[s-list] = n;
else {
fprintf(stderr, "usage: %s [ {csilhfdxp}=n ]...\n", argv[0]);
exit(EXIT_FAILURE);
}
}
#define gop(x,n)
#define op(x,t,s) count += doop(x,t,#s,#x #t);
gop(CNST,1)
op(CNST,F,fdx)
op(CNST,I,csilh)
op(CNST,P,p)
op(CNST,U,csilh)
gop(ARG,2)
op(ARG,B,-)
op(ARG,F,fdx)
op(ARG,I,ilh)
op(ARG,P,p)
op(ARG,U,ilh)
gop(ASGN,3)
op(ASGN,B,-)
op(ASGN,F,fdx)
op(ASGN,I,csilh)
op(ASGN,P,p)
op(ASGN,U,csilh)
gop(INDIR,4)
op(INDIR,B,-)
op(INDIR,F,fdx)
op(INDIR,I,csilh)
op(INDIR,P,p)
op(INDIR,U,csilh)
gop(CVF,7)
op(CVF,F,fdx)
op(CVF,I,ilh)
gop(CVI,8)
op(CVI,F,fdx)
op(CVI,I,csilh)
op(CVI,U,csilhp)
gop(CVP,9)
op(CVP,U,p)
gop(CVU,11)
op(CVU,I,csilh)
op(CVU,P,p)
op(CVU,U,csilh)
gop(NEG,12)
op(NEG,F,fdx)
op(NEG,I,ilh)
gop(CALL,13)
op(CALL,B,-)
op(CALL,F,fdx)
op(CALL,I,ilh)
op(CALL,P,p)
op(CALL,U,ilh)
op(CALL,V,-)
gop(RET,15)
op(RET,F,fdx)
op(RET,I,ilh)
op(RET,P,p)
op(RET,U,ilh)
op(RET,V,-)
gop(ADDRG,16)
op(ADDRG,P,p)
gop(ADDRF,17)
op(ADDRF,P,p)
gop(ADDRL,18)
op(ADDRL,P,p)
gop(ADD,19)
op(ADD,F,fdx)
op(ADD,I,ilh)
op(ADD,P,p)
op(ADD,U,ilhp)
gop(SUB,20)
op(SUB,F,fdx)
op(SUB,I,ilh)
op(SUB,P,p)
op(SUB,U,ilhp)
gop(LSH,21)
op(LSH,I,ilh)
op(LSH,U,ilh)
gop(MOD,22)
op(MOD,I,ilh)
op(MOD,U,ilh)
gop(RSH,23)
op(RSH,I,ilh)
op(RSH,U,ilh)
gop(BAND,24)
op(BAND,I,ilh)
op(BAND,U,ilh)
gop(BCOM,25)
op(BCOM,I,ilh)
op(BCOM,U,ilh)
gop(BOR,26)
op(BOR,I,ilh)
op(BOR,U,ilh)
gop(BXOR,27)
op(BXOR,I,ilh)
op(BXOR,U,ilh)
gop(DIV,28)
op(DIV,F,fdx)
op(DIV,I,ilh)
op(DIV,U,ilh)
gop(MUL,29)
op(MUL,F,fdx)
op(MUL,I,ilh)
op(MUL,U,ilh)
gop(EQ,30)
op(EQ,F,fdx)
op(EQ,I,ilh)
op(EQ,U,ilhp)
gop(GE,31)
op(GE,F,fdx)
op(GE,I,ilh)
op(GE,U,ilhp)
gop(GT,32)
op(GT,F,fdx)
op(GT,I,ilh)
op(GT,U,ilhp)
gop(LE,33)
op(LE,F,fdx)
op(LE,I,ilh)
op(LE,U,ilhp)
gop(LT,34)
op(LT,F,fdx)
op(LT,I,ilh)
op(LT,U,ilhp)
gop(NE,35)
op(NE,F,fdx)
op(NE,I,ilh)
op(NE,U,ilhp)
gop(JUMP,36)
op(JUMP,V,-)
gop(LABEL,37)
op(LABEL,V,-)
gop(LOAD,14)
op(LOAD,B,-)
op(LOAD,F,fdx)
op(LOAD,I,csilh)
op(LOAD,P,p)
op(LOAD,U,csilhp)
#undef gop
#undef op
fprintf(stderr, "%d operators\n", count);
return EXIT_SUCCESS;
}
#include "c.h"
/* ops [ {csilhfdxp}=n ]...
* prints lcc dag operator set for a given set of type sizes.
*/
static char list[] = { 'c', 's', 'i', 'l', 'h', 'f', 'd', 'x', 'p', 0 };
static int sizes[] = { 1, 2, 4, 4, 8, 4, 8, 16, 8 };
static int doop(int op, int type, const char *sz, const char *opname) {
int count = 0;
static int last;
if (op == LOAD)
return 0;
if (last != 0 && last != op)
printf("\n");
last = op;
if (type == B || type == V) {
printf(" %s=%d", opname, op + type);
count++;
} else {
int i, done = 0;
const char *s;
for (i = 0; sz[i] != '\0' && (s = strchr(list, sz[i])) != NULL; i++) {
int n = sizes[s-list];
if ((done&(1<<n)) == 0) {
printf(" %s%d=%d", opname, n, op + type + sizeop(n));
count++;
}
done |= 1<<n;
}
}
printf("\n");
return count;
}
int main(int argc, char *argv[]) {
int i, count = 0;
for (i = 1; i < argc; i++) {
char c, *s;
int n;
if (sscanf(argv[i], "%c=%d", &c, &n) == 2
&& n > 0 && (s = strchr(list, c)) != NULL)
sizes[s-list] = n;
else {
fprintf(stderr, "usage: %s [ {csilhfdxp}=n ]...\n", argv[0]);
exit(EXIT_FAILURE);
}
}
#define gop(x,n)
#define op(x,t,s) count += doop(x,t,#s,#x #t);
gop(CNST,1)
op(CNST,F,fdx)
op(CNST,I,csilh)
op(CNST,P,p)
op(CNST,U,csilh)
gop(ARG,2)
op(ARG,B,-)
op(ARG,F,fdx)
op(ARG,I,ilh)
op(ARG,P,p)
op(ARG,U,ilh)
gop(ASGN,3)
op(ASGN,B,-)
op(ASGN,F,fdx)
op(ASGN,I,csilh)
op(ASGN,P,p)
op(ASGN,U,csilh)
gop(INDIR,4)
op(INDIR,B,-)
op(INDIR,F,fdx)
op(INDIR,I,csilh)
op(INDIR,P,p)
op(INDIR,U,csilh)
gop(CVF,7)
op(CVF,F,fdx)
op(CVF,I,ilh)
gop(CVI,8)
op(CVI,F,fdx)
op(CVI,I,csilh)
op(CVI,U,csilhp)
gop(CVP,9)
op(CVP,U,p)
gop(CVU,11)
op(CVU,I,csilh)
op(CVU,P,p)
op(CVU,U,csilh)
gop(NEG,12)
op(NEG,F,fdx)
op(NEG,I,ilh)
gop(CALL,13)
op(CALL,B,-)
op(CALL,F,fdx)
op(CALL,I,ilh)
op(CALL,P,p)
op(CALL,U,ilh)
op(CALL,V,-)
gop(RET,15)
op(RET,F,fdx)
op(RET,I,ilh)
op(RET,P,p)
op(RET,U,ilh)
op(RET,V,-)
gop(ADDRG,16)
op(ADDRG,P,p)
gop(ADDRF,17)
op(ADDRF,P,p)
gop(ADDRL,18)
op(ADDRL,P,p)
gop(ADD,19)
op(ADD,F,fdx)
op(ADD,I,ilh)
op(ADD,P,p)
op(ADD,U,ilhp)
gop(SUB,20)
op(SUB,F,fdx)
op(SUB,I,ilh)
op(SUB,P,p)
op(SUB,U,ilhp)
gop(LSH,21)
op(LSH,I,ilh)
op(LSH,U,ilh)
gop(MOD,22)
op(MOD,I,ilh)
op(MOD,U,ilh)
gop(RSH,23)
op(RSH,I,ilh)
op(RSH,U,ilh)
gop(BAND,24)
op(BAND,I,ilh)
op(BAND,U,ilh)
gop(BCOM,25)
op(BCOM,I,ilh)
op(BCOM,U,ilh)
gop(BOR,26)
op(BOR,I,ilh)
op(BOR,U,ilh)
gop(BXOR,27)
op(BXOR,I,ilh)
op(BXOR,U,ilh)
gop(DIV,28)
op(DIV,F,fdx)
op(DIV,I,ilh)
op(DIV,U,ilh)
gop(MUL,29)
op(MUL,F,fdx)
op(MUL,I,ilh)
op(MUL,U,ilh)
gop(EQ,30)
op(EQ,F,fdx)
op(EQ,I,ilh)
op(EQ,U,ilhp)
gop(GE,31)
op(GE,F,fdx)
op(GE,I,ilh)
op(GE,U,ilhp)
gop(GT,32)
op(GT,F,fdx)
op(GT,I,ilh)
op(GT,U,ilhp)
gop(LE,33)
op(LE,F,fdx)
op(LE,I,ilh)
op(LE,U,ilhp)
gop(LT,34)
op(LT,F,fdx)
op(LT,I,ilh)
op(LT,U,ilhp)
gop(NE,35)
op(NE,F,fdx)
op(NE,I,ilh)
op(NE,U,ilhp)
gop(JUMP,36)
op(JUMP,V,-)
gop(LABEL,37)
op(LABEL,V,-)
gop(LOAD,14)
op(LOAD,B,-)
op(LOAD,F,fdx)
op(LOAD,I,csilh)
op(LOAD,P,p)
op(LOAD,U,csilhp)
#undef gop
#undef op
fprintf(stderr, "%d operators\n", count);
return EXIT_SUCCESS;
}

106
lcc/etc/osf.c Normal file → Executable file
View file

@ -1,53 +1,53 @@
/* DEC ALPHAs running OSF/1 V3.2A (Rev. 17) at Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = {
LCCDIR "cpp", "-D__STDC__=1",
"-DLANGUAGE_C", "-D__LANGUAGE_C__",
"-D_unix", "-D__unix__", "-D_osf", "-D__osf__", "-Dunix",
"-Dalpha", "-D_alpha", "-D__alpha",
"-D__SYSTYPE_BSD", "-D_SYSTYPE_BSD",
"$1", "$2", "$3", 0 };
char *com[] = { LCCDIR "rcc", "-target=alpha/osf", "$1", "$2", "$3", "", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *as[] = { "/bin/as", "-o", "$3", "", "$1", "-nocpp", "$2", 0 };
char *ld[] = { "/usr/bin/ld", "-o", "$3", "/usr/lib/cmplrs/cc/crt0.o",
"$1", "$2", "", "", "-L" LCCDIR, "-llcc", "-lm", "-lc", 0 };
extern char *concat(char *, char *);
extern int access(const char *, int);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/rcc");
ld[8] = concat("-L", &arg[8]);
} else if (strcmp(arg, "-g4") == 0
&& access("/u/drh/lib/alpha/rcc", 4) == 0
&& access("/u/drh/book/cdb/alpha/osf/cdbld", 4) == 0) {
com[0] = "/u/drh/lib/alpha/rcc";
com[5] = "-g4";
ld[0] = "/u/drh/book/cdb/alpha/osf/cdbld";
ld[1] = "-o";
ld[2] = "$3";
ld[3] = "$1";
ld[4] = "$2";
ld[5] = 0;
} else if (strcmp(arg, "-g") == 0)
return 1;
else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}
/* DEC ALPHAs running OSF/1 V3.2A (Rev. 17) at Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = {
LCCDIR "cpp", "-D__STDC__=1",
"-DLANGUAGE_C", "-D__LANGUAGE_C__",
"-D_unix", "-D__unix__", "-D_osf", "-D__osf__", "-Dunix",
"-Dalpha", "-D_alpha", "-D__alpha",
"-D__SYSTYPE_BSD", "-D_SYSTYPE_BSD",
"$1", "$2", "$3", 0 };
char *com[] = { LCCDIR "rcc", "-target=alpha/osf", "$1", "$2", "$3", "", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *as[] = { "/bin/as", "-o", "$3", "", "$1", "-nocpp", "$2", 0 };
char *ld[] = { "/usr/bin/ld", "-o", "$3", "/usr/lib/cmplrs/cc/crt0.o",
"$1", "$2", "", "", "-L" LCCDIR, "-llcc", "-lm", "-lc", 0 };
extern char *concat(char *, char *);
extern int access(const char *, int);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/rcc");
ld[8] = concat("-L", &arg[8]);
} else if (strcmp(arg, "-g4") == 0
&& access("/u/drh/lib/alpha/rcc", 4) == 0
&& access("/u/drh/book/cdb/alpha/osf/cdbld", 4) == 0) {
com[0] = "/u/drh/lib/alpha/rcc";
com[5] = "-g4";
ld[0] = "/u/drh/book/cdb/alpha/osf/cdbld";
ld[1] = "-o";
ld[2] = "$3";
ld[3] = "$1";
ld[4] = "$2";
ld[5] = 0;
} else if (strcmp(arg, "-g") == 0)
return 1;
else if (strcmp(arg, "-b") == 0)
;
else
return 0;
return 1;
}

100
lcc/etc/solaris.c Normal file → Executable file
View file

@ -1,50 +1,50 @@
/* SPARCs running Solaris 2.5.1 at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
#ifndef SUNDIR
#define SUNDIR "/opt/SUNWspro/SC4.2/lib/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp",
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
"$1", "$2", "$3", 0 };
char *as[] = { "/usr/ccs/bin/as", "-Qy", "-s", "-o", "$3", "$1", "$2", 0 };
char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
SUNDIR "crti.o", SUNDIR "crt1.o",
SUNDIR "values-xa.o", "$2", "",
"-Y", "P," SUNDIR ":/usr/ccs/lib:/usr/lib", "-Qy",
"-L" LCCDIR, "-llcc", "-lm", "-lc", SUNDIR "crtn.o", 0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
ld[12] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-p") == 0) {
ld[5] = SUNDIR "mcrt1.o";
ld[10] = "P," SUNDIR "libp:/usr/ccs/lib/libp:/usr/lib/libp:"
SUNDIR ":/usr/ccs/lib:/usr/lib";
} else if (strcmp(arg, "-b") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else
return 0;
return 1;
}
/* SPARCs running Solaris 2.5.1 at CS Dept., Princeton University */
#include <string.h>
#ifndef LCCDIR
#define LCCDIR "/usr/local/lib/lcc/"
#endif
#ifndef SUNDIR
#define SUNDIR "/opt/SUNWspro/SC4.2/lib/"
#endif
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp",
"-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
"-I/usr/include", 0 };
char *com[] = { LCCDIR "rcc", "-target=sparc/solaris",
"$1", "$2", "$3", 0 };
char *as[] = { "/usr/ccs/bin/as", "-Qy", "-s", "-o", "$3", "$1", "$2", 0 };
char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1",
SUNDIR "crti.o", SUNDIR "crt1.o",
SUNDIR "values-xa.o", "$2", "",
"-Y", "P," SUNDIR ":/usr/ccs/lib:/usr/lib", "-Qy",
"-L" LCCDIR, "-llcc", "-lm", "-lc", SUNDIR "crtn.o", 0 };
extern char *concat(char *, char *);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/cpp");
include[0] = concat("-I", concat(&arg[8], "/include"));
ld[12] = concat("-L", &arg[8]);
com[0] = concat(&arg[8], "/rcc");
} else if (strcmp(arg, "-g") == 0)
;
else if (strcmp(arg, "-p") == 0) {
ld[5] = SUNDIR "mcrt1.o";
ld[10] = "P," SUNDIR "libp:/usr/ccs/lib/libp:/usr/lib/libp:"
SUNDIR ":/usr/ccs/lib:/usr/lib";
} else if (strcmp(arg, "-b") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else
return 0;
return 1;
}

86
lcc/etc/win32.c Normal file → Executable file
View file

@ -1,43 +1,43 @@
/* x86s running MS Windows NT 4.0 */
#include <string.h>
#ifndef LCCDIR
// JDC #define LCCDIR "\\progra~1\\lcc\\4.1\\bin\\"
//#define LCCDIR "\\quake3\\source\\lcc\\bin\\" // JDC
// TTimo: q3cpp q3rcc & no hardcoded paths
#define LCCDIR ""
#endif
char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "q3cpp", "-D__STDC__=1", "-Dwin32", "-D_WIN32", "-D_M_IX86",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", 0 };
char *com[] = { LCCDIR "q3rcc", "-target=x86/win32", "$1", "$2", "$3", 0 };
char *as[] = { "ml", "-nologo", "-c", "-Cp", "-coff", "-Fo$3", "$1", "$2", 0 };
char *ld[] = { "link", "-nologo",
"-align:0x1000", "-subsystem:console", "-entry:mainCRTStartup",
"$2", "-OUT:$3", "$1", LCCDIR "liblcc.lib", "libc.lib", "kernel32.lib", 0 };
extern char *concat(char *, char *);
extern char *replace(const char *, int, int);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
arg = replace(arg + 8, '/', '\\');
if (arg[strlen(arg)-1] == '\\')
arg[strlen(arg)-1] = '\0';
cpp[0] = concat(arg, "\\cpp.exe");
include[0] = concat("-I", concat(arg, "\\include"));
com[0] = concat(arg, "\\rcc.exe");
ld[8] = concat(arg, "\\liblcc.lib");
} else if (strcmp(arg, "-b") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else
return 0;
return 1;
}
/* x86s running MS Windows NT 4.0 */
#include <string.h>
#ifndef LCCDIR
// JDC #define LCCDIR "\\progra~1\\lcc\\4.1\\bin\\"
//#define LCCDIR "\\quake3\\source\\lcc\\bin\\" // JDC
// TTimo: q3cpp q3rcc & no hardcoded paths
#define LCCDIR ""
#endif
char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "q3cpp", "-D__STDC__=1", "-Dwin32", "-D_WIN32", "-D_M_IX86",
"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", 0 };
char *com[] = { LCCDIR "q3rcc", "-target=x86/win32", "$1", "$2", "$3", 0 };
char *as[] = { "ml", "-nologo", "-c", "-Cp", "-coff", "-Fo$3", "$1", "$2", 0 };
char *ld[] = { "link", "-nologo",
"-align:0x1000", "-subsystem:console", "-entry:mainCRTStartup",
"$2", "-OUT:$3", "$1", LCCDIR "liblcc.lib", "libc.lib", "kernel32.lib", 0 };
extern char *concat(char *, char *);
extern char *replace(const char *, int, int);
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
arg = replace(arg + 8, '/', '\\');
if (arg[strlen(arg)-1] == '\\')
arg[strlen(arg)-1] = '\0';
cpp[0] = concat(arg, "\\cpp.exe");
include[0] = concat("-I", concat(arg, "\\include"));
com[0] = concat(arg, "\\rcc.exe");
ld[8] = concat(arg, "\\liblcc.lib");
} else if (strcmp(arg, "-b") == 0)
;
else if (strncmp(arg, "-ld=", 4) == 0)
ld[0] = &arg[4];
else
return 0;
return 1;
}

28
lcc/include/alpha/osf/assert.h Normal file → Executable file
View file

@ -1,14 +1,14 @@
#ifndef __ASSERT
#define __ASSERT
void assert(int);
#endif /* __ASSERT */
#undef assert
#ifdef NDEBUG
#define assert(ignore) ((void)0)
#else
extern void __assert(char *, char *, unsigned);
#define assert(e) ((void)((e)||(__assert(#e, __FILE__, __LINE__),0)))
#endif /* NDEBUG */
#ifndef __ASSERT
#define __ASSERT
void assert(int);
#endif /* __ASSERT */
#undef assert
#ifdef NDEBUG
#define assert(ignore) ((void)0)
#else
extern void __assert(char *, char *, unsigned);
#define assert(e) ((void)((e)||(__assert(#e, __FILE__, __LINE__),0)))
#endif /* NDEBUG */

50
lcc/include/alpha/osf/ctype.h Normal file → Executable file
View file

@ -1,25 +1,25 @@
#ifndef __CTYPE
#define __CTYPE
extern int isalnum(int);
extern int isalpha(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int tolower(int);
extern int toupper(int);
#define __U 01
#define __L 02
#define __N 04
#define __S 010
#define __P 020
#define __C 040
#endif /* __CTYPE */
#ifndef __CTYPE
#define __CTYPE
extern int isalnum(int);
extern int isalpha(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int tolower(int);
extern int toupper(int);
#define __U 01
#define __L 02
#define __N 04
#define __S 010
#define __P 020
#define __C 040
#endif /* __CTYPE */

16
lcc/include/alpha/osf/errno.h Normal file → Executable file
View file

@ -1,8 +1,8 @@
#ifndef __ERRNO
#define __ERRNO
#define EDOM 33
#define ERANGE 34
extern int errno;
#endif /* __ERRNO */
#ifndef __ERRNO
#define __ERRNO
#define EDOM 33
#define ERANGE 34
extern int errno;
#endif /* __ERRNO */

74
lcc/include/alpha/osf/float.h Normal file → Executable file
View file

@ -1,37 +1,37 @@
#ifndef __FLOAT
#define __FLOAT
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209289550781250000e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282346638528860000e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435082228750000e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.22044604925031310000e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.79769313486231570000e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.22507385850720140000e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#endif /* __FLOAT */
#ifndef __FLOAT
#define __FLOAT
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#define FLT_DIG 6
#define FLT_EPSILON 1.19209289550781250000e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282346638528860000e+38
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435082228750000e-38
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.22044604925031310000e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.79769313486231570000e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.22507385850720140000e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#endif /* __FLOAT */

48
lcc/include/alpha/osf/limits.h Normal file → Executable file
View file

@ -1,24 +1,24 @@
#ifndef __LIMITS
#define __LIMITS
#define CHAR_BIT 8
#define MB_LEN_MAX 1
#define UCHAR_MAX 0xff
#define USHRT_MAX 0xffff
#define UINT_MAX (~0U)
#define ULONG_MAX (~0UL)
#define CHAR_MAX SCHAR_MAX
#define SCHAR_MAX 0x7f
#define SHRT_MAX 0x7fff
#define INT_MAX 0x7fffffff
#define LONG_MAX 0x7fffffffffffffffL
#define CHAR_MIN SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX-1)
#define SHRT_MIN (-SHRT_MAX-1)
#define INT_MIN (-INT_MAX-1)
#define LONG_MIN (-LONG_MAX-1)
#endif /* __LIMITS */
#ifndef __LIMITS
#define __LIMITS
#define CHAR_BIT 8
#define MB_LEN_MAX 1
#define UCHAR_MAX 0xff
#define USHRT_MAX 0xffff
#define UINT_MAX (~0U)
#define ULONG_MAX (~0UL)
#define CHAR_MAX SCHAR_MAX
#define SCHAR_MAX 0x7f
#define SHRT_MAX 0x7fff
#define INT_MAX 0x7fffffff
#define LONG_MAX 0x7fffffffffffffffL
#define CHAR_MIN SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX-1)
#define SHRT_MIN (-SHRT_MAX-1)
#define INT_MIN (-INT_MAX-1)
#define LONG_MIN (-LONG_MAX-1)
#endif /* __LIMITS */

72
lcc/include/alpha/osf/locale.h Normal file → Executable file
View file

@ -1,36 +1,36 @@
#ifndef __LOCALE
#define __LOCALE
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define NULL 0
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
char *setlocale(int, const char *);
struct lconv *localeconv(void);
#endif /* __LOCALE */
#ifndef __LOCALE
#define __LOCALE
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define NULL 0
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
char *setlocale(int, const char *);
struct lconv *localeconv(void);
#endif /* __LOCALE */

58
lcc/include/alpha/osf/math.h Normal file → Executable file
View file

@ -1,29 +1,29 @@
#ifndef __MATH
#define __MATH
#define HUGE_VAL 1.79769313486231570000e+308
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
#endif /* __MATH */
#ifndef __MATH
#define __MATH
#define HUGE_VAL 1.79769313486231570000e+308
extern double acos(double);
extern double asin(double);
extern double atan(double);
extern double atan2(double, double);
extern double cos(double);
extern double sin(double);
extern double tan(double);
extern double cosh(double);
extern double sinh(double);
extern double tanh(double);
extern double exp(double);
extern double frexp(double, int *);
extern double ldexp(double, int);
extern double log(double);
extern double log10(double);
extern double modf(double, double *);
extern double pow(double, double);
extern double sqrt(double);
extern double ceil(double);
extern double fabs(double);
extern double floor(double);
extern double fmod(double, double);
#endif /* __MATH */

20
lcc/include/alpha/osf/setjmp.h Normal file → Executable file
View file

@ -1,10 +1,10 @@
#ifndef __SETJMP
#define __SETJMP
typedef int jmp_buf[35+1+48];
int setjmp(jmp_buf);
void longjmp(jmp_buf, int);
#endif /* __SETJMP */
#ifndef __SETJMP
#define __SETJMP
typedef int jmp_buf[35+1+48];
int setjmp(jmp_buf);
void longjmp(jmp_buf, int);
#endif /* __SETJMP */

40
lcc/include/alpha/osf/signal.h Normal file → Executable file
View file

@ -1,20 +1,20 @@
#ifndef __SIGNAL
#define __SIGNAL
typedef int sig_atomic_t;
#define SIG_DFL ((void (*)(int))0)
#define SIG_ERR ((void (*)(int))-1)
#define SIG_IGN ((void (*)(int))1)
#define SIGABRT 6
#define SIGFPE 8
#define SIGILL 4
#define SIGINT 2
#define SIGSEGV 11
#define SIGTERM 15
void (*signal(int, void (*)(int)))(int);
int raise(int);
#endif /* __SIGNAL */
#ifndef __SIGNAL
#define __SIGNAL
typedef int sig_atomic_t;
#define SIG_DFL ((void (*)(int))0)
#define SIG_ERR ((void (*)(int))-1)
#define SIG_IGN ((void (*)(int))1)
#define SIGABRT 6
#define SIGFPE 8
#define SIGILL 4
#define SIGINT 2
#define SIGSEGV 11
#define SIGTERM 15
void (*signal(int, void (*)(int)))(int);
int raise(int);
#endif /* __SIGNAL */

56
lcc/include/alpha/osf/stdarg.h Normal file → Executable file
View file

@ -1,28 +1,28 @@
#ifndef __STDARG
#define __STDARG
#if !defined(_VA_LIST)
#define _VA_LIST
typedef struct {
char *_a0; /* pointer to first homed integer arg */
int _offset; /* byte offset of next param */
float _tmp;
} __va_list;
#endif
typedef __va_list va_list;
#define va_start(list, start) ((void)( \
(list)._a0 = (__typecode(__firstarg)==1 ? \
(char*)&__firstarg+48 : (char *)&__firstarg), \
(list)._offset = (__typecode(start)==1 ? \
(char*)&start+56 : (char *)&start+8)-(list)._a0))
#define va_arg(list, mode) (*(mode *)( \
(list)._offset += (int)((sizeof(mode)+7)&~7), \
(__typecode(mode)==1 && sizeof(mode)==4) ? \
((list)._tmp = (float)*(double *)((list)._a0 + (list)._offset - \
((list)._offset <= 48 ? 56 : 8))), (char *)&(list)._tmp : \
(__typecode(mode)==1 && (list)._offset <= 48) ? \
(list)._a0 + (list)._offset - 56 : \
(list)._a0 + (list)._offset - (int)((sizeof(mode)+7)&~7)))
#define va_end(list) ((void)0)
#endif
#ifndef __STDARG
#define __STDARG
#if !defined(_VA_LIST)
#define _VA_LIST
typedef struct {
char *_a0; /* pointer to first homed integer arg */
int _offset; /* byte offset of next param */
float _tmp;
} __va_list;
#endif
typedef __va_list va_list;
#define va_start(list, start) ((void)( \
(list)._a0 = (__typecode(__firstarg)==1 ? \
(char*)&__firstarg+48 : (char *)&__firstarg), \
(list)._offset = (__typecode(start)==1 ? \
(char*)&start+56 : (char *)&start+8)-(list)._a0))
#define va_arg(list, mode) (*(mode *)( \
(list)._offset += (int)((sizeof(mode)+7)&~7), \
(__typecode(mode)==1 && sizeof(mode)==4) ? \
((list)._tmp = (float)*(double *)((list)._a0 + (list)._offset - \
((list)._offset <= 48 ? 56 : 8))), (char *)&(list)._tmp : \
(__typecode(mode)==1 && (list)._offset <= 48) ? \
(list)._a0 + (list)._offset - 56 : \
(list)._a0 + (list)._offset - (int)((sizeof(mode)+7)&~7)))
#define va_end(list) ((void)0)
#endif

44
lcc/include/alpha/osf/stddef.h Normal file → Executable file
View file

@ -1,22 +1,22 @@
#ifndef __STDDEF
#define __STDDEF
#define NULL 0
#define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->mem - (char*)0))
typedef long ptrdiff_t;
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
#define _SIZE_T
#define _SIZE_T_
typedef unsigned long size_t;
#endif
#if !defined(_WCHAR_T) && !defined(_WCHAR_T_)
#define _WCHAR_T
#define _WCHAR_T_
typedef unsigned short wchar_t;
#endif
#endif /* __STDDEF */
#ifndef __STDDEF
#define __STDDEF
#define NULL 0
#define offsetof(ty,mem) ((size_t)((char*)&((ty*)0)->mem - (char*)0))
typedef long ptrdiff_t;
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
#define _SIZE_T
#define _SIZE_T_
typedef unsigned long size_t;
#endif
#if !defined(_WCHAR_T) && !defined(_WCHAR_T_)
#define _WCHAR_T
#define _WCHAR_T_
typedef unsigned short wchar_t;
#endif
#endif /* __STDDEF */

Some files were not shown because too many files have changed in this diff Show more