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