aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend
Commit message (Collapse)AuthorAgeFilesLines
* Commenting out __builtin_expect from AbsIntCyril SIX2021-06-011-2/+2
|
* [BROKEN] Merge with v3.9 : something broken for __builtin_expect in ↵Cyril SIX2021-06-0112-48/+68
| | | | cfrontend/C2C.ml
* Merge branch 'master' into merge_master_8.13.1Sylvain Boulmé2021-03-2315-251/+286
|\ | | | | | | | | | | | | | | | | PARTIAL MERGE (PARTLY BROKEN). See unsolved conflicts in: aarch64/TO_MERGE and riscV/TO_MERGE WARNING: interface of va_args and assembly sections have changed
| * Section handling: finer control of variable initializationXavier Leroy2021-02-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Distinguish between: - uninitialized variables, which can go in COMM if supported - variables initialized with fixed, numeric quantities, which can go in a readonly section if "const" - variables initialized with symbol addresses which may need relocation, which cannot go in a readonly section even if "const", but can go in a special "const_data" section. Also: on macOS, use ".const" instead of ".literal8" for literals, as not all literals have size 8.
| * Qualify `Hint` as `Global Hint` where appropriateXavier Leroy2021-01-211-4/+4
| | | | | | | | | | | | | | This avoids a new warning of Coq 8.13. Eventually these `Global Hint` should become `#[export] Hint`, with a cleaner but different meaning than `Global Hint`.
| * Support re-normalization of function parameters at function entryXavier Leroy2021-01-162-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is complementary to 28f235806 Some ABIs leave more flexibility concerning function parameters than CompCert expects. For instance, the AArch64/ELF ABI allow the caller of a function to leave unspecified the "padding bits" of function parameters. As an example, a parameter of type "unsigned char" may not have zeros in bits 8 to 63, but may have any bits there. When the caller is compiled by CompCert, it normalizes argument values to the parameter types before the call, so padding bits are always correct w.r.t. the type of the argument. This is no longer guaranteed in interoperability scenarios, when the caller is not compiled by CompCert. This commit adds a general mechanism to insert "re-normalization" conversions on the parameters of a function, at function entry. This is controlled by the platform-dependent function Convention1.return_value_needs_normalization. The semantic preservation proof is still conducted against the CompCert model, where the argument values of functions are already normalized. What the proof shows is that the extra conversions have no effect in this case. In future work we could relax the CompCert model, allowing functions to pass arguments that are not normalized.
| * Replace `omega` tactic with `lia`Xavier Leroy2020-12-2912-219/+222
| | | | | | | | | | | | | | | | | | | | | | Since Coq 8.12, `omega` is flagged as deprecated and scheduled for removal. Also replace CompCert's homemade tactics `omegaContradiction`, `xomega`, and `xomegaContradiction` with `lia` and `extlia`. Turn back on the deprecation warning for uses of `omega`. Make the proof of `Ctypes.sizeof_pos` more robust to variations in `lia`.
| * Changed cc_varargs to an option typeBernhard Schommer2020-12-254-10/+18
| | | | | | | | | | | | Instead of being a simple boolean we now use an option type to record the number of fixed (non-vararg) arguments. Hence, `None` means not vararg, and `Some n` means `n` fixed arguments followed with varargs.
* | Merge branch 'master' (Absint 3.8) into kvx-work-merge3.8David Monniaux2020-11-186-162/+214
|\|
| * Add -main option to specify entrypoint function in interpreter mode (#374)Xavier Leroy2020-10-301-1/+1
| | | | | | | | | | | | | | When running unit tests with the CompCert reference interpreter, it's nice to be able to start execution at a given test function instead of having to write a main function. This PR adds a -main command-line option to give the name of the entry point function. The default is still main. Frama-C has a similar option. The function specified with -main is called with no arguments. If its return type is int, its return value is the exit status of the program. Otherwise, its return value is ignored and the program exits with status 0.
| * Add __builtin_sqrt as synonymous for __builtin_fsqrtXavier Leroy2020-07-271-0/+2
| | | | | | | | __builtin_sqrt (no "f") is the name used by GCC and Clang.
| * Move declarations of __builtin_clz* and __builtin_ctz* to C2C.mlXavier Leroy2020-07-271-0/+12
| | | | | | | | These functions are now available on all targets.
| * Add support for __builtin_fabsfXavier Leroy2020-07-271-0/+2
| |
| * Move shared code in new file.Bernhard Schommer2020-06-281-1/+1
| | | | | | | | | | The name_of_register and register_of_name function are shared between all architectures and can be moved in a common file.
| * Remove the `can_reserve_register` function.Bernhard Schommer2020-06-281-1/+1
| | | | | | | | | | The function is in fact just a call to the function`is_callee_save_register` from `Conventions1.v`.
| * Improve printing of builtin function invocationsXavier Leroy2020-06-251-0/+3
| | | | | | | | In particular __builtin_sel.
| * SimplExpr: remove unused definition "sd_cast_set"Xavier Leroy2020-06-151-2/+0
| | | | | | | | Follow-up to commit 070babef.
| * SimplExpr: better translation of casts in a "for effects" contextXavier Leroy2020-06-153-136/+166
| | | | | | | | | | | | | | | | This is useful for statements such as `(void) expr;` where we would prefer not to explicitly compute intermediate values of type `void` and store them in Clight temporary variables. See issue #361 for a real-world occurrence of this phenomenon.
| * Move reserved_registers to CPragmas.Bernhard Schommer2020-04-201-1/+6
| | | | | | | | | | | | | | The list of reserved_registers is never reset between the compilation of multiple files. Instead of storing them in IRC they are moved in the CPragmas file and reset in the a new reset function for Cpragmas whic is called per file.
* | Merge remote-tracking branch 'origin/mppa-profiling' into mppa-featuresDavid Monniaux2020-04-121-0/+9
|\ \
| * | begin installing profilingDavid Monniaux2020-04-081-1/+1
| | |
| * | added EF_profilingDavid Monniaux2020-04-081-0/+9
| | |
* | | Merge remote-tracking branch 'origin/mppa-expect3' into mppa-workDavid Monniaux2020-04-099-45/+86
|\ \ \
| * | | expect operationDavid Monniaux2020-04-072-27/+35
| | | |
| * | | Oexpect in frontendDavid Monniaux2020-04-076-16/+47
| | | |
| * | | start implementing expect as exprDavid Monniaux2020-04-071-0/+1
| | | |
| * | | Merge remote-tracking branch 'origin/mppa-work' into mppa-expectDavid Monniaux2020-04-0611-124/+328
| |\| |
| * | | __builtin_expect defined as its first argumentDavid Monniaux2019-09-251-2/+3
| | | |
* | | | Merge remote-tracking branch 'origin/mppa-work' into mppa-threadDavid Monniaux2020-04-082-31/+46
|\ \ \ \ | | |/ / | |/| |
| * | | Merge remote-tracking branch 'origin/master' into attempt-fix-mppa-workCyril SIX2020-04-011-2/+2
| |\ \ \ | | | |/ | | |/|
| | * | Explicit error messages for ill-formed section attributes (#232)Bernhard Schommer2020-03-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an error message for section attributes with non string arguments,and another for multiple, ambiguous section attributes. This is more consistent with the handling of other attributes, like packed, than the old behavior of silently ignoring them.
| * | | fixed CSE2 for mppa_k1cDavid Monniaux2020-03-031-29/+44
| |\| | | | | | | | | | | | | | Merge branch 'dm-cse2-naive' of https://github.com/monniaux/CompCert into mppa-cse2
| | * | Define the semantics of `free(NULL)` (#226)Xavier Leroy2020-03-021-29/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to ISO C, `free(NULL)` is correct and does nothing. This commit updates accordingly the formal semantics of the `free` external function and the reference interpreter. Closes: #334
| * | | Merge branch 'mppa-cse2' of ↵David Monniaux2020-03-031-4/+36
| |\ \ \ | | |/ / | |/| | | | | | gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-work
* | | | Merge branch 'mppa-work' into mppa-threadCyril SIX2020-02-259-76/+232
|\ \ \ \
| * | | | Merge branch 'master' of https://github.com/AbsInt/CompCert into ↵David Monniaux2020-02-248-74/+229
| |\| | | | | | | | | | | | | | | | | | mppa-work-upstream-merge
| | * | | Support re-normalization of values returned by function callsXavier Leroy2020-02-212-33/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some ABIs leave more flexibility concerning function return values than CompCert expects. For example, the x86 ABI says that a function result of type "char" is returned in register AL, leaving the top 24 bits of register EAX unspecified, while CompCert expects EAX to contain 32 valid bits, namely the zero- or sign-extension of the 8-bit result. This commits adds a general mechanism to insert "re-normalization" conversions on the results of function calls. Currently, it only deals with results of small integer types, and inserts zero- or sign-extensions if so instructed by a platform-dependent function, Convention1.return_value_needs_normalization. The conversions in question are inserted early in the front-end, so that they can be optimized away in the back-end. The semantic preservation proof is still conducted against the CompCert model, where the return values of functions are already normalized. What the proof shows is that the extra conversions have no effect in this case. In future work we could relax the CompCert model, allowing functions to return values that are not normalized.
| | * | | Refine the type of function results in AST.signatureXavier Leroy2020-02-216-39/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before it was "option typ". Now it is a proper inductive type that can also express small integer types (8/16-bit unsigned/signed integers). One benefit is that external functions get more precise types that control better their return values. As a consequence, the CompCert C type preservation property now holds unconditionally, without extra typing hypotheses on external functions.
| | * | | More precise determination of small data accesses (#220)Bernhard Schommer2020-02-201-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can get linker errors for addresses of the form "symbol + offset" where "symbol" is in the small data area and "offset" is large enough to overflow the relative displacement from the SDA base register. To avoid this, this commit enriches `C2C.atom_is_small_data`, which is the implementation of `Asm.symbol_is_small_data` in the PPC port, with a check that the offset is within the bounds of the symbol. If it is not, `Asm.symbol_is_small_data` returns `false` and Asmgen produces an absolute addressing instead of a SDA-relative addressing. To implement the check, we record the sizes of symbols in the atom table, just like we already record their alignments.
| * | | | Merge branch 'master' of https://github.com/AbsInt/CompCert into ↵David Monniaux2020-02-132-2/+3
| |\| | | | | |/ / | |/| | | | | | mppa-work-upstream-merge
| | * | Take the sign into account for int to ptr cast.Bernhard Schommer2020-02-122-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Casting from an integer constant to pointer on 64 bit architectures did not take the signedness into account and always interpreted the integer as unsigned which causes some incompatibility with libc implementations.
* | | | thread local declarations now workDavid Monniaux2020-02-241-1/+5
| | | |
* | | | it now works, no more ugly hack to access thread local dataDavid Monniaux2020-02-241-0/+9
| | | |
* | | | seems to process _Thread_local but not till backendDavid Monniaux2020-02-241-7/+14
|/ / /
* | | Merge branch 'master' of https://github.com/AbsInt/CompCert into ↵David Monniaux2019-12-091-0/+5
|\| | | | | | | | | | | mppa-work-upstream-merge
| * | Fix for AArch64 alignment problem (#206)Bernhard Schommer2019-11-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | In addressing modes for load and store instructions, the offset must be a multiple of the memory size being accessed. When accessing global variables, this may not be the case if the alignment of the variable is less than its size. Errors occur at link time. This PR extends the check for a representable offset for the addressing of global variables to also check whether the variable is correctly aligned. Only if both conditions are met can we generate the short sequence Padrp / ADadr. Otherwise we go through the generic loadsymbol sequence.
* | | Merge tag 'v3.6' of https://github.com/AbsInt/CompCert into ↵David Monniaux2019-09-202-17/+45
|\| | | |/ |/| | | mppa-work-upstream-merge
| * -dclight output: use nicer names for temporary variablesXavier Leroy2019-09-161-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The temporary variables introduced by SimplLocals reuse the same integer identifiers as the local variables they come from. This commit ensures that these variables are printed as "$var", where "var" is the original variable name, instead of "$NNN" as before. The "$NNN" form is retained for temporary variables that do not correspond to a source-level local variable, such as the temporary variables introduced by SimplExpr. This commit should make no difference for "ccomp -dclight", because the Clight that is printed is the Clight version 1 produced by SimplExpr, where every temporary is fresh and does not correspond to a source-level local variable. This commit does change the output of "clightgen -dclight", because the Clight that is printed is the Clight version 2 produced by SimplLocals. The printed Clight is much more legible thanks to the more meaningful temporary variable names.
| * clightgen -dclight: print function parameters correctlyXavier Leroy2019-09-162-15/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | The Clight output of clightgen is Clight version 2, after SimplLocals conversion, where function parameters are temporary variables, not variables. This commit makes sure the function parameters are printed as temporary variables and not as variables. In passing, it generalizes the Clight pretty-printer so that it can print both Clight version 1 and Clight version 2. Closes: #314
* | Merge branch 'master' of https://github.com/AbsInt/CompCert into ↵David Monniaux2019-08-285-14/+17
|\| | | | | | | mppa-work-upstream-merge