aboutsummaryrefslogtreecommitdiffstats
path: root/arm/TargetPrinter.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-10-11 17:43:59 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2015-10-11 17:43:59 +0200
commit7a6bb90048db7a254e959b1e3c308bac5fe6c418 (patch)
tree6119d963ce34b56386f79693972e8ce86d9c0e87 /arm/TargetPrinter.ml
parent659b735ed2dbefcbe8bcb2ec2123b66019ddaf14 (diff)
downloadcompcert-kvx-7a6bb90048db7a254e959b1e3c308bac5fe6c418.tar.gz
compcert-kvx-7a6bb90048db7a254e959b1e3c308bac5fe6c418.zip
Use Coq strings instead of idents to name external and builtin functions.
The AST.ident type represents source-level identifiers as unique positive numbers. However, the mapping identifiers <-> AST.ident differs between runs of CompCert on different source files. This is problematic when we need to produce or recognize external functions and builtin functions with fixed names, for example: * in $ARCH/Machregs.v to define the register conventions for builtin functions; * in the VST program logic from Princeton to treat thread primitives specially. So far, we used AST.ident_of_string to recover the ident associated with a string. However, this function is defined in OCaml and doesn't execute within Coq. This is a problem both for VST and for future executability of CompCert within Coq. This commit replaces "ident" by "string" in the arguments of EF_external, EF_builtin, EF_inline_asm, EF_annot, and EF_annot_val. This provides stable names for externals and builtins, as needed. For inline asm and annotations, it's a matter of taste, but using strings feels more natural. EF_debug keeps using idents, since some kinds of EF_debug annotations talk about program variables.
Diffstat (limited to 'arm/TargetPrinter.ml')
-rw-r--r--arm/TargetPrinter.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/arm/TargetPrinter.ml b/arm/TargetPrinter.ml
index 2e676090..04226900 100644
--- a/arm/TargetPrinter.ml
+++ b/arm/TargetPrinter.ml
@@ -777,7 +777,7 @@ module Target (Opt: PRINTER_OPTIONS) : TARGET =
begin match ef with
| EF_annot(txt, targs) ->
fprintf oc "%s annotation: " comment;
- print_annot_text preg "sp" oc (extern_atom txt) args;
+ print_annot_text preg "sp" oc (camlstring_of_coqstring txt) args;
0
| EF_debug(kind, txt, targs) ->
print_debug_info comment print_file_line preg "sp" oc
@@ -785,7 +785,7 @@ module Target (Opt: PRINTER_OPTIONS) : TARGET =
0
| EF_inline_asm(txt, sg, clob) ->
fprintf oc "%s begin inline assembly\n\t" comment;
- print_inline_asm preg oc (extern_atom txt) sg args res;
+ print_inline_asm preg oc (camlstring_of_coqstring txt) sg args res;
fprintf oc "%s end inline assembly\n" comment;
5 (* hoping this is an upper bound... *)
| _ ->