aboutsummaryrefslogtreecommitdiffstats
path: root/x86
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2021-01-16 15:27:02 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2021-01-16 16:51:02 +0100
commit478ece46d8323ea182ded96a531309becf7445bb (patch)
treea5d79c607cbd8509ee5b25305daab483deef06bb /x86
parent6bef869040014b4d589a8e49b42ac36a970d1bc6 (diff)
downloadcompcert-kvx-478ece46d8323ea182ded96a531309becf7445bb.tar.gz
compcert-kvx-478ece46d8323ea182ded96a531309becf7445bb.zip
Support re-normalization of function parameters at function entry
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.
Diffstat (limited to 'x86')
-rw-r--r--x86/Conventions1.v7
1 files changed, 6 insertions, 1 deletions
diff --git a/x86/Conventions1.v b/x86/Conventions1.v
index 803d162a..e3c51f60 100644
--- a/x86/Conventions1.v
+++ b/x86/Conventions1.v
@@ -431,7 +431,7 @@ Proof.
unfold loc_arguments; destruct Archi.ptr64; auto; destruct Archi.win64; auto.
Qed.
-(** ** Normalization of function results *)
+(** ** Normalization of function results and parameters *)
(** In the x86 ABI, a return value of type "char" is returned in
register AL, leaving the top 24 bits of EAX unspecified.
@@ -444,3 +444,8 @@ Definition return_value_needs_normalization (t: rettype) : bool :=
| Tint8signed | Tint8unsigned | Tint16signed | Tint16unsigned => true
| _ => false
end.
+
+(** Function parameters are passed in normalized form and do not need
+ to be re-normalized at function entry. *)
+
+Definition parameter_needs_normalization (t: rettype) := false.