cranelift_codegen::ir

Module constant

Source
Expand description

Constants

The constant pool defined here allows Cranelift to avoid emitting the same constant multiple times. As constants are inserted in the pool, a handle is returned; the handle is a Cranelift Entity. Inserting the same data multiple times will always return the same handle.

Future work could include:

  • ensuring alignment of constants within the pool,
  • bucketing constants by size.

Structsยง

  • This type describes the actual constant data. Note that the bytes stored in this structure are expected to be in little-endian order; this is due to ease-of-use when interacting with WebAssembly values, which are little-endian by design.
  • Maintains the mapping between a constant handle (i.e. Constant) and its constant data (i.e. ConstantData).