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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
Release 1.10, 2012-02-29
========================
Improvements in confidence:
- CompCert C now natively supports volatile types. Its semantics fully
specifies the meaning of volatile memory accesses. The translation
of volatile accesses to built-in function invocations is now proved correct.
- CompCert C now natively supports assignment between composite types
(structs or unions), passing composite types by value as function
parameters, and other instances of using composites as r-values, with
the exception of returning composites by value from a function.
(The latter remains emulated, using the -fstruct-return option.)
- PowerPC: removed the -fmadd option, not semantically-preserving
in the strict sense.
Language features:
- Support for _Bool type from ISO C99.
- Support for _Alignof(ty) operator from ISO C 2011
and __alignof__(ty), __alignof__(expr) from GCC.
Performance improvements:
- Improvements in instruction selection, especially for integer casts
and their combinations with bitwise operations.
- Shorter, more efficient code generated for accessing volatile global
variables.
- Better code generated for the && and || operators.
- More aggressive common subexpression elimination (CSE) of memory loads.
- Improved register allocation for invocations of built-ins,
especially for annotations.
- In Cminor and down, make safe operators non-strict: they return Vundef
instead of getting stuck. This enables more optimizations.
- Cast optimization is no longer performed by a separate pass over
RTL, but equivalent optimization is done during Cminor generation
and during instruction selection.
Other improvements:
- PowerPC/EABI: uninitialized global variables now go in common (bss) section.
- PowerPC: work around limited excursion of conditional branch instructions.
- PowerPC: added __builtin_fnmadd() and __builtin_fnmsub().
- Reference interpreter: better printing of pointer values and locations.
- Added command-line options -Wp,<opt> -Wa,<opt> -Wl,<opt> to pass
specific options to the preprocessor, assembler, or linker, respectively.
Release 1.9.1, 2011-11-28
=========================
Bug fixes:
- Initialization of a char array by a short string literal was wrongly rejected
- Incorrect handling of volatile arrays.
- IA32 code generator: make sure that min_int / -1 does not cause a
machine trap.
Improvements:
- Added language option -flongdouble to treat "long double" like "double".
- The reference interpreter (ccomp -interp) now supports 2-argument main
functions (int main(int, char **)).
- Improved but still very experimental emulation of packed structs
(-fpacked-structs)
- Coq->Caml extraction: extract Coq pairs to Caml pairs and Coq
characters to Caml "char" type.
Release 1.9, 2011-08-22
=======================
- The reduction semantics of CompCert C was made executable and turned
into a reference interpreter for CompCert C, enabling animation of
the semantics. (Thanks to Brian Campbell for suggesting this approach.)
Usage is: ccomp -interp [options] source.c
Options include:
-trace to print a detailed trace of reduction steps
-random to randomize execution order
-all to explore all possible execution orders in parallel
- Revised and strengthened the top-level statements of semantic preservation.
In particular, we now show:
. backward simulation for the whole compiler without assuming
a deterministic external world;
. if the source program goes wrong after performing some I/O,
the compiled code performs at least these I/O before continuing
with an arbitrary behavior.
- Fixed two omissions in the semantics of CompCert C
(reported by Brian Campbell):
. Functions calls through a function pointer had undefined semantics.
. Conditional expressions "e1 ? e2 : e3" where e2 and e3 have different
types were missing a cast to their common type.
- Support for "read-modify-write" operations over volatiles
(such as e++ or --e or e |= 1 where e has volatile type)
through a new presimplification (flag -fvolatile-rmw, "on" by default).
- New optimization pass: Redundant Reload Elimination, which fixes up
inefficiencies introduced during the Reload pass. On x86, it increases
performance by up to 10%. On PowerPC and ARM, the effect is negligible.
- Revised handling of annotation statements. Now they come in two forms:
1. __builtin_annot("format", x1, ..., xN)
(arbitrarily many arguments; no code generated, even if some
of the xi's were spilled; no return value)
2. __builtin_annot_intval("format", x1)
(one integer argument, reloaded in a register if needed,
returned as result).
- Related clean-ups in the handling of external functions and
compiler built-ins. In particular, __builtin_memcpy is now
fully specified.
- ARM code generator was ported to the new ABI (EABI in ARM parlance,
armel in Debian parlance), using VFD instructions for floating-point.
(Successfully tested on a Trimslice platform running Ubuntu 11.04.)
- IA32 code generator:
. Added -fno-sse option to prevent generation of SSE instructions
for memory copy operations.
. More realistic modeling of the ST0 (top-of-FP-stack) register
and of floating-point compare and branch.
- PowerPC code generator: more efficient instruction sequences generated
for insertion in a bit field and for some comparisons against 0.
Release 1.8.2, 2011-05-24
=========================
- Support for "aligned" and "section" attributes on global variables, e.g.
__attribute__((aligned(16))) int x;
- Experimental emulation of packed structs (flag -fpacked-structs).
- Pointer comparisons now treated as unsigned comparisons (previously: signed).
This fixes an issue with arrays straddling the 0x8000_0000 boundary.
Consequently, the "ofs" part of pointer values "Vptr b ofs" is
now treated as unsigned (previously: signed).
- Elimination of unreferenced labels now performed by a separate pass
(backend/CleanupLabels.v) and proved correct.
- Stacking pass revised: supports more flexible layout of the stack
frame; two-step proof (Stackingproof + Machabstr2concr) merged
into one single proof (Stackingproof).
- The requirement that pointers be valid in pointer comparisons
was pushed through all intermediate languages of the back-end
(previously: requirement present only up to Csharpminor).
- Emulation of assignment between structs and between unions was
simplified and made more efficient, thanks to a better implementation
of __builtin_memcpy.
- Improvements to the compiler driver:
. -E option now prints preprocessed result to standard output
instead of saving it in a .i file
. support for .s (assembly) and .S (assembly to be preprocessed)
input files
Release 1.8.1, 2011-03-14
=========================
- Adapted to Coq 8.3pl1.
- Reduced compilation times through several algorithmic improvements
(contributed by A. Pilkiewicz).
- In the various semantics, allow float-to-int conversions to fail
(if the float argument is outside the range of representable ints).
- Initialization of global C variables made more robust and proved correct.
- ABI conformance improved:
. the "char" type is now signed for x86, remains unsigned for PowerPC and ARM
. placement of bit-fields now follows SVR4 conventions (affects PowerPC)
- Bug fixes in the C pre-simplifier:
. nontermination with some recursive struct types
. issues with zero-width bit fields
. elimination of struct assignments duplicating some volatile accesses
Release 1.8, 2010-09-21
=======================
- The input language to the proved part of the compiler is no longer
Clight but CompCert C: a larger subset of the C language supporting
in particular side-effects within expressions. The transformations
that pull side effects out of expressions and materialize implicit
casts, formerly performed by untrusted Caml code, are now fully
proved in Coq.
- New port targeting Intel/AMD x86 processors. Generates 32-bit x86 code
using SSE2 extensions for floating-point arithmetic. Works under
Linux, MacOS X, and the Cygwin environment for Windows.
CompCert's compilation strategy is not a very good match for the
x86 architecture, therefore the performance of the generated code
is not as good as for the PowerPC port, but still usable.
(About 75% of the performance of gcc -O1 for x86, compared with
> 90% for PowerPC.)
- More faithful semantics for volatile accesses:
. volatile reads and writes from a volatile global variable are treated
like input and output system calls (respectively), bypassing
the memory model entirely;
. volatile reads and writes from other locations are treated like
regular loads and stores.
- Introduced __builtin_memcpy() and __builtin_memcpy_words(), use them
instead of memcpy() to compile struct and union assignments.
- Introduced __builtin_annotation() to transmit assertions from
the source program all the way to the generated assembly code.
- Elimination of some useless casts around "&", "|" and "^" bitwise operators.
- Produce fewer "moves" during RTL generation. This speeds up the
rest of compilation and slightly improves the result of register
allocation when register pressure is high.
- Improvements in register allocation:
. Implemented a spilling heuristic during register allocation.
This heuristic reduces significantly the amount of spill code
generated when register pressure is high.
. More coalescing between low-pressure and high-pressure variables.
. Aggressive coalescing between pairs of spilled variables.
- Fixed some bugs in the emulation of bit fields.
Release 1.7.1, 2010-04-13
=========================
Bug fixes in the new C pre-simplifier:
- Missing cast on return value for some functions
- Incorrect simplification of some uses of || and &&
- Nontermination in the presence of a bit field of size exactly 32 bits.
- Global initializers for structs containing bit fields.
- Wrong type in volatile reads from variables of type 'unsigned int'.
Small improvements to the PowerPC port:
- Added __builtin_trap() built-in function.
- Support for '#pragma reserve_register' (EABI)
- Less aggressive alignment of global variables.
- Generate '.type' and '.size' directives (EABI).
Release 1.7, 2010-03-31
=======================
- New implementation of the C type-checker, simplifier, and translation to
Clight. Compared with the previous CIL-based solution, the new
implementation is more modular and supports more optional simplifications.
- More features of the C language are handled by expansion during
translation to Clight:
. assignment between structs and unions (option -fstruct-assign)
. passing structs and union by value (option -fstruct-passing)
. bit-fields in structs (option -fbitfields)
- The "volatile" modifier is now honored. Volatile accesses are represented
in Clight by calls to built-in functions, which are preserved throughout
the compilation chain, then turned into processor loads and stores
at the end.
- Generic support for C built-in functions. These predefined external
functions give access to special instructions of the processor. See
powerpc/CBuiltins.ml for the list of PowerPC built-in functions.
- The memory model now exposes the bit-level in-memory representation
of integers and floats. This strengthens the semantic preservation
theorem: we now prove that C code that directly manipulates these
bit-level representations (e.g. via a union between floats and integers)
is correctly compiled.
- The memory model now supports fine-grained access control to individual
bytes of a memory block. This feature is currently unused in the
compiler proofs, but will facilitate connections with separation logics
later.
- External functions are now allowed to read and modify memory.
The semantic preservation proofs were strengthened accordingly.
In particular, this enables the malloc() and free() C library functions
to be modeled as external functions in a provably correct manner.
- Minor improvements in the handling of global environments and the
construction of the initial memory state.
- Bug fixes in the handling of '#pragma section' and '#pragma set_section'.
- The C test suite was enriched and restructured.
Release 1.6, 2010-01-13
=======================
- Support Clight initializers of the form "int * x = &y;".
- Fixed spurious compile-time error on Clight initializers of the form
"const enum E x[2] = { E_1, E_2 };".
- Produce informative error message if a 'return' without argument
occurs in a non-void function, or if a 'return' with an argument
occurs in a void function.
- Preliminary support for '#pragma section' and '#pragma set_section'.
- Preliminary support for small data areas in PowerPC code generator.
- Back-end: added support for jump tables; used them to compile
dense 'switch' statements.
- PowerPC code generator: force conversion to single precision before
doing a "store single float" instruction.
Release 1.5, 2009-08-28
=======================
- Support for "goto" in the source language Clight.
- Added small-step semantics for Clight.
- Traces for diverging executions are now uniquely defined;
tightened semantic preservation results accordingly.
- Emulated assignments between structures
(during the C to Clight initial translation).
- Fixed spurious compile-time error on Clight statements of the form
"x = f(...);" where x is a global variable.
- Fixed spurious compile-time error on Clight initializers where
the initial value is the result of a floating-point computation
(e.g. "double x = 3.14159 / 2;").
- Simplified the interface of the generic dataflow solver.
- Reduced running time and memory requirements for the constant propagation
pass.
- Improved the implementation of George and Appel's graph coloring heuristic:
runs faster, produces better results.
- Revised the implementation of branch tunneling.
- Improved modularization between processor-dependent and
processor-independent parts.
Release 1.4.1, 2009-06-05
=========================
- Adapted to Coq 8.2-1. No changes in functionality.
Release 1.4, 2009-04-20
=======================
- Modularized the processor dependencies in the back-end.
- Three target architectures are now supported:
PowerPC / MacOS X (most mature)
PowerPC / EABI & Linux (getting stable)
ARM / Linux EABI (still experimental)
- Added alignment constraints to the memory model.
- Clight: added support for conditional expressions (a ? b : c);
removed support for array accesses a[i], now a derived form.
- C front-end: honor "static" modifiers on globals.
- New optimization over RTL: turning calls into tail calls when possible.
- Instruction selection pass: elimination of redundant casts following
a memory load of a "small" memory quantity.
- Linearization pass: improved the linearization heuristic.
- Reloading pass: more economical use of temporaries.
- Back-end: removed "alloc heap" instruction; removed pointer validity
checks in pointer comparisons.
Release 1.3, 2008-08-11
=======================
- Added "goto" and labeled statements to Cminor. Extended RTLgen and
its proof accordingly.
- Introduced small-step transition semantics for Cminor; used it in
proof of RTLgen pass; proved consistency of Cminor big-step semantics
w.r.t. transition semantics.
- Revised division of labor between the Allocation pass and the Reload pass.
The semantics of LTL and LTLin no longer need to anticipate the passing
of arguments through the conventional locations.
- Cleaned up Stacking pass: the positions of the back link and of
the return address in the stack frame are no longer hard-wired
in the Mach semantics.
- Added operator to convert from float to unsigned int; used it in C front-end
- Added flag -fmadd to control recognition of fused multiply-add and -sub
- Semantics of pointer-pointer comparison in Clight was incomplete:
pointers within different blocks can now be compared using == or !=
- Addition integer + pointer is now supported in Clight.
- Improved instruction selection for complex conditions involving || and &&.
- Improved translation of Cminor "switch" statements to RTL decision trees.
- Fixed error in C parser and simplifier related to "for" loops with
complex expressions as condition.
- More benchmark programs in test/
Release 1.2, 2008-04-03
=======================
- First public release
|