summaryrefslogtreecommitdiff
path: root/backend/RTLtyping.v
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-10 12:50:57 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2009-11-10 12:50:57 +0000
commit74487f079dd56663f97f9731cea328931857495c (patch)
tree9de10b895da39adffaf66bff983d6ed573898068 /backend/RTLtyping.v
parent0486654fac91947fec93d18a0738dd7aa10bcf96 (diff)
Added support for jump tables in back end.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1171 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend/RTLtyping.v')
-rw-r--r--backend/RTLtyping.v14
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/RTLtyping.v b/backend/RTLtyping.v
index 2df9d5d..86f0eaf 100644
--- a/backend/RTLtyping.v
+++ b/backend/RTLtyping.v
@@ -112,6 +112,11 @@ Inductive wt_instr : instruction -> Prop :=
valid_successor s1 ->
valid_successor s2 ->
wt_instr (Icond cond args s1 s2)
+ | wt_Ijumptable:
+ forall arg tbl,
+ env arg = Tint ->
+ (forall s, In s tbl -> valid_successor s) ->
+ wt_instr (Ijumptable arg tbl)
| wt_Ireturn:
forall optres,
option_map env optres = funct.(fn_sig).(sig_res) ->
@@ -224,6 +229,9 @@ Definition check_instr (i: instruction) : bool :=
check_regs args (type_of_condition cond)
&& check_successor s1
&& check_successor s2
+ | Ijumptable arg tbl =>
+ check_reg arg Tint
+ && List.forallb check_successor tbl
| Ireturn optres =>
match optres, funct.(fn_sig).(sig_res) with
| None, None => true
@@ -326,6 +334,10 @@ Proof.
constructor. apply check_regs_correct; auto.
apply check_successor_correct; auto.
apply check_successor_correct; auto.
+ (* jumptable *)
+ constructor. apply check_reg_correct; auto.
+ rewrite List.forallb_forall in H0. intros. apply check_successor_correct; auto.
+ intros.
(* return *)
constructor.
destruct o; simpl; destruct funct.(fn_sig).(sig_res); try discriminate.
@@ -538,6 +550,8 @@ Proof.
(* Icond *)
econstructor; eauto.
econstructor; eauto.
+ (* Ijumptable *)
+ econstructor; eauto.
(* Ireturn *)
econstructor; eauto.
destruct or; simpl in *.