constraining two virtual registers to be the same physical register

Does anyone know if there is a way to constrain two virtual registers to be allocated
to the same physical register?

Tia.

Reed

Hi Reed

You can do this on the instruction itself by telling it 2 operands must be the same register. For example, from X86:

let Constraints = “$src1 = $dst” in
defm INSERTPS : SS41I_insertf32<0x21, “insertps”>;

Thanks,
Pete

Hi Pete, Sorry. I should have been more specific. I’m looking for a way to do this in c++. I’m aware of how it is done in tablegen. Reed

Hi Pete, Sorry. I should have been more specific. I’m looking for a way to do this in c++.

Ah, in that case have a look at MachineInstr::tieOperands.

Thanks,
Pete

That did the trick. Thanks. Reed