package jasmin

  1. Overview
  2. Docs
Compiler for High-Assurance and High-Speed Cryptography

Install

dune-project
 Dependency

Authors

Maintainers

Sources

jasmin-compiler-v2025.06.1.tar.bz2
sha256=e92b42fa69da7c730b0c26dacf842a72b4febcaf4f2157a1dc18b3cce1f859fa

doc/src/jasmin.jasmin/tt_arm_m4.ml.html

Source file tt_arm_m4.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
open Utils

module L = Location
module S = Syntax

(* -------------------------------------------------------------------- *)
(* ARM parsing. *)

let get_set_flags ps s =
  if String.ends_with s "S" && not (List.mem_assoc s ps) then
    (true, String.drop_end 1 s)
  else (false, s)

let get_is_conditional s =
  if String.ends_with s "cc" then (true, String.drop_end 2 s) else (false, s)

let get_arm_prim ps s =
  let is_conditional, s = get_is_conditional s in
  let set_flags, s = get_set_flags ps s in
  (s, set_flags, is_conditional)

let tt_prim err ps s sa =
  let name, set_flags, is_conditional = get_arm_prim ps s in
  match List.assoc_opt name ps with
  | Some (Sopn.PrimARM pr) ->
    if sa == None
    then
      match pr set_flags is_conditional with
      | Ok op -> op
      | Error msg -> raise (err (String.concat "" [ " ("; msg; ")" ]))
    else raise (err "")
  | _ -> raise (err "")