Help required in instruction selection.

Dear,

I have the following problem.

I am given 2 instructions say I1 and I2 whose selection should depend on the operands.

Say the operands have a boolean attribute ‘attr’. I would like to select I1 and I2 by some logic that involves the ‘attr’ attribute of all the operands involved.

eg: If all operands have attr set to True, I want I1 to be selected to operate else I2.

How can I add an attribute to the operands?
How will the values of these attributes be set?

How should to select the instructions based on the logic?

Hi Pratik,

Say the operands have a boolean attribute 'attr'. I would like to select I1
and I2 by some logic that involves the 'attr' attribute of all the operands
involved.

What does this attribute represent? It's possible LLVM already has an
analogue and uses a different way to get the right code out.

In general operands don't have many intrinsic attributes: type is the
main one. Though different kinds of operands have more information
attached.

Cheers.

Tim.

Dear Tim,

I am working on a cryptography project. So I need the operand to have a boolean attribute say Encrypted. If the operands are encrypted I want to use say ADD* instruction else the the ADD instruction.

I was hoping to find answers for How to add a new instruction to the backend and how to modify the ISel mechanism such that the above requirement is fulfilled.

Regards,
Pratik