summaryrefslogtreecommitdiff
path: root/common/AST.v
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-02-24 09:01:28 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-02-24 09:01:28 +0000
commit202bc495442a1a8fa184b73ac0063bdbbbcdf846 (patch)
tree46c6920201b823bf47252bc52864b0bf60f3233e /common/AST.v
parentf774d5f2d604f747e72e2d3bb56cc3f90090e2dd (diff)
Constant propagation within __builtin_annot.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2126 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'common/AST.v')
-rw-r--r--common/AST.v18
1 files changed, 15 insertions, 3 deletions
diff --git a/common/AST.v b/common/AST.v
index d2065d6..44811b2 100644
--- a/common/AST.v
+++ b/common/AST.v
@@ -443,7 +443,7 @@ Inductive external_function : Type :=
Produces no observable event. *)
| EF_memcpy (sz: Z) (al: Z)
(** Block copy, of [sz] bytes, between addresses that are [al]-aligned. *)
- | EF_annot (text: ident) (targs: list typ)
+ | EF_annot (text: ident) (targs: list annot_arg)
(** A programmer-supplied annotation. Takes zero, one or several arguments,
produces an event carrying the text and the values of these arguments,
and returns no value. *)
@@ -451,15 +451,27 @@ Inductive external_function : Type :=
(** Another form of annotation that takes one argument, produces
an event carrying the text and the value of this argument,
and returns the value of the argument. *)
- | EF_inline_asm (text: ident).
+ | EF_inline_asm (text: ident)
(** Inline [asm] statements. Semantically, treated like an
annotation with no parameters ([EF_annot text nil]). To be
used with caution, as it can invalidate the semantic
preservation theorem. Generated only if [-finline-asm] is
given. *)
+with annot_arg : Type :=
+ | AA_arg (ty: typ)
+ | AA_int (n: int)
+ | AA_float (n: float).
+
(** The type signature of an external function. *)
+Fixpoint annot_args_typ (targs: list annot_arg) : list typ :=
+ match targs with
+ | nil => nil
+ | AA_arg ty :: targs' => ty :: annot_args_typ targs'
+ | _ :: targs' => annot_args_typ targs'
+ end.
+
Definition ef_sig (ef: external_function): signature :=
match ef with
| EF_external name sg => sg
@@ -471,7 +483,7 @@ Definition ef_sig (ef: external_function): signature :=
| EF_malloc => mksignature (Tint :: nil) (Some Tint)
| EF_free => mksignature (Tint :: nil) None
| EF_memcpy sz al => mksignature (Tint :: Tint :: nil) None
- | EF_annot text targs => mksignature targs None
+ | EF_annot text targs => mksignature (annot_args_typ targs) None
| EF_annot_val text targ => mksignature (targ :: nil) (Some targ)
| EF_inline_asm text => mksignature nil None
end.