[llvm-dev] How to add and test new pseudo instruction
Nemanja Ivanovic via llvm-dev
llvm-dev at lists.llvm.org
Mon Apr 18 06:48:22 PDT 2016
Maybe I don't follow exactly what you're trying to do but it seems like
something you can solve with an intrinsic that you can put in an SDAG
pattern and create a builtin for clang to emit this intrinsic. There are
many examples of this in include/llvm/IR/Intrinsics<TargetName>.td and the
respective target's instruction info .td files.
For a completely random example on PowerPC, you can see the
On Sat, Apr 16, 2016 at 11:06 AM, Vladimir Miloserdov via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I want to add new register to Sparc back-end for educational purposes.
> I also want to add new pseudo instruction that would add its argument
> to this register. And the most complicated (to my mind) - I want to be
> able to test (use) it from C source: something like int x = 5;
> __domyinstruction(x); /* adds five */ int y = __getmyregister();
> I think I can add register (by simply add a line to
> SparcRegisterInfo.td file). But adding instruction is a bit more
> complicated as I have to add a SelectionDAG pattern in
> SparcInstrInfo.td. As far as I understand I have to add:
> def MYINSTRUCTION: Pseudo<(outs IntRegs:$dst), (ins IntRegs:$src),
> "; some asm code", [SelectionDAG pattern list]>;
> So I don't know how to write this pattern and I'm not sure I need it.
> All I want is to add some kind of built-in function to Clang that
> would somehow produce MYINSTRUCTION. And currently I don't have any
> idea of how to implement __getmyregister(). Any tips?
> Thank you, yours,
> Vladimir M.
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev