[][src]Module cranelift_codegen::ir::constant

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

ConstantData

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.

ConstantPool

Maintains the mapping between a constant handle (i.e. Constant) and its constant data (i.e. ConstantData).

ConstantPoolEntry

Inner type for storing data and offset together in the constant pool. The offset is optional because it must be set relative to the function code size (i.e. constants are emitted after the function body); because the function is not yet compiled when constants are inserted, set_offset must be called once a constant's offset from the beginning of the function is known (see relaxation.rs).

Type Definitions

ConstantOffset

This type describes an offset in bytes within a constant pool.