| 217 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
| 218 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
| 219 | pub enum OperandKind { |
| 220 | /// A write of a `Value`. |
| 221 | /// |
| 222 | /// The SSA property requires that each `Value` only be defined in a single |
| 223 | /// place in the entire function. |
| 224 | Def(Value), |
| 225 | |
| 226 | /// A read of a `Value`. |
| 227 | Use(Value), |
| 228 | |
| 229 | /// An "early" write of a `Value`. |
| 230 | /// |
| 231 | /// Normally, the same `PhysReg` may be assigned to a `Use` and a `Def` |
| 232 | /// operand because these are assumed to have non-overlapping live ranges. |
| 233 | /// To avoid this, an `EarlyDef` operand can be used. It is identical to a |
| 234 | /// `Def` except that it is guaranteed not to conflict with any input |
| 235 | /// operand. |
| 236 | /// |
| 237 | /// `EarlyDef` is primarily useful for pseudo-instructions that expand to |
| 238 | /// multiple instruction after register allocation. In such sequences, an |
| 239 | /// output or scratch register may need to be written to before all input |
| 240 | /// registers have been read. |
| 241 | EarlyDef(Value), |
| 242 | |
| 243 | /// A write of a group of `Value`s. |
| 244 | /// |
| 245 | /// This is analogous to [`OperandKind::Def`] but requires that the |
| 246 | /// corresponding constraint use an [`OperandConstraint::Class`] with a |
| 247 | /// register class that has same group size as the [`ValueGroup`]. |
| 248 | DefGroup(ValueGroup), |
| 249 | |
| 250 | /// A read of a group of `Value`s. |
| 251 | /// |
| 252 | /// This is analogous to [`OperandKind::Use`] but requires that the |
| 253 | /// corresponding constraint use an [`OperandConstraint::Class`] with a |
| 254 | /// register class that has same group size as the [`ValueGroup`]. |
| 255 | UseGroup(ValueGroup), |
| 256 | |
| 257 | /// An "early" write of a group of `Value`s. |
| 258 | /// |
| 259 | /// This is analogous to [`OperandKind::EarlyDef`] but requires that the |
| 260 | /// corresponding constraint use an [`OperandConstraint::Class`] with a |
| 261 | /// register class that has same group size as the [`ValueGroup`]. |
| 262 | EarlyDefGroup(ValueGroup), |
| 263 | |
| 264 | /// Use of a fixed non-allocatable register. |
| 265 | /// |
| 266 | /// This must be used with `OperandConstraint::Fixed`. The given `PhysReg` |
| 267 | /// is directly assigned to the operand without tracking its live range for |
| 268 | /// checking interferences. |
| 269 | /// |
| 270 | /// This is intended for use with reserved registers that are manually |
| 271 | /// managed by the client such as the stack pointer or a hardware zero |
| 272 | /// register. It must not be used with a `PhysReg` that is part of an |
| 273 | /// allocatable register class. |
| 274 | NonAllocatable, |
| 275 | } |
| 276 |
nothing calls this directly
no outgoing calls
no test coverage detected