Skip to content

Commit 47a614a

Browse files
authored
improves semantics of some ITT instructions (#1379)
1) removes double assignments in moves 2) removes doubled gotos in pop, push, stm, and ldm
1 parent 71076d4 commit 47a614a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

plugins/thumb/thumb_core.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ module Make(CT : Theory.Core) = struct
166166
data@@[dst := CT.ite ~?cnd exp (var dst)]
167167

168168

169-
let branch cnd t f =
170-
data@@[CT.branch (holds cnd) (seq t) (seq f)]
169+
let branch cnd t f = match cnd with
170+
| `AL -> data [seq t]
171+
| _ -> data@@[CT.branch (holds cnd) (seq t) (seq f)]
171172

172173
end

plugins/thumb/thumb_mov.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ module Make(CT : Theory.Core) = struct
1818
let borrow_from_sub ~rn ~rm = bit (rn < rm)
1919

2020
let movi8 rd x = it_set rd (const x) @@ fun v -> [
21-
v := const x;
2221
nf := if Int.(x lsr 7 = 1) then bit1 else bit0;
2322
zf := if Int.(x = 0) then bit1 else bit0;
2423
]
@@ -58,11 +57,9 @@ module Make(CT : Theory.Core) = struct
5857
vf := overflow_from_add (var r) (var rn) (var rm);
5958
]
6059

61-
let addspi off =
62-
it_set sp (var sp + const off) @@ fun _ -> []
60+
let addspi off = sp <-? var sp + const off
6361

64-
let addrspi rd off =
65-
it_set rd (var sp + const off) @@ fun _ -> []
62+
let addrspi rd off = rd <-? var sp + const off
6663

6764
let cmp x y r = [
6865
nf := msb (var r);

0 commit comments

Comments
 (0)