I wonder if it's better to provide an index method or trait for the Value or BasicBlock since their number starts from a fixed NUMBER could not be created otherwise.
It would be helpful for generating more readable information like Debug trait for Value, or make it indexable for indexmap and so on. Cranelift and rustc both encode these entities in usize starting from 0 afaik.
for example
rustc_index::newtype_index! {
#[debug_format = "bb{}"]
pub struct BasicBlock {
const START_BLOCK = 0;
}
}
here is a usage when i'm generating dot file for the IR, it would be more readable to have value number starting from 0.

I wonder if it's better to provide an
indexmethod or trait for theValueorBasicBlocksince their number starts from a fixed NUMBER could not be created otherwise.It would be helpful for generating more readable information like
Debugtrait forValue, or make it indexable forindexmapand so on. Cranelift and rustc both encode these entities in usize starting from 0 afaik.for example
here is a usage when i'm generating dot file for the IR, it would be more readable to have value number starting from 0.