1[package]
2authors = ["The Cranelift Project Developers"]
3name = "cranelift-codegen"
4version = "0.128.0"
5description = "Low-level code generator library"
6license = "Apache-2.0 WITH LLVM-exception"
7documentation = "https://docs.rs/cranelift-codegen"
8repository = "https://github.com/bytecodealliance/wasmtime"
9categories = ["no-std"]
10readme = "README.md"
11keywords = ["compile", "compiler", "jit"]
12build = "build.rs"
13edition.workspace = true
14rust-version.workspace = true
15
16[lints]
17workspace = true
18
19[package.metadata.docs.rs]
20# Ask Cargo to build docs with the feature `all-arch`
21features = ["all-arch"]
22
23[dependencies]
24anyhow = { workspace = true, optional = true, features = ['std'] }
25bumpalo = "3"
26capstone = { workspace = true, optional = true }
27cranelift-assembler-x64 = { workspace = true }
28cranelift-codegen-shared = { path = "./shared", version = "0.128.0" }
29cranelift-entity = { workspace = true }
30cranelift-bforest = { workspace = true }
31cranelift-bitset = { workspace = true }
32cranelift-control = { workspace = true }
33hashbrown = { workspace = true }
34target-lexicon = { workspace = true }
35log = { workspace = true }
36serde = { workspace = true, optional = true }
37serde_derive = { workspace = true, optional = true }
38pulley-interpreter = { workspace = true, optional = true }
39postcard = { workspace = true, optional = true }
40gimli = { workspace = true, features = ["write", "std"], optional = true }
41smallvec = { workspace = true }
42regalloc2 = { workspace = true, features = ["checker"] }
43souper-ir = { version = "2.1.0", optional = true }
44sha2 = { version = "0.10.2", optional = true }
45rustc-hash = { workspace = true }
46wasmtime-math = { workspace = true }
47# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
48# Please don't add any unless they are essential to the task of creating binary
49# machine code. Integration tests that need external dependencies can be
50# accommodated in `tests`.
51
52[dev-dependencies]
53criterion = { workspace = true }
54similar = "2.1.0"
55env_logger = { workspace = true }
56proptest = { workspace = true }
57
58[build-dependencies]
59cranelift-codegen-meta = { path = "meta", version = "0.128.0" }
60cranelift-isle = { path = "../isle/isle", version = "=0.128.0" }
61
62[features]
63default = ["std", "unwind", "host-arch", "timing"]
64
65# The "std" feature enables use of libstd. The "core" feature enables use
66# of some minimal std-like replacement libraries. At least one of these two
67# features need to be enabled.
68std = ["serde?/std"]
69
70# The "core" feature used to enable a hashmap workaround, but is now
71# deprecated (we (i) always use hashbrown, and (ii) don't support a
72# no_std build anymore). The feature remains for backward
73# compatibility as a no-op.
74core = []
75
76# Enable the `to_capstone` method on TargetIsa, for constructing a Capstone
77# context, and the `disassemble` method on `MachBufferFinalized`.
78disas = ["anyhow", "capstone"]
79
80# Enables detailed logging which can be somewhat expensive.
81trace-log = ["regalloc2/trace-log"]
82
83# This enables unwind info generation functionality.
84unwind = ["gimli"]
85
86# ISA targets for which we should build.
87# If no ISA targets are explicitly enabled, the ISA target for the host machine is enabled.
88x86 = []
89arm64 = []
90s390x = []
91riscv64 = []
92pulley = [
93    "dep:pulley-interpreter",
94    "pulley-interpreter/encode",
95    "pulley-interpreter/disas",
96    "cranelift-codegen-meta/pulley",
97]
98# Enable the ISA target for the host machine
99host-arch = []
100
101# Option to enable all architectures.
102all-arch = ["all-native-arch", "pulley"]
103
104# Option to enable all architectures that correspond to an actual native target
105# (that is, exclude Pulley).
106all-native-arch = ["x86", "arm64", "s390x", "riscv64"]
107
108# For dependent crates that want to serialize some parts of cranelift
109enable-serde = [
110    "serde",
111    "serde_derive",
112    "cranelift-entity/enable-serde",
113    "cranelift-bitset/enable-serde",
114    "regalloc2/enable-serde",
115    "smallvec/serde",
116]
117
118# Enable the incremental compilation cache for hot-reload use cases.
119incremental-cache = ["enable-serde", "postcard", "sha2"]
120
121# Enable support for the Souper harvester.
122souper-harvest = ["souper-ir", "souper-ir/stringify"]
123
124# Report any ISLE errors in pretty-printed style.
125isle-errors = ["cranelift-isle/fancy-errors"]
126
127# Enable tracking how long passes take in Cranelift.
128#
129# Enabled by default.
130timing = []
131