[LLVMdev] Tablegen: How to define an instruction that reads and writes the same register
Peter Cooper
peter_cooper at apple.com
Thu Jan 19 18:28:57 PST 2012
Hi Tom
This is frequently done in the x86 target using a tablegen constraint.
For example, from X86InstrArithmetic.td we have
let Constraints = "$src1 = $dst" in {
def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1),
"inc{b}\t$dst",
[(set GR8:$dst, EFLAGS, (X86inc_flag GR8:$src1))]>;
}
Thanks,
Pete
On Jan 19, 2012, at 6:07 PM, Tom Stellard 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.
>
> Thanks,
> Tom
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list