aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into cleanupBernhard Schommer2016-03-2123-989/+1493
|\
| * Merge pull request #93 from AbsInt/separate-compilationXavier Leroy2016-03-2018-649/+1093
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pull request implements "approach A" to separate compilation in CompCert from the paper Lightweight verification of separate compilation by Jeehoon Kang, Yoonseung Kim, Chung-Kil Hur, Derek Dreyer, Viktor Vafeiadis, POPL 2016, pages 178-190 In a nutshell, semantic preservation is still stated and proved in terms of a whole C program and a whole assembly program. However, the whole C program can be the result of syntactic linking of several C compilation units, each unit being separated compiled by CompCert to produce assembly unit, and these assembly units being linked together to produce the whole assembly program. This way, the statement of semantic preservation and its proof now take into account the fact that each compilation unit is compiled separately, knowing only a fragment of the whole program (i.e. the current compilation unit) rather than the whole program.
| | * Update the proofs of the C front-end to the new linking framework.Xavier Leroy2016-03-0611-533/+559
| | |
| | * Define linking for Csyntax and Clight programs.Xavier Leroy2016-03-063-114/+523
| | | | | | | | | | | | Also: factor out the type "program" between Csyntax and Clight, putting it in Ctypes.
| | * Add support for EF_runtime externalsXavier Leroy2016-03-064-2/+11
| | | | | | | | | | | | Also: in Events, use Senv.equiv to state invariance wrt changes of global envs.
| * | Print floating-point numbers with more digits in debug outputsXavier Leroy2016-03-152-6/+6
| | | | | | | | | | | | | | | | | | As suggested in GPR#84, use '%.15F' to force the printing of more significant digits. (The '%F' format previously used prints only 6.) This is enough to represent the FP number exactly most of the time (but not always). Once OCaml 4.03 is out and CompCert switches to this version of OCaml, we'll be able to use hexadecimal floats for printing.
| * | Merge pull request #90 from AbsInt/sem-castsXavier Leroy2016-03-1114-323/+368
| |\ \ | | | | | | | | Make casts of pointers to _Bool semantically well defined
| | * | Make casts of pointers to _Bool semantically well defined (again).Xavier Leroy2016-03-0214-323/+368
| | |/ | | | | | | | | | | | | | | | In compCert 2.5 the semantics of pointer comparisons against the NULL pointer was made more accurate by making it undefined if the pointer is invalid (outside bounds). Technical difficulties prevented this change from being propagated to the semantics of casts from pointer types to the _Bool type, which involves an implicit pointer comparison against NULL. Hence, this kind of casts was temporarily given undefined semantics. This commit makes pointer-to-_Bool casts semantically defined (again), provided the pointer is valid. This reinstates the equivalence between casts to _Bool and comparisons != 0. The technical difficulties mentioned above came from the translation of assignments in a value context in the SimplExpr pass. The pass was lightly modified to work around the issue.
| * / Relaxing the semantics of pointer arithmetic.Xavier Leroy2016-02-291-6/+21
| |/ | | | | | | | | | | Support <pointer> +/- <integer> where the pointer value is actually an integer (Vint) that has been converted to pointer type. Such arithmetic, while not defined in ISO C, appears in the wild. If present in static initializers, it used to cause a compile-time failure ("not a compile-time constant"). Hence this relaxation.
* | Removed not needed env.Bernhard Schommer2016-03-151-5/+5
| | | | | | | | | | | | The functions for naming string and wstring literals no longer need an env. Bug 18394
* | Deactivate warning 27 and added back removed code.Bernhard Schommer2016-03-153-38/+38
| | | | | | | | | | | | The code was mostly there for documentation effort. So warning 27 is deactivated again. Bug 18349
* | Revert "Removed unused parameter from is_small/rel_data."Bernhard Schommer2016-03-151-3/+3
| | | | | | | | This reverts commit bac2a0854ea51217690bc6f225da62053ed7ac06.
* | Removed unused parameter from is_small/rel_data.Bernhard Schommer2016-03-111-3/+3
| | | | | | | | | | | | The ofs parameter is no longer used. Adopted the proofs and ml code using it. Bug 18394
* | Code cleanup.Bernhard Schommer2016-03-103-102/+93
|/ | | | | | Removed some unused variables, functions etc. and resolved some problems which occur if all warnings except 3,4,9 and 29 are active. Bug 18394.
* Restart the name generator at first_unused_ident for every function.Xavier Leroy2016-02-053-58/+38
| | | | This makes it easier to generate semi-meaningful names for compiler-generated temporaries in the clightgen tool.
* Revise and simplify the -fstruct-return and -fstruct-passing options.Xavier Leroy2015-12-081-11/+18
| | | | | | - Rename '-fstruct-return' into '-fstruct-passing', because this emulation affects both function result passing and function argument passing. Keep '-fstruct-return' as a deprecated synonymous for '-fstruct-passing' - Remove the ability to change the ABI for struct passing via the '-fstruct-passing=<abi>' and '-fstruct-return=<abi>' command-line flags. This was more confusing than useful. - Produce an error if a struct/union is passed as function argument and '-fstruct-passing' is not set. This used to be supported, using CompCert's default ABI for passing struct arguments. However, this default ABI does not match any of the standard ABIs of our target platforms, so it is better to reject than to silently produce ABI-incompatible code.
* Handle large static initializers for global arraysXavier Leroy2015-11-093-118/+205
| | | | Use tail-recursive operations to implement transformations on initializers for global arrays. This way, very large static initializers no longer cause stack overflows at compile-time.
* Fix for switch was to eager.Bernhard Schommer2015-11-061-6/+8
| | | | | | We should not remove any debug stmt inside of the cases. We should just not warn in the case that init is only debugcalls. Bug 17850
* Remove debug stmts during grouping of switch.Bernhard Schommer2015-11-061-3/+5
| | | | | | | Debug statements introduced during the translation result in warnings when they are introduced at the head of the switch. Since they are not used and the warning is not necessary we can remove them before. Fix 17580.
* Added printing functions for debug annotations.Bernhard Schommer2015-11-061-0/+3
| | | | | | Instead of printing <unknown builtin> we now print the debug annotations. Fix 17581.
* Merge remote-tracking branch 'origin/master' into named-externalsBernhard Schommer2015-10-201-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: arm/TargetPrinter.ml backend/CMparser.mly backend/SelectLongproof.v backend/Selectionproof.v cfrontend/C2C.ml checklink/Asm_printers.ml checklink/Check.ml checklink/Fuzz.ml common/AST.v debug/DebugInformation.ml debug/DebugInit.ml debug/DwarfPrinter.ml debug/DwarfTypes.mli debug/Dwarfgen.ml exportclight/ExportClight.ml ia32/TargetPrinter.ml powerpc/Asm.v powerpc/SelectOpproof.v powerpc/TargetPrinter.ml
| * bug 17392: remove trailing whitespace in source filesMichael Schmidt2015-10-1420-1989/+1989
| |
| * bug 17392: remove trailing whitespace in source filesMichael Schmidt2015-10-143-41/+41
| |
| * Unified function for adding the atom identifier.Bernhard Schommer2015-10-121-2/+2
| | | | | | | | | | | | | | Instead of defining two functions for adding the mapping from atom to debug id we use one function which then sets the corresponding values. Bug 17392.
* | Updated PR by removing whitespaces. Bug 17450.Bernhard Schommer2015-10-2023-2030/+2030
| |
* | Use Coq strings instead of idents to name external and builtin functions.Xavier Leroy2015-10-113-14/+15
|/ | | | | | | | | | The AST.ident type represents source-level identifiers as unique positive numbers. However, the mapping identifiers <-> AST.ident differs between runs of CompCert on different source files. This is problematic when we need to produce or recognize external functions and builtin functions with fixed names, for example: * in $ARCH/Machregs.v to define the register conventions for builtin functions; * in the VST program logic from Princeton to treat thread primitives specially. So far, we used AST.ident_of_string to recover the ident associated with a string. However, this function is defined in OCaml and doesn't execute within Coq. This is a problem both for VST and for future executability of CompCert within Coq. This commit replaces "ident" by "string" in the arguments of EF_external, EF_builtin, EF_inline_asm, EF_annot, and EF_annot_val. This provides stable names for externals and builtins, as needed. For inline asm and annotations, it's a matter of taste, but using strings feels more natural. EF_debug keeps using idents, since some kinds of EF_debug annotations talk about program variables.
* Fixed minor issue with parameters that get put on the stack, madeBernhard Schommer2015-09-301-4/+6
| | | | the code more robust and added indentation for convertCompositeDef
* Added location for the formal parameters and move the end of allBernhard Schommer2015-09-281-0/+1
| | | | scopes before the last statement.
* Merge branch 'debugscopes' into debug_locationsBernhard Schommer2015-09-212-41/+39
|\ | | | | | | | | | | Conflicts: debug/CtoDwarf.ml debug/DwarfPrinter.ml
| * Experiment: track the scopes of local variables via __builtin_debug.Xavier Leroy2015-09-201-38/+36
| | | | | | | | | | | | | | | | | | | | | | C2C: the code that insert debug builtins with the line numbers is now in Unblock. Handle calls to __builtin_debug. Unblock: generate __builtin_debug(1) for line numbers, carrying the list of active scopes as extra arguments. Generate __builtin_debug(6) for local variable declarations, carrying the corresponding scope number as extra argument. Constprop: avoid duplicating debug arguments that are constants already. PrintAsmaux: show this extra debug info as comments.
| * Ctypes.composite_of_def: make sure it computes within Coq.Xavier Leroy2015-09-181-3/+3
| | | | | | | | (Suggested by A. Appel.)
* | Started implementing the scope for the Debug Informations.Bernhard Schommer2015-09-181-0/+1
| | | | | | | | | | | | Scopes will be handled by a stack of all open scopes. This stack then can also be used to generate the debug directives to track the scopes through the rest of the passes.
* | First version with computation of dwarf info from debug info.Bernhard Schommer2015-09-171-1/+1
| | | | | | | | | | Introduced a new dwarf generation from the information collected in the DebugInformation and removed the old CtODwarf translation.
* | Move more functionality in the new interface.Bernhard Schommer2015-09-161-4/+7
| | | | | | | | | | | | Added functions to add more information to the debuging interface, like the struct layout with offsets, bitifiled layout and removed the no longer needed mapping from stamp to atom.
* | XBernhard Schommer2015-09-064-77/+215
|\| | | | | | | Merge branch 'master' into debug_locations
| * Track the locations of local variables using EF_debug annotations.Xavier Leroy2015-08-232-26/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SimplLocals: - record locations of stack-allocated variables with annotations (of kind 5) at the beginning of the function; - mark every assignment to non-stack-allocated variables with an annotation of kind 2. Debugvar: (new pass!) - perform availability analysis for debug annotations of kind 2 - insert "start of live range" and "end of live range" annotations (kind 3 and 4) to delimit intervals of PCs where the location of a local variable is known.
| * Renaming {BA,BR}_longofwords -> {BA,BR}_splitlong.Xavier Leroy2015-08-221-1/+1
| | | | | | | | | | | | | | | | Use EF_debug instead of EF_annot for line number annotations. Introduce PrintAsmaux.print_debug_info (very incomplete). powerpc/Asmexpand: revise expand_memcpy_small.
| * Refactoring of builtins and annotations in the back-end.Xavier Leroy2015-08-211-50/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the back-end languages had distinct instructions - Iannot for annotations, taking structured expressions (annot_arg) as arguments, and producing no results' - Ibuiltin for other builtins, using simple pseudoregs/locations/registers as arguments and results. This branch enriches Ibuiltin instructions so that they take structured expressions (builtin_arg and builtin_res) as arguments and results. This way, - Annotations fit the general pattern of builtin functions, so Iannot instructions are removed. - EF_vload_global and EF_vstore_global become useless, as the same optimization can be achieved by EF_vload/vstore taking a structured argument of the "address of global" kind. - Better code can be generated for builtin_memcpy between stack locations, or volatile accesses to stack locations. Finally, this commit also introduces a new kind of external function, EF_debug, which is like EF_annot but produces no observable events. It will be used later to transport debug info through the back-end, without preventing optimizations.
* | Added symbol functions for printing of the location for global variables.Bernhard Schommer2015-08-211-2/+8
|/
* Tighten and prove correct the underflow/overflow bounds for parsing of FP ↵Xavier Leroy2015-07-061-41/+29
| | | | | | | | | literals. This is a follow-up to commit 350354c. - Move Float.build_from_parsed to Fappli_IEEE_extra.Bparse - Add early checks for overflow and underflow and prove them correct. - Improve speed of Bparse by using a fast exponentiation (square-and-multiply).
* Added a fast test for too large exponents too avoid never ending computations.Bernhard Schommer2015-07-031-29/+42
|
* Merge branch 'master' of https://github.com/AbsInt/CompCertXavier Leroy2015-06-301-1/+26
|\
| * Check also the discarded part of the switch statements for cases outside of ↵Bernhard Schommer2015-06-261-1/+26
| | | | | | | | an switch to bail out on earlier on unstructured switch.
* | Signedness issue in specification of subtraction between two pointers.Xavier Leroy2015-06-303-6/+19
|/
* In AST.calling_conventions, record whether the original C function was ↵Xavier Leroy2015-05-223-20/+24
| | | | | | "old-style" unprototyped. Use this info in printing function types for Csyntax and Clight.
* Missing case in type_conditional (long long vs. int or float).Xavier Leroy2015-05-221-6/+3
|
* Ctyping: better typing of conditional expressions.Xavier Leroy2015-05-213-50/+200
| | | | | | | | | | | | Ctyping: define a typechecker for whole programs. Csyntax: introduce the type "pre-program" (non-dependent). C2C: use Ctyping.econdition instead of Ctyping.econdition'. Note: Ctyping.typecheck_program could be used as the first step in the verified compilation pipeline. Then, retyping would no longer be performed in C2C. We keep it this way (for the time being) because retyping errors are reported more precisely in C2C than in Ctyping.
* Extended inline asm: revised treatment of clobbered registers.Xavier Leroy2015-05-092-3/+3
| | | | | | | | | | - Treat clobbered registers as being destroyed by EF_inline_asm builtins (which is the truth, semantically). - To enable the above, represent clobbers as Coq strings rather than idents and move register_by_name from Machregsaux.ml to Machregs.v. - Side benefit: more efficient implementation of Machregsaux.name_of_register. -# Please enter the commit message for your changes. Lines starting
* Long-overdue renaming: val_inject -> Val.inject, etc, for consistency with ↵Xavier Leroy2015-04-304-80/+80
| | | | Val.lessdef, etc.
* Warn if a nonzero FP literal converts to infinity (overflow) or to 0 ↵Xavier Leroy2015-04-251-3/+17
| | | | | | (underflow). Also: spurious '\n' in C2C.warning.