Reimplement create_constant_zero in builder for Juno codegen
This implements the create_constant_zero
which had previously existed in the Hercules IR builder but now without using the zero
constant that has been removed.
This also required changing the create_constant_array
to take the extents to be dynamic constants (rather than just u32
but without this change there is actually no way to create a constant dynamically sized array which is necessary in many circumstances.
The create_constant_zero
is used in a few places in Juno codegen and would require substantial rewrites to remove (and the rewrite would in essence do the exact same thing this function does just using the representation of types from the front-end).
Merge request reports
Activity
requested review from @rarbore2
assigned to @aaronjc4
Since the frontend relies on being able to do
create_constant_zero
, I think it's fine to have a wrapper as is implemented here (although it is definitely an artifact of how things were previously). As for lowering non-zero constant sized arrays, the only sane way I see to do this is to create a zero array constant and generate a write node per non-zero element at each necessary index. It does mean you can't map a non-zero constant array at the Juno level to a single constant at the Hercules IR level. Hopefully this is ok? @aaronjc4Edited by rarbore2mentioned in commit bf1b9c90