[llvm-dev] Adding register class for just one instruction

Vladimir Miloserdov via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 23 13:02:22 PST 2017


I'm trying to learn LLVM so my current problem is to do the following:
add an instruction (called XMAC) to Sparc back-end which uses
(non-existent) register called XACC (it holds i64 values). I need also
to copy values to and from this register with custom instructions.

I've added this register (and corresponding register class XACCReg) to
SparcRegisterInfo.td. I've also registered it's class in
SparcISelLowering.cpp and everything works, i.e. my instruction is
correctly selected and emited as well as copying works. But register
allocator uses my register class outside of XMAC, e.g. instead of
I64Regs sometimes. How to force it to only use my register class for
this particular instruction?

Yours faithfully,
Vladimir M.


More information about the llvm-dev mailing list