[cfe-dev] A new builtin: __builtin_stack_pointer()

Behan Webster behanw at converseincode.com
Fri Nov 8 13:50:18 PST 2013


On 11/08/13 13:13, Chris Lattner wrote:
> On Nov 6, 2013, at 5:46 PM, Behan Webster <behanw at converseincode.com
> <mailto:behanw at converseincode.com>> wrote:
>> Another way would be to introduce a new builtin in parallel to others
>> like __builtin_return_address(). Essentially adding a
>> __builtin_stack_pointer() which does what the above code does. The idea
>> would be to get something like this added to both clang and gcc in order
>> to make this work across compilers, and across arches.
>>
>> It ends up being a trivial patch for clang (see below). We're still
>> looking for someone to help us on the gcc side.
>
> From my perspective, adding __builtin_stack_pointer() makes perfect
> sense.  Mapping it to Intrinsic::stacksave does not though, it should
> map down to a new llvm.stackpointer() intrinsic, and the code
> generator should turn it into the stack pointer register at isel time.
>
> -Chris
Okay, maybe not so trivial. :)

Yours however, is a much cleaner solution.

Thanks,

Behan

-- 
Behan Webster
behanw at converseincode.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131108/45b266d5/attachment.html>


More information about the cfe-dev mailing list