[PATCH] D42293: [TableGen][AsmMatcherEmitter] Fix tied-constraint checking for InstAliases

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 05:40:52 PST 2018


sdesmalen created this revision.
sdesmalen added reviewers: olista01, rengolin, mcrosier, fhahn, craig.topper, echristo, apazos, dsanders.

This is a bit of a reimplementation the work done in
https://reviews.llvm.org/D41446, since that patch only really works for
tied operands of instructions, not aliases.

Instead of checking the constraints based on the matched instruction's opcode,
this patch uses the match-info's convert function to check the operand
constraints for that specific instruction/alias.
This is based on the matched operands for the instruction, not the
resulting opcode of the MCInst.

This patch adds the following enum/table to the *GenAsmMatcher.inc file:

  enum {
    Tie0_1_1,
    Tie0_1_2,
    Tie0_1_5,
    ...
  };
  
  const char TiedAsmOperandTable[][3] = {
    /* Tie0_1_1 */ { 0, 1, 1 },
    /* Tie0_1_2 */ { 0, 1, 2 },
    /* Tie0_1_5 */ { 0, 1, 5 },
    ...
  };

And it is referenced directly in the ConversionTable, like this:
static const uint8_t ConversionTable[CVT_NUM_SIGNATURES][13] = {

  ...
  { CVT_95_addRegOperands, 1,
    CVT_95_addRegOperands, 2,
    CVT_Tied, Tie0_1_5,
    CVT_95_addRegOperands, 6, CVT_Done },
  ...

The Tie0_1_5 (and corresponding table) encodes that:

- Result operand 0 is the operand to copy (which is e.g. done when building up the operands to the MCInst in convertToMCInst())
- Asm operands 1 and 5 should be the same operands (which is checked in checkAsmTiedOperandConstraints()).


https://reviews.llvm.org/D42293

Files:
  utils/TableGen/AsmMatcherEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42293.130591.patch
Type: text/x-patch
Size: 21625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180119/a852d0dc/attachment.bin>


More information about the llvm-commits mailing list