summaryrefslogtreecommitdiff
path: root/usr.bin/pcc/cc/ccom/ccom.1
blob: 5bca790fea027bbdfdaec6a2f7a0ad2051e18ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.\"	$OpenBSD: ccom.1,v 1.3 2007/09/27 19:56:48 otto Exp $
."\
.\" Copyright (c) 2007 Jeremy C. Reed <reed@reedmedia.net>
.\" Permission to use, copy, modify, and/or distribute this software for any 
.\" purpose with or without fee is hereby granted, provided that the above 
.\" copyright notice and this permission notice appear in all copies.
.\" 
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR AND CONTRIBUTORS DISCLAIM 
.\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHOR AND 
.\" CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 
.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 
.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 
.\" THIS SOFTWARE.
.Dd September 14, 2007
.Dt ccom 1
.Os
.Sh NAME
.Nm ccom
.Nd C compiler
.Sh SYNOPSIS
.Nm
.Op Fl X Ar flags
.Op infile
.Op outfile
.Pp
.Sh DESCRIPTION
The
.Nm
utility provides a C compiler.
The frontend is usually
.Xr pcc 1 .
It is \fBnot\fR intended to be run directly.
.Pp
.Nm
reads the C source from
.Ar infile
or standard input and writes the assembler source
to
.Ar outfile
or to standard output.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl g
Enable debugging.
.\" built into binary, explain stabs?
.It Fl s
Print statistics to standard error when complete.
This includes:
name table entries, name string size, permanent allocated memory,
temporary allocated memory, lost memory, argument list unions,
dimension/function unions, struct/union/enum blocks, inline node count,
inline control blocks, and permanent symtab entries.
.\" TODO: explain units for above?
.It Fl W Ar flags
Report warnings.
(Do some basic checks.)
NOTE!  These are subject to change RSN!
.Ar Flags
is one or more of the following:
.Bl -tag -width Ds
.It Sy implicit
Implies
.Sy implicit-int
and
.Sy implicit-function-declaration .
.It Sy implicit-int
TODO
.It Sy implicit-function-declaration
Report if no prototype for function.
.It Sy missing-prototypes
TODO
.It Sy strict-prototypes
TODO
.El
.\"
.It Fl x Ar optimizations
.Ar optimizations
is one or more of the following:
.Bl -tag -width deljumps
.It Sy deljumps
Delete redundant jumps and dead code.
.It Sy ssa
Convert statements into SSA form for optimization.  Not yet finished.
.It Sy tailcall
Currently not implemented.
.It Sy temps
Setting this flag allow variables to be put into registers, for further 
optimization by the register allocator.
.El
.\"
.It Fl X Ar C specific debugging flags
.Ar Flags
is one or more of the following:
.Bl -tag -width Ds
.It Sy b
Building of parse trees
.It Sy d
Declarations, more d gives more output
.It Sy t
Type conversions
.It Sy i
Initializations
.It Sy e
Pass1 trees at exit
.It Sy x
Target-specific flag, used in machine-dependent code
.El
.\"
.It Fl Z Ar Code generator (pass2) specific debugging flags
.Ar Flags 
is one or more of the following:
.Bl -tag -width Ds
.It Sy e
Trees when entering pass2
.It Sy o
Instruction generator
.It Sy f
Instruction matcher, may provide much output
.It Sy r
Register allocator
.It Sy t
Type matching in instruction generator
.It Sy s
Shape matching in instruction generator
.It Sy u
Sethi-Ullman computations
.It Sy x
Target-specific flag, used in machine-dependent code 
.El
.Sh SEE ALSO
.Xr as 1 ,
.Xr cpp 1 ,
.Xr pcc 1
.Sh HISTORY
The
.Nm
compiler is based on the original Portable C Compiler by S. C.
Johnson, written in the late 70's.
Even though much of the compiler has been rewritten, some of the
basics still remain.
About 50% of the frontend code and 80% of the backend code has been
rewritten.
Most is written by Anders Magnusson, with the exception of
the data-flow analysis part and the SSA conversion code which is
written by Peter A Jonsson, and the Mips port that were written as
part of a project by undergraduate students at Lulea University of 
Technology.