[PATCH] Add support for negative immediates to TableGen AsmMatcherEmitter

Jordy Potman jordypotman at gmail.com
Sun Jan 11 09:37:56 PST 2015


For the LLVM backend
(https://github.com/ucb-bar/riscv-llvm/tree/riscv-trunk) for the
RISC-V architecture (http://riscv.org/) I would like to create an
InstAlias with a negative immediate, i.e.:

def NOT : InstAlias<"not $dst, $src", (XORI GR32:$dst, GR32:$src, -1)>;

However the TableGen AsmMatcherEmitter currently generates invalid
enum values for negative immediates:

lib/Target/RISCV/RISCVGenAsmMatcher.inc:95:11: error: expected '=
constant-expression' or end of enumerator definition
  CVT_imm_-1,
          ^

The attached patch adds support for negative immediates to the
TableGen AsmMatcherEmitter.

Jordy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AsmMatcherEmitter-neg-imm.patch
Type: application/octet-stream
Size: 877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150111/91b9da2e/attachment.obj>


More information about the llvm-commits mailing list