[llvm-dev] Removing the register block in MIR

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 20 17:07:01 PDT 2017


The MIR format currently has a short-hand syntax for declaring vreg
classes and banks in the function body so you can write something like
this:

  name: foo
  body: |
    %3:gpr(s64) = ...

rather than the much more verbose and awkward:

  name: foo
  registers:
    - { id: 3, class: gpr }
  body: |
    %3(s64) = ...

I'd like to make this shorthand the only way to do this. There are a few
things that need to be handled here:

- We should only print the class on defs, not all uses. This is
  sufficient to be unambiguous, easy to be consistent, and avoids
  getting in the way of readability.

- We'll still need to track the preferred-register elsewhere, so we'll
  still need a block for those. They're used far less often than
  classes though, so I think its fine to just let them have their own
  block when any of them are set.

- Basically every single MIR test will need to be updated, and its
  awkward to do automatically unless the test is already using the
  update_mir_test_checks script.

I plan to implement this in a couple of steps:

1. Teach the MIRPrinter to print the regclass and update test checks
2. Modify existing tests to never provide the registers block
3. Move preferred-registers to their own block and remove the registers block

A patch for step 1 is attached (with the other 241 test updates omitted
for brevity). I don't expect this direction to be contentious, but since
the change will touch so many files I'll wait until Monday or Tuesday to
start committing in case anyone has any concerns.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mir-print-vregs.patch
Type: text/x-patch
Size: 5056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171020/8649af80/attachment.bin>


More information about the llvm-dev mailing list