Cargo Features

[dependencies]
cranelift-codegen = { version = "0.115.0", default-features = false, features = ["std", "core", "disas", "trace-log", "unwind", "x86", "arm64", "s390x", "riscv64", "pulley", "host-arch", "all-arch", "all-native-arch", "enable-serde", "incremental-cache", "souper-harvest", "isle-errors", "timing"] }
default = host-arch, std, timing, unwind

These default features are set whenever cranelift-codegen is added without default-features = false somewhere in the dependency tree.

std default

The "std" feature enables use of libstd. The "core" feature enables use of some minimal std-like replacement libraries. At least one of these two features need to be enabled.

Enables std of optional serde

core

The "core" feature used to enable a hashmap workaround, but is now deprecated (we (i) always use hashbrown, and (ii) don't support a no_std build anymore). The feature remains for backward compatibility as a no-op.

disas = anyhow, capstone

Enable the to_capstone method on TargetIsa, for constructing a Capstone context, and the disassemble method on MachBufferFinalized.

Affects isa::TargetIsa.to_capstone

trace-log

Enables detailed logging which can be somewhat expensive.

Enables trace-log of regalloc2

unwind default = gimli

This enables unwind info generation functionality.

Affects isa::TargetIsa.map_regalloc_reg_to_dwarf, isa::TargetIsa.emit_unwind_info, isa::TargetIsa.create_systemv_cie, unwind::systemv, unwind::winx64, unwind::winarm64

x86 all-native-arch?

ISA targets for which we should build.
If no ISA targets are explicitly enabled, the ISA target for the host machine is enabled.

Affects isa::x64

arm64 all-native-arch?

Affects isa::aarch64

s390x all-native-arch?
riscv64 all-native-arch?

Affects isa::riscv64

pulley all-arch?

Enables disas and encode of pulley-interpreter

host-arch default

Enable the ISA target for the host machine

all-arch = all-native-arch, pulley

Option to enable all architectures.

all-native-arch all-arch? = arm64, riscv64, s390x, x86

Option to enable all architectures that correspond to an actual native target (that is, exclude Pulley).

enable-serde incremental-cache? = serde, serde_derive

For dependent crates that want to serialize some parts of cranelift

Enables serde of smallvec, enable-serde of cranelift-bitset, cranelift-entity, and regalloc2

Affects buffer::CompilePhase

incremental-cache = enable-serde, postcard, sha2

Enable the incremental compilation cache for hot-reload use cases.

Affects cranelift-codegen::incremental_cache

souper-harvest = souper-ir

Enable support for the Souper harvester.

Enables stringify of souper-ir

isle-errors build

Report any ISLE errors in pretty-printed style.

Enables fancy-errors of cranelift-isle

timing default

Enable tracking how long passes take in Cranelift.

Enabled by default.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

anyhow disas?
capstone disas?
serde enable-serde?
serde_derive enable-serde?
postcard incremental-cache?
gimli unwind
souper-ir souper-harvest?
sha2 incremental-cache?