Hi,
I am writing simple pattern in td that uses immediate and shall print
it in assembler in two parts. Say for input immediate i:
i1 = i << 2
i2 = i & 3
I want something like (simplified tablegen pseudocode):
def MYINSN : Insn<(outs MyOut:$r0), (ins MyReg:$r1, MyImm32:$i),
"prefix $i1 body $r0, $r1, $i2",
[(... some pattern here)]>;
In Insn pattern whole string goes to AsmString property.
How can I do it with tablegen? Any examples from existing backends?
P.S. Of course I can do custom node with one more parameter and write
pattern matching in DAGToDAG selection, etc. I just wonder: may be
there is some surprising tablegen magic to do it quickly in-place? In
GCC md patterns allows C-code snippets for such cases, but in LLVM I
can not find such possibility.