| 339 | #[inline] |
| 340 | #[must_use] |
| 341 | pub fn new(kind: OperandKind, constraint: OperandConstraint) -> Self { |
| 342 | let kind_field = match kind { |
| 343 | #[allow(clippy::identity_op)] |
| 344 | OperandKind::Def(value) => (0 << 29) | value.index() as u32, |
| 345 | OperandKind::Use(value) => (1 << 29) | value.index() as u32, |
| 346 | OperandKind::EarlyDef(value) => (2 << 29) | value.index() as u32, |
| 347 | OperandKind::DefGroup(group) => (3 << 29) | group.index() as u32, |
| 348 | OperandKind::UseGroup(group) => (4 << 29) | group.index() as u32, |
| 349 | OperandKind::EarlyDefGroup(group) => (5 << 29) | group.index() as u32, |
| 350 | OperandKind::NonAllocatable => 6 << 29, |
| 351 | }; |
| 352 | let constraint = match constraint { |
| 353 | #[allow(clippy::identity_op)] |
| 354 | OperandConstraint::Class(class) => (0 << 14) | class.index() as u16, |
| 355 | OperandConstraint::Fixed(reg) => (1 << 14) | reg.index() as u16, |
| 356 | OperandConstraint::Reuse(index) => (2 << 14) | index as u16, |
| 357 | }; |
| 358 | Self { |
| 359 | kind: kind_field, |
| 360 | constraint, |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | /// Create an `Operand` that designates a use of a `Value` that must be in |
| 365 | /// a register from the given register class. This value is read by the |