[LLVMdev] portable way to modify the FP register?
James Molloy
James.Molloy at arm.com
Tue Dec 14 00:04:56 PST 2010
Hi,
That seems sensible, but:
> for the moment we're only considering X86-64 targets and we're forcing
> the FP to be materialized (ie, -disable-fp-elim) to ensure we can be
> independent of what happens to SP.
Does it therefore seem surprising that there is no way to do this portably? ;)
James Molloy
Graduate Compiler Engineer, ARM Ltd.
> -----Original Message-----
> From: Salvador Abreu [mailto:spa at di.uevora.pt]
> Sent: 13 December 2010 21:47
> To: James Molloy
> Cc: Salvador Abreu; llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] portable way to modify the FP register?
>
> Hi again,
>
> On Dec 13, 2010, at 18:03, James Molloy wrote:
>
> > To add to what Anton said, what if you're on a non-x86 target, or --
> no-frame-pointer is set?
>
> for the moment we're only considering X86-64 targets and we're forcing
> the FP to be materialized (ie, -disable-fp-elim) to ensure we can be
> independent of what happens to SP.
>
> btw, I can't think of any current ISA/ABI which doesn't have a frame
> pointer register...
>
> > Also, I'm intrigued as to how you guarantee that in the intervening
> time between the coroutine/generator function bar() returning one
> result and the next invocation of bar(), foo() doesn't call another
> function and overwrite bar()'s stack frame?
>
> the stack frame allocated by bar (called by foo) did not get released,
> and foo needs to use fp-based addressing. bar's stack frame now
> occupies the top of the stack and this will be in effect when the
> subsequent functions get called, which will create new stack frames on
> top of bar's.
>
> we're defining a new calling convention which expects certain calls'
> frames to linger (similar to coroutining)
>
> cheers,
> Salvador
>
> >
> > Cheers,
> >
> > James Molloy
> > Graduate Compiler Engineer, ARM Ltd.
> >
> >
> >> -----Original Message-----
> >> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-
> bounces at cs.uiuc.edu]
> >> On Behalf Of Salvador Abreu
> >> Sent: 13 December 2010 15:57
> >> To: llvmdev at cs.uiuc.edu
> >> Subject: [LLVMdev] portable way to modify the FP register?
> >>
> >> Hi,
> >>
> >> I'd like to know if there's a portable way of modifying the FP
> >> register, in LLVM.
> >>
> >> Suppose foo() calls bar(); bar emits a result but remains active and
> >> needs to be able to produce more results - a bit like a coroutine.
> We
> >> want bar to restore FP to what it was inside foo before transferring
> >> control back to foo (bar's stack frame is not disposed of).
> >>
> >> We'd make sure that foo only accesses local variables via FP (SP
> >> addressing is disabled).
> >>
> >> What we'd like to do is something like (abstracted syntax and
> semantics
> >> :-)
> >> (FP) = @llvm.frameaddress(1) ;
> >>
> >> So, is there a portable way to change FP?
> >>
> >> --
> >> Salvador Abreu -- http://www.di.uevora.pt/~spa/
> >> Departamento de Informatica
> >> Universidade de Evora - PORTUGAL
> >>
> >>
> >>
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> >
> > -- IMPORTANT NOTICE: The contents of this email and any attachments
> are confidential and may also be privileged. If you are not the
> intended recipient, please notify the sender immediately and do not
> disclose the contents to any other person, use it for any purpose, or
> store or copy the information in any medium. Thank you.
> >
>
> --
> Salvador Abreu -- http://www.di.uevora.pt/~spa/
> Departamento de Informatica
> Universidade de Evora - PORTUGAL
>
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the llvm-dev
mailing list