首页 > 解决方案 > “节点变换‘集合’需要一个操作数!” 尝试使用 tablegen 时

问题描述

我试图让 C65 LLVM 后端(https://github.com/Peppar/llvm-C65)与 LLVM 8.0.1 (如果为 LLVM 3 制作的原始版本)一起工作。经过几次修复后,一切都正确编译,但 TableGen 产生了一些错误。

错误信息都是这样的:

add_frag(dst, src1, src2):  (set node:{}:$dst, (add:{} node:{}:$src1, node:{}:$src2))
Included from F:/Projects/llvm-65816/lib/Target/C65/C65.td:59:
F:/Projects/llvm-65816/lib/Target/C65\C65InstrInfo.td:1353:1: error: In add_frag: Node transform 'set' requires one operand! (got 2)
def add_frag : PatFrag<(ops node:$dst, node:$src1, node:$src2),
^

这是导致它的行(在https://github.com/Peppar/llvm-C65/blob/master/C65InstrInfo.td#L1353):

def add_frag : PatFrag<(ops node:$dst, node:$src1, node:$src2),
                       (set node:$dst, (add node:$src1, node:$src2))>;

TableGen 语言没有像 LLVM IR 那样有据可查,所以我正在努力找出问题所在,但我认为这是由类型引起的。

我有以下问题:

  1. 如何解决?
  2. 是什么node意思,为什么在这种情况下这是一个问题(如果是的话)?

标签: llvm

解决方案


推荐阅读