1[package]
2authors = ["The Cranelift Project Developers"]
3name = "cranelift-codegen"
4version = "0.121.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.121.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 }
46# It is a goal of the cranelift-codegen crate to have minimal external dependencies.
47# Please don't add any unless they are essential to the task of creating binary
48# machine code. Integration tests that need external dependencies can be
49# accommodated in `tests`.
50
51[dev-dependencies]
52criterion = { workspace = true }
53similar = "2.1.0"
54env_logger = { workspace = true }
55
56[build-dependencies]
57cranelift-codegen-meta = { path = "meta", version = "0.121.0" }
58cranelift-isle = { path = "../isle/isle", version = "=0.121.0" }
59
60[features]
61default = ["std", "unwind", "host-arch", "timing"]
62
63# The "std" feature enables use of libstd. The "core" feature enables use
64# of some minimal std-like replacement libraries. At least one of these two
65# features need to be enabled.
66std = ["serde?/std"]
67
68# The "core" feature used to enable a hashmap workaround, but is now
69# deprecated (we (i) always use hashbrown, and (ii) don't support a
70# no_std build anymore). The feature remains for backward
71# compatibility as a no-op.
72core = []
73
74# Enable the `to_capstone` method on TargetIsa, for constructing a Capstone
75# context, and the `disassemble` method on `MachBufferFinalized`.
76disas = ["anyhow", "capstone"]
77
78# Enables detailed logging which can be somewhat expensive.
79trace-log = ["regalloc2/trace-log"]
80
81# This enables unwind info generation functionality.
82unwind = ["gimli"]
83
84# ISA targets for which we should build.
85# If no ISA targets are explicitly enabled, the ISA target for the host machine is enabled.
86x86 = []
87arm64 = []
88s390x = []
89riscv64 = []
90pulley = [
91    "dep:pulley-interpreter",
92    "pulley-interpreter/encode",
93    "pulley-interpreter/disas",
94    "cranelift-codegen-meta/pulley",
95]
96# Enable the ISA target for the host machine
97host-arch = []
98
99# Option to enable all architectures.
100all-arch = ["all-native-arch", "pulley"]
101
102# Option to enable all architectures that correspond to an actual native target
103# (that is, exclude Pulley).
104all-native-arch = ["x86", "arm64", "s390x", "riscv64"]
105
106# For dependent crates that want to serialize some parts of cranelift
107enable-serde = [
108    "serde",
109    "serde_derive",
110    "cranelift-entity/enable-serde",
111    "cranelift-bitset/enable-serde",
112    "regalloc2/enable-serde",
113    "smallvec/serde",
114]
115
116# Enable the incremental compilation cache for hot-reload use cases.
117incremental-cache = ["enable-serde", "postcard", "sha2"]
118
119# Enable support for the Souper harvester.
120souper-harvest = ["souper-ir", "souper-ir/stringify"]
121
122# Report any ISLE errors in pretty-printed style.
123isle-errors = ["cranelift-isle/fancy-errors"]
124
125# Enable tracking how long passes take in Cranelift.
126#
127# Enabled by default.
128timing = []
129
130[[bench]]
131name = "x64-evex-encoding"
132harness = false
133