-
Notifications
You must be signed in to change notification settings - Fork 82
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
Avoid polymorphic comparison in backend
#3649
base: main
Are you sure you want to change the base?
Conversation
Selection Change CheckThis PR modifies the original selection pass (targeting Mach). |
f542d6e
to
074c7f8
Compare
adb2b97
to
1195cf7
Compare
@@ -181,6 +188,8 @@ type emit_frame_actions = | |||
efa_string : string -> unit | |||
} | |||
|
|||
let is_empty = function [] -> true | _ :: _ -> false |
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.
Another use of Misc.List.is_empty
.
@@ -223,7 +224,7 @@ let reset() = | |||
soft pseudo-registers *) | |||
if !first_virtual_reg_stamp = -1 then begin | |||
first_virtual_reg_stamp := !currstamp; | |||
assert (!reg_list = []) (* Only hard regs created before now *) | |||
assert (match !reg_list with [] -> true | _ :: _ -> false) (* Only hard regs created before now *) |
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.
Misc.List.is_empty
?
@@ -2133,6 +2134,10 @@ let assemble_instr b loc = function | |||
| TZCNT (src, dst) -> emit_tzcnt b ~dst ~src | |||
| LZCNT (src, dst) -> emit_lzcnt b ~dst ~src | |||
|
|||
let is_win32 = function |
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.
I think one of the prevous PRs added it (or similar functions) somewhere. It would be nice to put them all together in one of X86_*
files.
@@ -478,7 +479,7 @@ let emit_prefix_modrm b opcodes rm reg ~prefix = | |||
let idx_reg = idx in | |||
let idx = rd_of_reg64 idx in | |||
if scale = 0 then ( | |||
assert (base = None && arch = X86); | |||
assert (Option.is_none base && (match arch with X86 -> true | X64 -> false)); |
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.
consider factoring out this match
into a separate function.
@@ -108,15 +109,18 @@ let windows = | |||
| _ -> false | |||
|
|||
let string_of_substring_literal k n s = | |||
let between x low high = |
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.
This string_of_substring_literal
is very similar to emit_aux
, I don't remember why we have both, maybe we can refactor it (in a separate PR, I added a note to "The list").
let n = | ||
match system with | ||
| S_macosx -> Misc.log2 n | ||
| _ -> n |
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.
We should turn on warnings here I guess? Maybe just fix this new _
for now and we can have separate PR later to turn on the warnings.
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.
Actually, I think we already have is_macosx
helper somewhere.
if system = S_solaris then bprintf b "\t.zero\t%d" n | ||
else bprintf b "\t.space\t%d" n | ||
(match system with | ||
| S_solaris -> bprintf b "\t.zero\t%d" n |
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.
do we still need S_solaris
?
(As per title.)