aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-04-17 16:30:43 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2015-04-17 16:30:43 +0200
commit1b5db339bb05f773a6a132be4c0b8cea54d50461 (patch)
tree5c7c767bc107eca66fdf6795777821572c5ec5af /common
parent3d751c114fe4611a5b72e160127be09cf6c6cfec (diff)
downloadcompcert-kvx-1b5db339bb05f773a6a132be4c0b8cea54d50461.tar.gz
compcert-kvx-1b5db339bb05f773a6a132be4c0b8cea54d50461.zip
Experiment: support a subset of GCC's extended asm statements.
Diffstat (limited to 'common')
-rw-r--r--common/AST.v6
-rw-r--r--common/Events.v8
-rw-r--r--common/PrintAST.ml2
3 files changed, 8 insertions, 8 deletions
diff --git a/common/AST.v b/common/AST.v
index d2926178..1e1e2b9d 100644
--- a/common/AST.v
+++ b/common/AST.v
@@ -584,7 +584,7 @@ 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) (sg: signature).
(** 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
@@ -606,7 +606,7 @@ Definition ef_sig (ef: external_function): signature :=
| EF_memcpy sz al => mksignature (Tint :: Tint :: nil) None cc_default
| EF_annot text targs => mksignature targs None cc_default
| EF_annot_val text targ => mksignature (targ :: nil) (Some targ) cc_default
- | EF_inline_asm text => mksignature nil None cc_default
+ | EF_inline_asm text sg => sg
end.
(** Whether an external function should be inlined by the compiler. *)
@@ -624,7 +624,7 @@ Definition ef_inline (ef: external_function) : bool :=
| EF_memcpy sz al => true
| EF_annot text targs => true
| EF_annot_val text targ => true
- | EF_inline_asm text => true
+ | EF_inline_asm text targs => true
end.
(** Whether an external function must reload its arguments. *)
diff --git a/common/Events.v b/common/Events.v
index 15bf4e12..62765fd3 100644
--- a/common/Events.v
+++ b/common/Events.v
@@ -1449,10 +1449,10 @@ Axiom external_functions_properties:
(** We treat inline assembly similarly. *)
-Parameter inline_assembly_sem: ident -> extcall_sem.
+Parameter inline_assembly_sem: ident -> signature -> extcall_sem.
Axiom inline_assembly_properties:
- forall id, extcall_properties (inline_assembly_sem id) (mksignature nil None cc_default) nil.
+ forall id sg, extcall_properties (inline_assembly_sem id sg) sg nil.
(** ** Combined semantics of external calls *)
@@ -1479,8 +1479,8 @@ Definition external_call (ef: external_function): extcall_sem :=
| EF_free => extcall_free_sem
| EF_memcpy sz al => extcall_memcpy_sem sz al
| EF_annot txt targs => extcall_annot_sem txt targs
- | EF_annot_val txt targ=> extcall_annot_val_sem txt targ
- | EF_inline_asm txt => inline_assembly_sem txt
+ | EF_annot_val txt targ => extcall_annot_val_sem txt targ
+ | EF_inline_asm txt sg => inline_assembly_sem txt sg
end.
Theorem external_call_spec:
diff --git a/common/PrintAST.ml b/common/PrintAST.ml
index 52aa963a..387bf261 100644
--- a/common/PrintAST.ml
+++ b/common/PrintAST.ml
@@ -53,7 +53,7 @@ let name_of_external = function
sprintf "memcpy size %s align %s " (Z.to_string sz) (Z.to_string al)
| EF_annot(text, targs) -> sprintf "annot %S" (extern_atom text)
| EF_annot_val(text, targ) -> sprintf "annot_val %S" (extern_atom text)
- | EF_inline_asm text -> sprintf "inline_asm %S" (extern_atom text)
+ | EF_inline_asm(text, sg) -> sprintf "inline_asm %S" (extern_atom text)
let rec print_annot_arg px oc = function
| AA_base x -> px oc x