[LLVMdev] How to use property 'isCommutable' in target description file?

Anton Korobeynikov anton at korobeynikov.info
Mon Dec 7 04:42:34 PST 2009


> How can i tell the system X=A*B + C == X = B*A + C == X=C+A*B == X=C+B*A by
> property 'isCommutable'? Is it necessary to do that?
Most probably you will need to write a special hook to commute this
instruction. However, everything depends on your target (e.g. if there
is an output register tied to one of the input).

> ***  Another question: Why set isCommutable = 1 in ADD16rr but NOT set in
> ADD16ri?
Because all msp430 instructions are two-address, this means that
output register is tied to first input. That's why you cannot swap
operands for reg-imm operations.

With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University

More information about the llvm-dev mailing list