-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitfield Domain #1623
base: master
Are you sure you want to change the base?
Bitfield Domain #1623
Changes from all commits
9b0002f
582630c
3042aae
a609f3d
696c110
0630662
fd89907
8a91829
5c0fdbb
087d4a9
0116023
03961c0
d42b989
6a26669
05b3d8e
27c9876
ca7c040
1338d65
447db3d
3a00c0b
89294a9
c78510b
ec166cb
1adccde
2e05197
897d6a2
7d5913a
257cc5b
24b3719
cbfbf28
87b0189
ff8c4c7
d405853
ffc7285
5ec64ad
8cd7e62
a31dc67
28d9db0
6177b13
8e8b9cb
ed56bd8
9ae2b8f
874e1ed
5ce8db7
4170f7f
cd1bd06
5eafd97
811590d
6999a20
9f72163
c660277
146d858
55bc2b3
90e1e99
6a32e42
47b7a56
5606e67
8b1fbfc
4bf31cc
0b4b4a1
15520a8
d55eab5
6562161
2aa27f8
ad5f6f8
cfa0091
98a2d24
5914695
4a542be
15f7abe
f9f7fce
1b6459d
31def4b
2ba8f38
b6762af
b6ee7fa
a933c4e
e2366ff
addda52
29bcca1
7984a0a
ed1999a
7fa0100
96e5737
90338a7
f25a578
e9286e7
3e4928a
9bcd884
6fe1162
5301322
0fa8ca7
bad0bb8
abde7e4
937b341
ddfaace
24f305f
7c4411d
6c2c570
f237a9e
e4eefd9
8d4a4b8
8d7faf9
e2568fd
ccb13c1
88b0dfc
86fdeb5
60fbbf5
ed27d3d
58eeeb4
dbe2e00
810a966
d7b8755
541a87d
686633a
4b3a0f8
dee9036
d6e3f61
e3145ad
6c720b8
f09ead4
8b53b08
c682527
7a8b3ad
8cf7192
79a859a
bfe5dc6
ed56056
f40fefb
e1d948d
57ac94a
6c7f899
313adb8
ee9f358
288bf0d
306aa33
3862f2e
b683875
26a23f5
f70838d
2e85cc9
898a68e
0cc16dc
65237fd
5cf4620
dc68f48
312b0c3
3034ad3
1f08a87
552c333
571cde3
18ee9a9
51c13e7
e7c3237
1376824
abb48c4
dbe3f54
8bd36ce
6ecd41e
5ba10f8
54856e0
da57955
b54ca80
7dcec4c
89ff69b
cf7b349
1d78b29
4fe0097
767f998
821be43
a1807b6
d276a14
0a55d08
93c42e6
e6bb07d
fe99f61
4c5fc2d
8db7e6b
5c229cc
2b7166d
2fd9fd2
3250a52
15ad6f2
c91dfe6
6675bdd
df29c45
91b2e54
fbda7fe
730aa9f
008a078
d1061fb
f096812
2b220a3
a7a6605
2ba0410
0a1b63d
b84ebd3
41e0f9f
9df142f
01c54fd
a5e4a49
5727755
17c8f6b
685ad69
2e2294a
aca979f
49244ba
12866c2
cb9ea62
7d2a31e
eafafb1
d47691e
34ba22b
416e171
5f6126d
6d163cf
154e568
f033b65
0159653
e14c5be
08937f6
987531c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -395,27 +395,55 @@ struct | |
| Le, Some false -> meet_bin (ID.starting ikind (Z.succ l2)) (ID.ending ikind (Z.pred u1)) | ||
| _, _ -> a, b) | ||
| _ -> a, b) | ||
| BOr | BXor as op-> | ||
if M.tracing then M.tracel "inv" "Unhandled operator %a" d_binop op; | ||
| BOr -> | ||
(* Be careful: inv_exp performs a meet on both arguments of the BOr / BXor. *) | ||
if PrecisionUtil.get_bitfield () then | ||
(* refinement based on the following idea: bit set to one in c and set to zero in b must be one in a and bit set to zero in c must be zero in a too (analogously for b) *) | ||
let ((az, ao), (bz, bo)) = BitfieldDomain.Bitfield.refine_bor (ID.to_bitfield ikind a) (ID.to_bitfield ikind b) (ID.to_bitfield ikind c) in | ||
ID.meet a (ID.of_bitfield ikind (az, ao)), ID.meet b (ID.of_bitfield ikind (bz, bo)) | ||
else | ||
(if M.tracing then M.tracel "inv" "Unhandled operator %a" d_binop op; | ||
(* Be careful: inv_exp performs a meet on both arguments of the BOr / BXor. *) | ||
(a, b) | ||
) | ||
| BXor -> | ||
(* Be careful: inv_exp performs a meet on both arguments of the BOr / BXor. *) | ||
a, b | ||
if PrecisionUtil.get_bitfield () then | ||
(* from a ^ b = c follows a = b ^ c *) | ||
let a' = ID.meet a (ID.logxor c b) in | ||
let b' = ID.meet b (ID.logxor a c) in | ||
a', b' | ||
else | ||
(if M.tracing then M.tracel "inv" "Unhandled operator %a" d_binop op; | ||
(* Be careful: inv_exp performs a meet on both arguments of the BOr / BXor. *) | ||
(a, b) | ||
) | ||
| LAnd -> | ||
if ID.to_bool c = Some true then | ||
meet_bin c c | ||
else | ||
a, b | ||
| BAnd as op -> | ||
| BAnd -> | ||
(* we only attempt to refine a here *) | ||
let b_int = ID.to_int b in | ||
let a = | ||
match ID.to_int b with | ||
match b_int with | ||
| Some x when Z.equal x Z.one -> | ||
(match ID.to_bool c with | ||
| Some true -> ID.meet a (ID.of_congruence ikind (Z.one, Z.of_int 2)) | ||
| Some false -> ID.meet a (ID.of_congruence ikind (Z.zero, Z.of_int 2)) | ||
| None -> if M.tracing then M.tracel "inv" "Unhandled case for operator x %a 1 = %a" d_binop op ID.pretty c; a) | ||
| _ -> if M.tracing then M.tracel "inv" "Unhandled case for operator x %a %a = %a" d_binop op ID.pretty b ID.pretty c; a | ||
| None -> a) | ||
| _ -> a | ||
Comment on lines
+435
to
+436
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tracing output should still be produced if bitfield is off. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AdrianKrauss The tracing output still seems to be missing? |
||
in | ||
a, b | ||
if PrecisionUtil.get_bitfield () then | ||
(* refinement based on the following idea: bit set to zero in c and set to one in b must be zero in a and bit set to one in c must be one in a too (analogously for b) *) | ||
let ((az, ao), (bz, bo)) = BitfieldDomain.Bitfield.refine_band (ID.to_bitfield ikind a) (ID.to_bitfield ikind b) (ID.to_bitfield ikind c) in | ||
ID.meet a (ID.of_bitfield ikind (az, ao)), ID.meet b (ID.of_bitfield ikind (bz, bo)) | ||
else if b_int = None then | ||
(if M.tracing then M.tracel "inv" "Unhandled operator %a" d_binop op; | ||
(a, b) | ||
) | ||
else a, b | ||
Comment on lines
+442
to
+446
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| op -> | ||
if M.tracing then M.tracel "inv" "Unhandled operator %a" d_binop op; | ||
a, b | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to really limit this to just bitfields?
Seems like it could be very similar to
PlusA
:meet_com ID.logxor
.