[PATCH] D22820: RFC[GlobalISel]: improved interface or unholy monstrosity?

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 10:18:31 PDT 2016


t.p.northover created this revision.
t.p.northover added reviewers: ab, qcolombet, arsenm.
t.p.northover added a subscriber: llvm-commits.
t.p.northover set the repository for this revision to rL LLVM.
Herald added subscribers: mcrosier, vkalintiris, mehdi_amini.

Hi,

I've been thinking about how to make MachineInstrBuilder scale as pleasantly as possible, and come up with this idea. Basically, instead of

    MIRBuilder.buildInstr(Opcode, Ty, Res, Op0, Op1);

you'd have to write

    MIRBuilder.buildInstr(Opcode, Ty, MIB::Def(Res), MIB::Use(Op0), MIB::Use(Op1));

(and similar). This has a few advantages:

  * Removes the implicit specialness of the first register (inherited from BuildMI, where it's caught out at least two people I know of, including me).
  * Allows other kinds of operands that we'll want to be handled uniformly (FrameIndex, MBB, Imm, ...).

On the other hand, there are disadvantages:

  * The usual opaque template error messages when you get it wrong.
  * More verbose in the common case of single-def, multiple-uses, register only (instructions like this will be less common for target opcodes than generic ones though).
  * Feels like a minor riff on the old MachineInstrBuilder interface. Perhaps what we'd have used then if we had variadic templates, or perhaps there's a good reason we didn't?

Anyone got any feelings? On the whole I think it has potential.

Repository:
  rL LLVM

https://reviews.llvm.org/D22820

Files:
  include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
  lib/CodeGen/GlobalISel/IRTranslator.cpp
  lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
  lib/Target/AArch64/AArch64CallLowering.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22820.65547.patch
Type: text/x-patch
Size: 7523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160726/41135b28/attachment.bin>


More information about the llvm-commits mailing list