aboutsummaryrefslogtreecommitdiffstats
path: root/backend/XTL.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-03-27 08:55:05 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-03-27 08:55:05 +0100
commit4622f49fd089ae47d0c853343cb0a05f986c962a (patch)
treebd045e1ef59d57f8e4b5f5734470cae56a4e68b7 /backend/XTL.ml
parent8d75ab2d38fa20dc7d8e3839967015cc276cd642 (diff)
downloadcompcert-kvx-4622f49fd089ae47d0c853343cb0a05f986c962a.tar.gz
compcert-kvx-4622f49fd089ae47d0c853343cb0a05f986c962a.zip
Extend annotations so that they can keep track of global variables and local variables whose address is taken.
- CminorSel, RTL: add "annot" instructions. - CminorSel to Asm: use type "annot_arg" for arguments of "annot" instructions. - AST, Events: simplify EF_annot because constants are now part of the arguments. Implementation is not complete yet.
Diffstat (limited to 'backend/XTL.ml')
-rw-r--r--backend/XTL.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/backend/XTL.ml b/backend/XTL.ml
index 9cb8e0a1..30c09fdf 100644
--- a/backend/XTL.ml
+++ b/backend/XTL.ml
@@ -35,6 +35,7 @@ type instruction =
| Xcall of signature * (var, ident) sum * var list * var list
| Xtailcall of signature * (var, ident) sum * var list
| Xbuiltin of external_function * var list * var list
+ | Xannot of external_function * var annot_arg list
| Xbranch of node
| Xcond of condition * var list * node * node
| Xjumptable of var * node list
@@ -124,6 +125,12 @@ let rec set_vars_type vl tyl =
let unify_var_type v1 v2 =
if typeof v1 <> typeof v2 then raise Type_error
+let type_annot_arg a ty =
+ match a with
+ | AA_base v -> set_var_type v ty
+ | AA_longofwords(v1, v2) -> set_var_type v1 Tint; set_var_type v2 Tint
+ | _ -> ()
+
let type_instr = function
| Xmove(src, dst) | Xspill(src, dst) | Xreload(src, dst) ->
unify_var_type src dst
@@ -153,6 +160,11 @@ let type_instr = function
let sg = ef_sig ef in
set_vars_type args sg.sig_args;
set_vars_type res (Events.proj_sig_res' sg)
+ | Xannot(ef, args) ->
+ let sg = ef_sig ef in
+ if List.length args = List.length sg.sig_args
+ then List.iter2 type_annot_arg args sg.sig_args
+ else raise Type_error
| Xbranch s ->
()
| Xcond(cond, args, s1, s2) ->