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

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


aemerson created this revision.
aemerson added reviewers: arsenm, paquette, qcolombet, foad, dsanders, aditya_nandakumar.
aemerson added a project: LLVM.
Herald added a subscriber: hiraditya.
aemerson requested review of this revision.
Herald added a subscriber: wdng.

Instead of code patterns like:

  if (MI.getOpcode() == TargetOpcode::G_LOAD)
    Ptr = MI.getOperand(1);

having some wrappers could make the opcode checking a bit shorter, and also allow us to define some abstractions over the raw MachineInstr specific to a particular generic operation. Here's an example of how that could work with G_LOAD, using automatic `bool` and `MachineInstr*` conversions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105714

Files:
  llvm/include/llvm/CodeGen/GlobalISel/GenericInstWrapper.h
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105714.357558.patch
Type: text/x-patch
Size: 4692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210709/9c708ba6/attachment.bin>


More information about the llvm-commits mailing list