[gen] Use explicit equality helpers for edge comparison#1913
[gen] Use explicit equality helpers for edge comparison#1913ShaleXIONG wants to merge 2 commits into
Conversation
Add equality helpers for code, edge components, dependencies, and RMWs. This avoids polymorphic equality for `tedge` internals. Use existing `compare_atom` for `atom` equality check.
|
|
||
| let get_access_atom = A.get_access_atom | ||
|
|
||
| let equal_atomo = Option.equal (fun a1 a2 -> A.compare_atom a1 a2 = 0) |
There was a problem hiding this comment.
This is a lot of code, which doesn't seem trivial to maintain. I think it might be worthwhile to use a ppx processor for the data types to generate this code: https://github.com/ocaml-ppx/ppx_deriving#plugins-eq-and-ord
There was a problem hiding this comment.
In short, I agree. However, I believe the general consensus is to not introduce extra dependency. I will be in favour of use ppx to deriving many pp and equal function in diy* but not sure how it will impact the compilation and dependencies? @psafont Do you have insight on this?
| | Int,Int | ||
| | Ext,Ext | ||
| | UnspecCom,UnspecCom -> true | ||
| | (Int|Ext|UnspecCom),_ -> false |
There was a problem hiding this comment.
Could you please indent the pattern matching bars (here and elsewhere), for easier readability and consistency with the rest of the code?
| | Int,Int | |
| | Ext,Ext | |
| | UnspecCom,UnspecCom -> true | |
| | (Int|Ext|UnspecCom),_ -> false | |
| | Int,Int | |
| | Ext,Ext | |
| | UnspecCom,UnspecCom -> true | |
| | (Int|Ext|UnspecCom),_ -> false |
There was a problem hiding this comment.
I systematically added two spaces for similar code.
Add equality helpers for code, edge components, dependencies, and RMWs. This avoids polymorphic equality for
tedgeinternals. Use existingcompare_atomforatomequality check.This pull request separates from #1835 .