From 17f519651feb4a09aa90c89c949469e8a5ab0e88 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sun, 17 Aug 2014 07:52:12 +0000 Subject: - Support "switch" statements over 64-bit integers (in CompCert C to Cminor, included) - Translation of "switch" to decision trees or jumptables made generic over the sizes of integers and moved to the Cminor->CminorSel pass instead of CminorSel->RTL as before. - CminorSel: add "exitexpr" to support the above. - ValueDomain: more precise analysis of comparisons against an integer literal. E.g. "x >=u 0" is always true. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2565 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/ClightBigstep.v | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'cfrontend/ClightBigstep.v') diff --git a/cfrontend/ClightBigstep.v b/cfrontend/ClightBigstep.v index f7a0e189..d61e4eef 100644 --- a/cfrontend/ClightBigstep.v +++ b/cfrontend/ClightBigstep.v @@ -151,8 +151,9 @@ Inductive exec_stmt: env -> temp_env -> mem -> statement -> trace -> temp_env -> exec_stmt e le2 m2 (Sloop s1 s2) t3 le3 m3 out -> exec_stmt e le m (Sloop s1 s2) (t1**t2**t3) le3 m3 out - | exec_Sswitch: forall e le m a t n sl le1 m1 out, - eval_expr ge e le m a (Vint n) -> + | exec_Sswitch: forall e le m a t v n sl le1 m1 out, + eval_expr ge e le m a v -> + sem_switch_arg v (typeof a) = Some n -> exec_stmt e le m (seq_of_labeled_statement (select_switch n sl)) t le1 m1 out -> exec_stmt e le m (Sswitch a sl) t le1 m1 (outcome_switch out) @@ -220,8 +221,9 @@ CoInductive execinf_stmt: env -> temp_env -> mem -> statement -> traceinf -> Pro exec_stmt e le1 m1 s2 t2 le2 m2 Out_normal -> execinf_stmt e le2 m2 (Sloop s1 s2) t3 -> execinf_stmt e le m (Sloop s1 s2) (t1***t2***t3) - | execinf_Sswitch: forall e le m a t n sl, - eval_expr ge e le m a (Vint n) -> + | execinf_Sswitch: forall e le m a t v n sl, + eval_expr ge e le m a v -> + sem_switch_arg v (typeof a) = Some n -> execinf_stmt e le m (seq_of_labeled_statement (select_switch n sl)) t -> execinf_stmt e le m (Sswitch a sl) t @@ -427,7 +429,7 @@ Proof. auto. (* switch *) - destruct (H1 f (Kswitch k)) as [S1 [A1 B1]]. + destruct (H2 f (Kswitch k)) as [S1 [A1 B1]]. set (S2 := match out with | Out_normal => State f Sskip k e le1 m1 -- cgit