1[package]
2authors = ["The Cranelift Project Developers"]
3name = "cranelift-codegen"
4version = "0.131.1"
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 = { workspace = true }
26capstone = { workspace = true, optional = true }
27cranelift-assembler-x64 = { workspace = true }
28cranelift-codegen-shared = { path = "./shared", version = "0.131.1" }
29cranelift-entity = { workspace = true }
30cranelift-bforest = { workspace = true }
31cranelift-bitset = { workspace = true }
32cranelift-control = { workspace = true }
33hashbrown = { workspace = true, features = ["default-hasher"] }
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"], 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-core = { workspace = true }
47libm = { workspace = true }
48# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
49# Please don't add any unless they are essential to the task of creating binary
50# machine code. Integration tests that need external dependencies can be
51# accommodated in `tests`.
52
53[dev-dependencies]
54criterion = { workspace = true }
55similar = "2.1.0"
56env_logger = { workspace = true }
57proptest = { workspace = true }
58
59[build-dependencies]
60cranelift-codegen-meta = { path = "meta", version = "0.131.1" }
61cranelift-isle = { path = "../isle/isle", version = "=0.131.1" }
62
63[features]
64default = ["std", "unwind", "host-arch", "timing"]
65
66# The "std" feature enables use of libstd. The "core" feature enables use
67# of some minimal std-like replacement libraries. At least one of these two
68# features need to be enabled.
69std = ["serde?/std", "rustc-hash/std", "gimli/std", "cranelift-control/fuzz"]
70
71# The "core" feature used to enable a hashmap workaround, but is now
72# deprecated (we (i) always use hashbrown, and (ii) don't support a
73# no_std build anymore). The feature remains for backward
74# compatibility as a no-op.
75core = []
76
77# Enable the `to_capstone` method on TargetIsa, for constructing a Capstone
78# context, and the `disassemble` method on `MachBufferFinalized`.
79disas = ["anyhow", "capstone"]
80
81# Enables detailed logging which can be somewhat expensive.
82trace-log = ["regalloc2/trace-log"]
83
84# By default, an ISLE term is compiled into a single Rust function, but it can be
85# significantly inefficient for large terms (e.g. `simplify` with hundreds of rules).
86# This is because the generated Rust code for such terms is large, and `rustc` takes quadratically longer to compile huge functions.
87# This feature splits large match arms in such ISLE terms into closures, for compiling ISLE terms more efficiently.
88# However, this can degrade Cranelift compilation times, introducing ABI boundaries between the closures.
89# Therefore, we recommend enabling this feature only for debugging/development purposes.
90isle-split-match = []
91
92# This enables unwind info generation functionality.
93unwind = ["gimli"]
94
95# ISA targets for which we should build.
96# If no ISA targets are explicitly enabled, the ISA target for the host machine is enabled.
97x86 = []
98arm64 = []
99s390x = []
100riscv64 = []
101pulley = [
102    "dep:pulley-interpreter",
103    "pulley-interpreter/encode",
104    "pulley-interpreter/disas",
105    "cranelift-codegen-meta/pulley",
106]
107# Enable the ISA target for the host machine
108host-arch = []
109
110# Option to enable all architectures.
111all-arch = ["all-native-arch", "pulley"]
112
113# Option to enable all architectures that correspond to an actual native target
114# (that is, exclude Pulley).
115all-native-arch = ["x86", "arm64", "s390x", "riscv64"]
116
117# For dependent crates that want to serialize some parts of cranelift
118enable-serde = [
119    "serde",
120    "serde_derive",
121    "cranelift-entity/enable-serde",
122    "cranelift-bitset/enable-serde",
123    "regalloc2/enable-serde",
124    "smallvec/serde",
125]
126
127# Enable the incremental compilation cache for hot-reload use cases.
128incremental-cache = ["enable-serde", "postcard", "sha2"]
129
130# Enable support for the Souper harvester.
131souper-harvest = ["souper-ir", "souper-ir/stringify"]
132
133# Report any ISLE errors in pretty-printed style.
134isle-errors = ["cranelift-isle/fancy-errors"]
135
136# Enable tracking how long passes take in Cranelift.
137#
138# Enabled by default.
139timing = []
140