[PATCH] D23601: [TII] add new target hook isAdd

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 12:06:20 PDT 2016


> On Aug 18, 2016, at 2:21 AM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> hfinkel added a subscriber: hfinkel.
> hfinkel added a comment.
> 
> In https://reviews.llvm.org/D23601#518810, @qcolombet wrote:
> 
>> Hi,
>> 
>> If we start adding more semantic of the instructions to TargetInstrInfo, I think we need to think more broadly on how to do that. Otherwise, I am afraid the API will not be consistent on the long run. E.g., why would we have isAdd and not isSub?
>> To be fair, the API is probably already broken, but there is not bad time to start fixing the problems :).
>> 
>> I am supportive of the idea of adding semantic, I am not convince a bunch of target hooks is necessarily the best approach or at least, having to populate those target hooks by hand.
>> At the very least, we should be able to annotate the instruction with isAdd in the td file and generate the hook in tablegen.
>> 
>> Cheers,
>> -Quentin
> 
> 
> I'd really like an interface that allows converting from an MI entity to something with known semantics; I think that, with the new generic opcodes being introduced for GlobalISel, we have a good opportunity here. How about the following interface (modulo bikeshedding)?
> 
>  MachineOperand *Op0, *Op1, *Op2;
>  if (TII->convertToGenericOp(MI, Op0, Op1, Op2) == G_ADD) {
>    // This MI is equivalent to Op0 = G_ADD Op1, Op2
>  }
> 

That would work for me.

> 
> https://reviews.llvm.org/D23601
> 
> 
> 



More information about the llvm-commits mailing list