default operation action

Hi Guys,

I noticed that the operation actions( promote/expand/custom) are set per operation basis.
Wondering if we can set it up globally?

For example, I have native supported 32 bits registers, to handle 8 bits value operations, I want to do promote.
and to support 64 bit operations, I want to expand.

If I can set up the operation actions for the same type globally, then I can avoid to list all the operations with the same action .
like

// expand type MVT::i64 to MVT::i32 for all the operations

instead of

  setOperationAction( ISD::ADD, MVT::i64, Expand);
  setOperationAction( ISD::SUB, MVT::i64, Expand);
  setOperationAction( ISD::MUL, MVT::i64, Expand);
…..

Or LLVM is smart enough to do it buy default?

best

kevin

Hi Kevin,

You can put your operations in an array and then you can loop around the setOperationAction, such as:

loop i:
setOperationAction (your_array[i], MVT::i64, Expand)

end loop.

That’s it.

Regards,
Erkan.

And of course with a nested loop, you can apply setOperationAction of an operation for different MVT types. To do this, you need to keep an array of types as well.

Hi Guys,

I noticed that the operation actions( promote/expand/custom) are set per operation basis.
Wondering if we can set it up globally?

For example, I have native supported 32 bits registers, to handle 8 bits value operations, I want to do promote.
and to support 64 bit operations, I want to expand.

This will happen automatically if you don't declare i8 as a legal type.
Do you have something like addRegisterClass(MVT::i8, SomeRegClass) in
your TargetLowering constructor? If so, then remove it and see what
happens.

-Tom