[LLVMdev] A few questions from a newbie
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Apr 20 11:21:55 PDT 2009
Peter Bacon <peter.b.bacon at gmail.com> writes:
> Your suggestion works! But instead of using the Pat<>, I am using
>
> def MOVE_ADDR : MYInst<(outs Int32Regs:$dst), (ins i32mem:$a),
> "move $dst, $a;",
> [(set Int32Regs:$dst, (Wrapper tglobaladdr:$a))]>;
This is fine.
> I don't quite understand what the semantics of Pat in general. Could you please explain what
>
> def : Pat<(BfinWrapper (i32 tglobaladdr:$addr)),
> (LOAD32imm tglobaladdr:$addr)>;
>
> means?
It means the same as the pattern you wrote above. You could also have
written:
def MOVE_ADDR : MYInst<(outs Int32Regs:$dst), (ins i32mem:$a),
"move $dst, $a;", []>;
def : Pat<(Wrapper tglobaladdr:$a), (MOVE_ADDR i32mem:$a)>;
Pat<A,B> simply means "replace A by B" in the DAG. It is useful if you
have more than one pattern for a single instruction, or if you want to
use multiple instructions in a pattern replacement.
More information about the llvm-dev
mailing list