Skip to content

Commit

Permalink
Add flag to supress warnings for splitting memory accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
sarranz committed Oct 7, 2024
1 parent 3a4a8b4 commit 67d3750
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions compiler/src/compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,14 @@ let compile (type reg regx xreg rflag cond asm_op extra_op)
then Some (UseLea, "LEA instruction is used")
else None
| Split_memory_access ->
let msg =
"This memory immediate does not fit in one instruction, several \
instructions were issued."
in
Some (SplitMemoryAccess, msg)
if not !Glob_options.split_memory_access
then
let msg =
"This memory immediate does not fit in one instruction, several \
instructions were issued."
in
Some (SplitMemoryAccess, msg)
else None
in
let loc, _ = ii in
Option.may (fun (w, msg) -> warning w loc "%s" msg) o;
Expand Down
4 changes: 4 additions & 0 deletions compiler/src/glob_options.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type color = | Auto | Always | Never
let color = ref Auto

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

0 comments on commit 67d3750

Please sign in to comment.