aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Stacking.v
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/Stacking.v
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/Stacking.v')
-rw-r--r--backend/Stacking.v26
1 files changed, 19 insertions, 7 deletions
diff --git a/backend/Stacking.v b/backend/Stacking.v
index 4ee43bb1..c17dc038 100644
--- a/backend/Stacking.v
+++ b/backend/Stacking.v
@@ -130,14 +130,26 @@ Definition transl_addr (fe: frame_env) (addr: addressing) :=
(** Translation of an annotation argument. *)
-Definition transl_annot_param (fe: frame_env) (l: loc) : annot_param :=
- match l with
- | R r => APreg r
- | S Local ofs ty => APstack (chunk_of_type ty) (offset_of_index fe (FI_local ofs ty))
- | S _ _ _ => APstack Mint32 (-1) (**r never happens *)
+Fixpoint transl_annot_arg (fe: frame_env) (a: annot_arg loc) : annot_arg mreg :=
+ match a with
+ | AA_base (R r) => AA_base r
+ | AA_base (S Local ofs ty) =>
+ AA_loadstack (chunk_of_type ty) (Int.repr (offset_of_index fe (FI_local ofs ty)))
+ | AA_base (S _ _ __) => AA_int Int.zero (**r never happens *)
+ | AA_int n => AA_int n
+ | AA_long n => AA_long n
+ | AA_float n => AA_float n
+ | AA_single n => AA_single n
+ | AA_loadstack chunk ofs =>
+ AA_loadstack chunk (Int.add ofs (Int.repr fe.(fe_stack_data)))
+ | AA_addrstack ofs =>
+ AA_addrstack (Int.add ofs (Int.repr fe.(fe_stack_data)))
+ | AA_loadglobal chunk id ofs => AA_loadglobal chunk id ofs
+ | AA_addrglobal id ofs => AA_addrglobal id ofs
+ | AA_longofwords hi lo =>
+ AA_longofwords (transl_annot_arg fe hi) (transl_annot_arg fe lo)
end.
-
(** Translation of a Linear instruction. Prepends the corresponding
Mach instructions to the given list of instructions.
[Lgetstack] and [Lsetstack] moves between registers and stack slots
@@ -182,7 +194,7 @@ Definition transl_instr
| Lbuiltin ef args dst =>
Mbuiltin ef args dst :: k
| Lannot ef args =>
- Mannot ef (map (transl_annot_param fe) args) :: k
+ Mannot ef (map (transl_annot_arg fe) args) :: k
| Llabel lbl =>
Mlabel lbl :: k
| Lgoto lbl =>