[llvm-dev] [Sparc] Load address with SETHI

Chris.Dewhurst via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 15 10:17:44 PDT 2016

> > Some more information on what I have so far. I'll actually focus on the longjmp side, as the problem is probably easier.
> >
> > I need to get the SETHI / OR combination inserted where the comment
> > "*** Need to use the SETHI / OR combination here. ***" appears in the
> > code below, but I'm not sure that this is done anywhere near this piece
> > of code, so I'll include all the relevant parts that I can find of my
> > current implementation.

> I don't understand what exactly you want to materialize here. Shouldn't
> the address of the buffer already be an operand at this point?

> Joerg

Quite possibly, I've over-simplified my example. Perhaps I should have focussed more on the setjmp part, which is actually where I was coding anyway. In this, I need to store the address of the instruction after I've lowered the intrinsic into a buffer so that I can recover this and jump back to it from the longjmp intrinsic.

There are two or three parts, and I'm not sure how to go about either. After I get these working, the rest is (I think) plain-sailing:

(1) I need to take the address of the instruction after the lowered setjmp intrinsic, which I think requires that I create a new basic block

(2) I need to get the address of this basic block, at lowering time, and get it into a register using the SETHI / OR combination (I presume). Once it's in the register, I can store it in the buffer easily. There must surely be a good way to load an address using SETHI / OR, but nothing I've tried (including "makeAddress") works so far. I guess I could code each of SETHI and OR individually, but surely there's some code around to take care of this already.

(3) Is there anything else? Do I need any indicators to let the back-end know it'll need to fix-up the address taken in step (2) later in the compilation - or possibly in the link - pipeline?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160415/bb2739c9/attachment.html>

More information about the llvm-dev mailing list