[llvm-bugs] [Bug 38802] New: Rewrite the 'CBR' instruction to an InstAlias in TableGen

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 1 05:44:06 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38802

            Bug ID: 38802
           Summary: Rewrite the 'CBR' instruction to an InstAlias in
                    TableGen
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AVR
          Assignee: unassignedbugs at nondot.org
          Reporter: me at dylanmckay.io
                CC: llvm-bugs at lists.llvm.org

Rewrite the 'CBR' instruction, which is currently implemented as a hardware
instruction, to an instruction alias of 'ANDI Rd, COM(K)'.

This will fix this compilation warning:

===============
[423/492] Building AVRGenDisassemblerTables.inc...
Decoding Conflict:
                0111............
                01..............
                ................
        ANDIRdK 0111____________
        CBRRdK 0111____________
================

This is the only remaining instruction that needs to be converted to an alias.

This particular instruction is complicated because the alias is not so simple -
we need to complement an immediate operand before MCInst lowering.

This is currently done inside a PostEncoder method on a custom immediate
operand type in TableGen.


def imm_com8 : Operand<i8>
{
  let EncoderMethod = "encodeComplement";

  let MIOperandInfo = (ops i8imm);
}

Here is the naive InstAlias implementation

 // CBR Rd, K
 //
 // Mnemonic alias to 'AND Rd, COM(K)'. Same bit pattern, same operands,
 // same everything. K must be complemeted.
 def : InstAlias<"cbr\t$rd, $k",
                 (ANDI LD8:$rd, imm_com8:$k), /* the immediate K must be
complemented. */
                 /* Disable display, so we don't override ORI */ 0>;

It appears that the PostEncoder method of 'imm_com8' is ignored. This is likely
because the InstAlias mapping is done at a high layer, directly substituting
the CBR instruction for the ANDI well before the PostEncoder method is called
or even queried.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180901/df9783c7/attachment.html>


More information about the llvm-bugs mailing list