Skip to content

Commit 4011b7e

Browse files
committed
Add flag to supress warnings for splitting memory accesses
1 parent 36d2932 commit 4011b7e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

compiler/src/compile.ml

+8-5
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,14 @@ let compile (type reg regx xreg rflag cond asm_op extra_op)
191191
then Some (UseLea, "LEA instruction is used")
192192
else None
193193
| Split_memory_access ->
194-
let msg =
195-
"This memory immediate does not fit in one instruction, several \
196-
instructions were issued."
197-
in
198-
Some (SplitMemoryAccess, msg)
194+
if not !Glob_options.split_memory_access
195+
then
196+
let msg =
197+
"This memory immediate does not fit in one instruction, several \
198+
instructions were issued."
199+
in
200+
Some (SplitMemoryAccess, msg)
201+
else None
199202
in
200203
let loc, _ = ii in
201204
Option.may (fun (w, msg) -> warning w loc "%s" msg) o;

compiler/src/glob_options.ml

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type color = | Auto | Always | Never
2525
let color = ref Auto
2626

2727
let lea = ref false
28+
let split_memory_access = ref false
2829
let set0 = ref false
2930
let model = ref Normal
3031
let print_stack_alloc = ref false
@@ -172,6 +173,9 @@ let options = [
172173
"-I" , Arg.String set_idirs , "[ident:path] Bind ident to path for from ident require ...";
173174
"-lea" , Arg.Set lea , " Use lea as much as possible (default is nolea)";
174175
"-nolea" , Arg.Clear lea , " Try to use add and mul instead of lea";
176+
"-split-memory-access"
177+
, Arg.Set split_memory_access
178+
, " Split large memory accesses in several instructions";
175179
"-set0" , Arg.Set set0 , " Use [xor x x] to set x to 0 (default is not)";
176180
"-noset0" , Arg.Clear set0 , " Do not use set0 option";
177181
"-ec" , Arg.String set_ec , "[f] Extract function [f] and its dependencies to an easycrypt file (deprecated)";

0 commit comments

Comments
 (0)