fitzgen closed issue #1385:
This is an open-ended issue for re-designing Cranelift's constant pools. In #1377 I added the ability to calculate the address of constants using
const_addrand to declare constants in function preambles (e..gconst42 = [0 1 2...]). Constant pools are still implemented at the function level, though, so there is no coalescing of constant values across functions.I added the function-level
ConstantPoolimplementation in order to support SIMD constants (which don't fit in the immediate fields of Cranelift's IR). This is not a pressing issue yet, but before other components start using constants, it might be good to discuss:
- should we implement constant pools at the global level and what would this look like?
- what should the relocation hooks look like for a more general constant pool implementation? Currently the interface looks like
RelocSink::reloc_constant(&mut self, CodeOffset, Reloc, ConstantOffset)and this may need to change.
fitzgen commented on issue #1385:
We've implemented per-function constant pools, and have a separate issue for using
.rodata, which can track the coalescing half of this issue's original purpose. So closing this issue.
Last updated: Oct 11 2026 at 02:20 UTC