Add support for tied operand constraints.

The register constraint for an output operand can be specified as an
integer indicating the input operand number to tie. The tied operands
must use the same register.

Generate operand constraints using ConstraintKind::Tied(n) for both the
tied operands. The n index refers to the opposite array. The input
operand refers to the outs array and vice versa.
This commit is contained in:
Jakob Stoklund Olesen
2017-05-08 15:21:00 -07:00
parent fedc834ecd
commit b3b15f9c32
3 changed files with 53 additions and 22 deletions

View File

@@ -33,13 +33,14 @@ pub enum ConstraintKind {
/// register.
FixedReg(RegUnit),
/// This result value must use the same register as an input value operand. Input operands
/// can't be tied.
/// This result value must use the same register as an input value operand.
///
/// The associated number is the index of the input value operand this result is tied to.
/// The associated number is the index of the input value operand this result is tied to. The
/// constraint's `regclass` field is the same as the tied operand's register class.
///
/// The constraint's `regclass` field is the top-level register class containing the tied
/// operand's register class.
/// When an (in, out) operand pair is tied, this constraint kind appears in both the `ins` and
/// the `outs` arrays. The constraint for the in operand is `Tied(out)`, and the constraint for
/// the out operand is `Tied(in)`.
Tied(u8),
/// This operand must be a value in a stack slot.