Add support for `__builtin_stack_address` builtin. The semantics match those of GCC's builtin with the same name. `__builtin_stack_address` returns the starting address of the stack region that may be used by called functions. It may or may not include the space used for on-stack arguments passed to a callee (See [GCC Bug/121013](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121013)). Fixes #82632.
15 lines
363 B
LLVM
15 lines
363 B
LLVM
; RUN: llc < %s -mtriple=x86_64-linux-gnu -o - | FileCheck --check-prefix=x86_64 %s
|
|
; RUN: llc < %s -mtriple=i386-linux-gnu -o - | FileCheck --check-prefix=i386 %s
|
|
|
|
declare ptr @llvm.stackaddress.p0()
|
|
|
|
define ptr @test() {
|
|
; x86_64: movq %rsp, %rax
|
|
; x86_64: retq
|
|
|
|
; i386: movl %esp, %eax
|
|
; i386: retl
|
|
%sp = call ptr @llvm.stackaddress.p0()
|
|
ret ptr %sp
|
|
}
|