-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-design constant pools #1385
Comments
@cfallin, now that I think I understand the new backend better, I think this issue can be moved a bit further: How things currently work in the new backend:
To simplify the creation of vector constants (all constants, really):
To keep ConstantPool's de-duplicated values AND allow const_addr to retrieve the address of a constant:
When the old backend goes away:
|
Hi @abrown -- thanks for the detailed look into this!
The API expects the client (so, the lowering code) to allocate its own labels, and specify the label for each constant. So the most straightforward thing to do here would be, for constants in the I think we should probably build that first before deduplication at the MachInst-lowering level; I'm not fully convinced that the overhead of a hashmap lookup on every new constant generation is worth the potential code-size reduction (but we should measure). So I would say we should:
|
Yeah, I like this better. I'll try it out and see what happens! |
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_addr
and 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
ConstantPool
implementation 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:RelocSink::reloc_constant(&mut self, CodeOffset, Reloc, ConstantOffset)
and this may need to change.The text was updated successfully, but these errors were encountered: