summaryrefslogtreecommitdiff
path: root/src/value2.lem
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-07-24 18:09:18 +0100
committerAlasdair Armstrong2018-07-24 18:09:18 +0100
commit6b4f407ad34ca7d4d8a89a5a4d401ac80c7413b0 (patch)
treeed09b22b7ea4ca20fbcc89b761f1955caea85041 /src/value2.lem
parentdafb09e7c26840dce3d522fef3cf359729ca5b61 (diff)
parent8114501b7b956ee4a98fa8599c7efee62fc19206 (diff)
Merge remote-tracking branch 'origin/sail2' into c_fixes
Diffstat (limited to 'src/value2.lem')
-rw-r--r--src/value2.lem24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/value2.lem b/src/value2.lem
index 33416503..e8a8262a 100644
--- a/src/value2.lem
+++ b/src/value2.lem
@@ -1,4 +1,4 @@
-(**************************************************************************)
+(*========================================================================*)
(* Sail *)
(* *)
(* Copyright (c) 2013-2017 *)
@@ -46,7 +46,7 @@
(* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT *)
(* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *)
(* SUCH DAMAGE. *)
-(**************************************************************************)
+(*========================================================================*)
open import Pervasives
open import Assert_extra
@@ -70,17 +70,13 @@ type vl =
| V_record of list (string * vl)
| V_null (* Used for unitialized values and null pointers in C compilation *)
-let primops extern args =
- match (extern, args) with
- | ("and_bool", [V_bool b1; V_bool b2]) -> V_bool (b1 && b2)
- | ("and_bool", [V_nondet; V_bool false]) -> V_bool false
- | ("and_bool", [V_bool false; V_nondet]) -> V_bool false
- | ("and_bool", _) -> V_nondet
- | ("or_bool", [V_bool b1; V_bool b2]) -> V_bool (b1 || b2)
- | ("or_bool", [V_nondet; V_bool true]) -> V_bool true
- | ("or_bool", [V_bool true; V_nondet]) -> V_bool true
- | ("or_bool", _) -> V_nondet
+let value_int_op_int op = function
+ | [V_int v1; V_int v2] -> V_int (op v1 v2)
+ | _ -> V_null
+end
- | _ -> failwith ("Unimplemented primitive operation " ^ extern)
- end
+let value_bool_op_int op = function
+ | [V_int v1; V_int v2] -> V_bool (op v1 v2)
+ | _ -> V_null
+end