aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend/Ctyping.v
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-06-29 08:27:14 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-06-29 08:27:14 +0000
commit9c7c84cc40eaacc1e2c13091165785cddecba5ad (patch)
tree65eafe51ad284d88fd5a949e1b2a54cd272f9f91 /cfrontend/Ctyping.v
parentf4b416882955d9d91bca60f3eb35b95f4124a5be (diff)
downloadcompcert-kvx-9c7c84cc40eaacc1e2c13091165785cddecba5ad.tar.gz
compcert-kvx-9c7c84cc40eaacc1e2c13091165785cddecba5ad.zip
Support for inlined built-ins.
AST: add ef_inline flag to external functions. Selection: recognize calls to inlined built-ins and inline them as Sbuiltin. CminorSel to Asm: added Sbuiltin/Ibuiltin instruction. PrintAsm: adapted expansion of builtins. C2Clight: adapted detection of builtins. Conventions: refactored in a machine-independent part (backend/Conventions) and a machine-dependent part (ARCH/SYS/Conventions1). git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1356 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cfrontend/Ctyping.v')
-rw-r--r--cfrontend/Ctyping.v18
1 files changed, 12 insertions, 6 deletions
diff --git a/cfrontend/Ctyping.v b/cfrontend/Ctyping.v
index b147fbda..8e089f16 100644
--- a/cfrontend/Ctyping.v
+++ b/cfrontend/Ctyping.v
@@ -155,8 +155,10 @@ Inductive wt_fundef: typenv -> fundef -> Prop :=
| wt_fundef_Internal: forall env f,
wt_function env f ->
wt_fundef env (Internal f)
- | wt_fundef_External: forall env id args res,
- wt_fundef env (External id args res).
+ | wt_fundef_External: forall env ef args res,
+ (ef_sig ef).(sig_args) = typlist_of_typelist args ->
+ (ef_sig ef).(sig_res) = opttyp_of_type res ->
+ wt_fundef env (External ef args res).
Definition add_global_var
(env: typenv) (id_v: ident * globvar type) : typenv :=
@@ -410,8 +412,12 @@ Qed.
Definition typecheck_fundef (main: ident) (env: typenv) (id_fd: ident * fundef) : bool :=
let (id, fd) := id_fd in
match fd with
- | Internal f => typecheck_function env f
- | External _ _ _ => true
+ | Internal f =>
+ typecheck_function env f
+ | External ef targs tres =>
+ let s := ef_sig ef in
+ list_eq_dec typ_eq s.(sig_args) (typlist_of_typelist targs)
+ && opt_typ_eq s.(sig_res) (opttyp_of_type tres)
end &&
if ident_eq id main
then match type_of_fundef fd with
@@ -430,8 +436,8 @@ Proof.
intros. unfold typecheck_fundef in H; TrueInv.
split.
destruct fd.
- constructor. apply typecheck_function_correct; auto.
- constructor.
+ constructor. apply typecheck_function_correct; auto.
+ TrueInv. constructor; eapply proj_sumbool_true; eauto.
intro. destruct (ident_eq id main).
destruct (type_of_fundef fd); try discriminate.
exists t; decEq; auto. apply eq_type_correct; auto.