diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2017-10-19 13:08:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-19 13:08:13 +0200 |
commit | 6a010b47b216c5a6b6e85abcfbba5339bab15dd6 (patch) | |
tree | 4c7f8bacd081f023cfd3220b0aac0e186567d051 /common | |
parent | a0f238a3d270edd7042d9852d43e3ec5b9602af2 (diff) | |
download | compcert-6a010b47b216c5a6b6e85abcfbba5339bab15dd6.tar.gz compcert-6a010b47b216c5a6b6e85abcfbba5339bab15dd6.zip |
New support for inserting ais-annotations.
The ais annotations can be inserted via the new ais variants of
the builtin annotation. They mainly differe in that they have an
address format specifier '%addr' which will be replaced by the
adress in the binary.
The implementation simply prints a label for the builtin call
alongside a the text of the annotation as comment and inserts the
annotation together as acii string in a separate section
'ais_annotations' and replaces the usages of the address format
specifiers by the address of the label of the builtin call.
Diffstat (limited to 'common')
-rw-r--r-- | common/AST.v | 14 | ||||
-rw-r--r-- | common/Events.v | 4 | ||||
-rw-r--r-- | common/PrintAST.ml | 4 | ||||
-rw-r--r-- | common/Sections.ml | 1 | ||||
-rw-r--r-- | common/Sections.mli | 1 |
5 files changed, 13 insertions, 11 deletions
diff --git a/common/AST.v b/common/AST.v index a072ef29..145f4919 100644 --- a/common/AST.v +++ b/common/AST.v @@ -451,11 +451,11 @@ 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: string) (targs: list typ) + | EF_annot (kind: positive) (text: string) (targs: list typ) (** 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. *) - | EF_annot_val (text: string) (targ: typ) + | EF_annot_val (kind: positive) (text: string) (targ: typ) (** 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. *) @@ -482,8 +482,8 @@ Definition ef_sig (ef: external_function): signature := | EF_malloc => mksignature (Tptr :: nil) (Some Tptr) cc_default | EF_free => mksignature (Tptr :: nil) None cc_default | EF_memcpy sz al => mksignature (Tptr :: Tptr :: 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_annot kind text targs => mksignature targs None cc_default + | EF_annot_val kind text targ => mksignature (targ :: nil) (Some targ) cc_default | EF_inline_asm text sg clob => sg | EF_debug kind text targs => mksignature targs None cc_default end. @@ -500,8 +500,8 @@ Definition ef_inline (ef: external_function) : bool := | EF_malloc => false | EF_free => false | EF_memcpy sz al => true - | EF_annot text targs => true - | EF_annot_val text targ => true + | EF_annot kind text targs => true + | EF_annot_val kind Text rg => true | EF_inline_asm text sg clob => true | EF_debug kind text targs => true end. @@ -510,7 +510,7 @@ Definition ef_inline (ef: external_function) : bool := Definition ef_reloads (ef: external_function) : bool := match ef with - | EF_annot text targs => false + | EF_annot kind text targs => false | EF_debug kind text targs => false | _ => true end. diff --git a/common/Events.v b/common/Events.v index 63922bc5..b2335b96 100644 --- a/common/Events.v +++ b/common/Events.v @@ -1419,8 +1419,8 @@ Definition external_call (ef: external_function): extcall_sem := | EF_malloc => extcall_malloc_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_annot kind txt targs => extcall_annot_sem txt targs + | EF_annot_val kind txt targ => extcall_annot_val_sem txt targ | EF_inline_asm txt sg clb => inline_assembly_sem txt sg | EF_debug kind txt targs => extcall_debug_sem end. diff --git a/common/PrintAST.ml b/common/PrintAST.ml index ac7d2276..883d101a 100644 --- a/common/PrintAST.ml +++ b/common/PrintAST.ml @@ -46,8 +46,8 @@ let name_of_external = function | EF_free -> "free" | EF_memcpy(sz, al) -> sprintf "memcpy size %s align %s " (Z.to_string sz) (Z.to_string al) - | EF_annot(text, targs) -> sprintf "annot %S" (camlstring_of_coqstring text) - | EF_annot_val(text, targ) -> sprintf "annot_val %S" (camlstring_of_coqstring text) + | EF_annot(kind,text, targs) -> sprintf "annot %S" (camlstring_of_coqstring text) + | EF_annot_val(kind,text, targ) -> sprintf "annot_val %S" (camlstring_of_coqstring text) | EF_inline_asm(text, sg, clob) -> sprintf "inline_asm %S" (camlstring_of_coqstring text) | EF_debug(kind, text, targs) -> sprintf "debug%d %S" (P.to_int kind) (extern_atom text) diff --git a/common/Sections.ml b/common/Sections.ml index 1c2e8291..30be9e69 100644 --- a/common/Sections.ml +++ b/common/Sections.ml @@ -31,6 +31,7 @@ type section_name = | Section_debug_line of string option | Section_debug_ranges | Section_debug_str + | Section_ais_annotation type access_mode = | Access_default diff --git a/common/Sections.mli b/common/Sections.mli index b83b0bb4..bc97814d 100644 --- a/common/Sections.mli +++ b/common/Sections.mli @@ -32,6 +32,7 @@ type section_name = | Section_debug_line of string option | Section_debug_ranges | Section_debug_str + | Section_ais_annotation type access_mode = | Access_default |