[PATCH] D105714: WIP/RFC: Generic MachineInstr convenience wrappers.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 15:53:03 PDT 2021


aemerson added a comment.

In D105714#2868345 <https://reviews.llvm.org/D105714#2868345>, @arsenm wrote:

> I've thought we should have something that looks like llvm::Instruction and SDNode hiearachies so you can still do things like dyn_cast to a specific instruction type. Plus the current getOperand+getReg is really ugly given that most every operation can only use registers.
>
> Can you change this to make dyn_cast work, rather than having to construct a wrapper class? I guess that would add a GMI subclass to MachineInstr, and then opcode specific subclasses of that.



In D105714#2868345 <https://reviews.llvm.org/D105714#2868345>, @arsenm wrote:

> I've thought we should have something that looks like llvm::Instruction and SDNode hiearachies so you can still do things like dyn_cast to a specific instruction type. Plus the current getOperand+getReg is really ugly given that most every operation can only use registers.
>
> Can you change this to make dyn_cast work, rather than having to construct a wrapper class? I guess that would add a GMI subclass to MachineInstr, and then opcode specific subclasses of that.

Sure, I've made a separate patch for that discussion in D105751 <https://reviews.llvm.org/D105751>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105714/new/

https://reviews.llvm.org/D105714



More information about the llvm-commits mailing list