Dynamic Constant Normalization
Implements #18 (closed). A few notes on the actual implementation
- Any object that can be used to add dynamic constants should implement the
DynamicConstantView
trait (inhercules_ir/ir/dc_normalization.rs
), in particular this just requires implementingget_dynconst
which can be used to retrieve dynamic constant values from their IDs andadd_dynconst
which takes a (normalized) dynamic constant object and interns it and produces its ID. An object that implements that trait can then be used to normalize and intern dynamic constants via the variousdc_*
methods. - Not described in the original issue,
min
andmax
actually track their fields in a set since duplicates don't matter. Also,min
ignores 0 if it is one of the elements, since dynamic constants are non-negative somin {0, ...} = min {...}
. - The trait implements a
dc_normalize
which can take a dynamic constant and normalize it (unlike most of the other functions which take the arguments and normalize them). - Re-wrote Juno's dynamic constant generation (again) mainly to use the new APIs that handle adding/multiplying lists of dynamic constants but also to fix some issues with division.