aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* If-conversion optimization for Cminorconditional-moveXavier Leroy2019-05-265-3/+1433
| | | | | | | | | | | | | | | | | | | | Add an experimental pass that converts some if/then/else statements into "select" built-ins, which in turn can be compiled down to branchless instruction sequences if the target architecture supports them. The statements that are converted are of the form if (cond) { x = a1; } else { x = a2; } if (cond) { x = a1; } if (cond) { /*skip*/; } else { x = a2; } where a1, a2 are "safe" expressions, containing no operations that can fail at run-time, such as memory loads or integer divisions. To support the optimization, I added a type inference and type checking pass for Cminor, in backend/Cminortyping.v. The inferred type information is used to determine the type at which the "select" built-in operates, and to prove semantic preservation.
* Show determinacy of Cminor semanticsXavier Leroy2019-05-261-0/+64
|
* New forward simulation diagrams for determinate source languagesXavier Leroy2019-05-261-0/+96
| | | | Determinacy makes it possible to take multiple steps on the source side.
* Add selection to CompCert C as a derived formXavier Leroy2019-05-263-0/+81
| | | | | | | | | | `Eselection r1 r2 r3 ty` is like `Econdition r1 r2 r3 ty`, except that both `r2` and `r3` are always evaluated, thus the expression can be compiled down to a conditional move. Internally, `Eselection` is expressed as a call to the built-in `EF_select`. We prove admissible evaluation rules, showing that the encoding gives the expected semantics.
* Add a built-in function for "select" (strict conditional)Xavier Leroy2019-05-2612-31/+216
| | | | | | | | The built-in is called `EF_select` and has type `(int, T, T) -> T` for a given Cminor type T. During instruction selection, it is turned into an `Osel` operation if available, otherwise into an if/then/else.
* PowerPC: add SelectOp.select functionXavier Leroy2019-05-262-0/+31
| | | | | This function and its proof should have been part of commit 43e7b67. They are already there for the other ports.
* ARM: Fix expansion of FP conditional moveXavier Leroy2019-05-261-2/+2
| | | | | The "vmov" instruction (Advanced SIMD) cannot be conditional. The "vmov.f64" instruction (VFPv2) can be conditional.
* Coq 8.9.1 supportXavier Leroy2019-05-211-3/+3
| | | | It works fine with the current sources.
* Csyntax.v: Fix a typo in a documentation comment (#292)Bart Jacobs2019-05-211-1/+1
|
* Add a check for the args of unprototyped calls.Bernhard Schommer2019-05-201-3/+8
| | | | | | The arguments that are passed to an unprototyped function must also be checked to be valid types passed to a function, i.e. they must be complete types after argument conversion.
* Provide a default "select" operation for the RiscV portXavier Leroy2019-05-202-0/+20
| | | | | No `Osel` operation for this port, so `SelectOp.select` always returns None.
* Implement a `Osel` operation for ARMXavier Leroy2019-05-2012-7/+115
| | | | | The operation comples down to conditional moves. Both integer and floating-point conditional moves are supported.
* Implement a `Osel` operation for x86Xavier Leroy2019-05-2011-38/+298
| | | | The operation compiles down to conditional moves.
* Emulate the "isel" instruction on non-EREF PPC processorsXavier Leroy2019-05-203-22/+42
| | | | | On non-EREF processors it expands to instructions that destroy GPR0. Reflect this in the Asm semantics for Pisel.
* Implement a `Osel` operation for PowerPCXavier Leroy2019-05-207-9/+106
| | | | | This operation compiles down to an `isel` instruction (conditional move). The semantics is given by `Val.select`.
* Give a semantics to the Pisel instructionXavier Leroy2019-05-201-1/+7
|
* Support a "select" operation between two valuesXavier Leroy2019-05-203-0/+212
| | | | | | | | | | `Val.select ob v1 v2 ty` is a conditional operation that chooses between the values `v1` and `v2` depending on the comparison `ob : option bool`. If `ob` is `None`, `Vundef` is returned. If the selected value does not match type `ty`, `Vundef` is returned. This operation will be used to model a "select" (or "conditional move") operation at the CminorSel/RTL/LTL/Mach level.
* PowerPC: make sure evaluation of conditions do not destroy any registerXavier Leroy2019-05-204-54/+155
| | | | | | | | | | | | | | | This will be useful to implement a "select" (conditional move) operation later. - Introduce `Asmgen.loadimm64_notemp` to load a 64-bit integer constant into a register without going through memory and without needing a temporary register. - Use `Asmgen.loadimm64_notemp` instead of `Asmgen.loadimm64` in the compilation of conditions, so that GPR12 is no longer needed as a temporary. - Share code and proofs common to the two `Asmgen.loadimm64_` functions as the `Asmgen.loadimm64_32s` function.
* Prepend $(DESTDIR) to the installation target (#169)Bernhard Schommer2019-05-172-16/+16
| | | | | | | | Following the gnu Makefile Conventions the variable $(DESTDIR) should be prepended to all installation commands. This allows staged installs.
* Reworked elaboration of declarations/definitions.Bernhard Schommer2019-05-101-140/+138
| | | | | | | | | | | | Since a definition/declaration is completed with after the separator to the next init group member it is also possible to use it for example in the next init group member: char s[]="miaou", buf[sizeof s]; In order to ensure that this works the declarations are added to the environment directly during the elaboration of the init member group instead of later.
* Added options -fcommon and -fno-common (#164)Bernhard Schommer2019-05-108-15/+41
| | | | | | | | | | The option -fcommon controls whether uninitialized global variables are placed in the COMMON section. If the option is given in the negated form, -fno-common, variables are not placed in the COMMON section. They are placed in the same sections as gcc does. If the variables are not placed in the COMMON section merging of tentative definitions is inhibited and multiple definitions lead to a linker error, as it does for gcc.
* Change to AbsInt version string.Bernhard Schommer2019-05-105-6/+6
| | | | | The AbsInt build number no longer contains "release", so it must be printed additionally.
* Check for reserved keywords.Bernhard Schommer2019-05-101-1/+8
| | | | | | `_Complex` and `_Imaginary` are reserved keywords. Since CompCert does not support these types they could be used as identifiers. However the standard requires to reject this.
* Fix various scoping issues (#163)Bernhard Schommer2019-05-101-51/+56
| | | | | | | | | Pass the environment to all expr eval functions since the functions themselve may be called recursively and modify the environment. The other change introduces new scopes that are strict subsets of their surrounding scopes for if, switch, while, do and for statement, as prescribed by ISO C standards.
* Ensure flushing of the error formatter.Bernhard Schommer2019-05-101-0/+4
| | | | | Since the error formatter is not automatically flushed at program exit we need to ensure that it is flushed at exit.
* Expand the responsefiles earlierBernhard Schommer2019-05-105-17/+17
| | | | | | | | | * Move the expansion of response files to module Commandline, during the initialization of `Commandline.argv`. This way we're sure it's done exactly once. * Make `Commandline.argv` a `string array` instead of a `string array ref`. We no longer need to update it after initialization! * Improve reporting of errors during expansion of response files.
* Check for alignment of command-line switches.Bernhard Schommer2019-05-102-6/+10
| | | | | | Add a check for alignment on command-line switches `-falign-*`. The check is similar to the one for the alignment attribute and ensures that only powers of two can be specified.
* More efficient test for powers of twoXavier Leroy2019-05-092-26/+105
| | | | | | The previous implementation used to build the full powers-of-two decomposition of the number. The present implementation recognizes powers of two directly, then takes the log2.
* Make scripts compatible with new behavior of field_simplify (#291)Vincent Laporte2019-05-062-3/+3
| | | | | | | | The `field_simplify` tactics will be improved soon (https://github.com/coq/coq/pull/9854). Flocq was made compatible with this improvement (https://gitlab.inria.fr/flocq/flocq/commit/0752761a6a344d62f6bc728eac442ebb4ba655ac). This commit updates CompCert's copy of Flocq accordingly.
* Rename Fappli_IEEE_extra.v into IEEE754_extra.vXavier Leroy2019-04-263-2/+2
| | | | | To match the new module names from version 3 of Flocq. Plus, it's shorter.
* Move Z definitions out of Integers and into ZbitsXavier Leroy2019-04-2613-884/+1031
| | | | | | | | | | The module Integers.Make contained lots of definitions and theorems about Z integers that were independent of the word size. These definitions and theorems are useful outside Integers.Make, but it felt unnatural to fetch them from modules Int or Int64. This commit moves the word-size-independent definitions and theorems to a new module, lib/Zbits.v, and fixes their uses in the code base.
* lib/Coqlib.v: remove defns about multiplication, division, modulusXavier Leroy2019-04-2315-135/+52
| | | | | Instead, use definitions and lemmas from the Coq standard library (ZArith, Znumtheory).
* Replace nat_of_Z with Z.to_natXavier Leroy2019-04-2311-68/+45
| | | | | | | Use Z.to_nat theorems from the standard Coq library in preference to our theorems in lib/Coqlib.v. Simplify lib/Coqlib.v accordingly.
* Problems with Dwarf ranges (#159)Xavier Leroy2019-04-239-56/+96
|\ | | | | | | Merge of branch dwarf-ranges
| * Simplified offset printing.Bernhard Schommer2019-04-161-2/+3
| | | | | | | | | | | | | | Instead of printing an the start label and adding the offset by computing the difference of the range label and the start label use the range label directly. Bug 26234
| * Print only debug info for printed functions.Bernhard Schommer2019-04-166-14/+18
| | | | | | | | | | | | | | | | | | | | | | Functions that are removed from the compilation unit, for example inline functions without extern, should not produce debug information. This commit reuses the mechanism used for variables in order to track additionally the printed functions. Therefore the printed variable versions are exchanged for a printed symbol version. Bug 26234
| * Reworked range entries.Bernhard Schommer2019-04-163-39/+71
| | | | | | | | | | | | | | | | | | | | | | | | The fist changes changes the offset for range entries to used labels instead of integer constants, leaving the computation to the assembler. The second part of the change the address changes the way ranges entries of scopes are printed. They need to be relative to the start address of the code in the section they are included. Bug 26234
| * Reset scope ids later.Bernhard Schommer2019-04-161-1/+1
| | | | | | | | | | | | | | In order to avoid adding ranges to the wrong scopes due to inlining they are numbered consecutively for the whole compilation unit. Bug 26234
| * Avoid generation of empty ranges.Bernhard Schommer2019-04-161-1/+4
| | | | | | | | | | | | As noted in the DWARF 3 specification empty ranges have no effect and can be left out. Bug 26234
| * Relax requirement for ranges for compilation unit.Bernhard Schommer2019-04-161-1/+1
|/ | | | | | Ranges for non-contiguous address ranges are already part of dwarf version 3. Bug 26234
* Typo in comment about Ijumptable in RTL.vAlix Trieu2019-04-151-1/+1
|
* Fix typo in section name in Selectionproof.v Alix Trieu2019-04-151-2/+2
| | | SEL_SWITH_INT -> SEL_SWITCH_INT
* Floats.v: remove leftover Print commandsXavier Leroy2019-04-041-5/+1
| | | | These were committed by mistake.
* Floats.v: avoid using module Zlogarithm in the proofsXavier Leroy2019-04-031-10/+19
| | | | | | | | Rumor has it that this module is scheduled for removal. This is based on pull request #286, with a different implementation. Closes: #286
* Correct typo in Clightnorm.ml (#285)Alix Trieu2019-03-271-1/+1
| | | | In the `Sswitch` case, the original expression was used instead of the result of `norm_expr`.
* Ignore more of Coq's cache filesXavier Leroy2019-03-271-1/+4
| | | | | A grep through Coq's source files show that it uses more cache files than just .lia.cache. Ignore them all.
* Upgrade embedded version of Flocq to 3.1.Guillaume Melquiond2019-03-2746-7841/+9954
| | | | | | | | | | | | Main changes to CompCert outside of Flocq are as follows: - Minimal supported version of Coq is now 8.7, due to Flocq requirements. - Most modifications are due to Z2R being dropped in favor of IZR and to the way Flocq now handles NaNs. - CompCert now correctly handles NaNs for the Risc-V architecture (hopefully).
* Define macros with CompCert's version number (#284)Xavier Leroy2019-03-271-2/+24
| | | | | | | | | | | | | | | | As suggested in #282, it can be useful to #ifdef code depending on specific versions of CompCert. Assuming a version number of the form MM.mm , the following macros are predefined: __COMPCERT_MAJOR__=MM (the major version number) __COMPCERT_MINOR__=mm (the minor version number) __COMPCERT_VERSION__=MMmm (two decimal digits for the minor, e.g. 305 for version 3.5) We also define __COMPCERT_BUILDNR__ if the build number is not empty in file ./VERSION. Closes: #282
* Harden configure against weird Menhir installationsXavier Leroy2019-03-251-2/+8
| | | | | | | | | | | As reported in #281, the Menhir packages in Fedora 29 and perhaps in other distributions can cause `menhir --suggest-menhirLib` to fail and return an empty path. This commit detects this situation and aborts configurations. Also, it hardens the generated Makefile against spaces and special characters in the path returned by `menhir --suggest-menhirLib`.
* RTLgenproof: destruct too deepXavier Leroy2019-03-251-2/+2
| | | | | | | `external_call_mem_extends` returns a conjunction of 4 properties, but the destruct pattern was 5 level deep. (Reported by Jeremie Koenig in pull request #278.)