[LLVMdev] Tablegen: How to define an instruction that reads and writes the same register
Eli Friedman
eli.friedman at gmail.com
Thu Jan 19 18:25:24 PST 2012
On Thu, Jan 19, 2012 at 6:07 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> Hi,
>
> Is it possible to define an Instruction with tablegen that reads and
> writes the same register? For example, an increment instruction that
> reads a value from a register, adds one to it and then writes the result
> back to the same register.
Yes; you just write the instruction as if the dest and src are
distinct, then specify 'let Constraints = "$src1 = $dst"'. See for
example INC32r in the x86 backend.
-Eli
More information about the llvm-dev
mailing list