Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14417,8 +14417,6 @@ register are the same. However, on other architectures (e.g. SPARCv9), the logic
stack pointer register may differ from the physical value. '``llvm.stackaddress``' handles this
discrepancy and returns the correct boundary address.

**Note**: This intrinsic is currently only implemented for x86 and x86-64.

'``llvm.frameaddress``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
14 changes: 14 additions & 0 deletions llvm/test/CodeGen/ARM/stackaddress.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; RUN: llc < %s -mtriple=armv7 | FileCheck %s --check-prefix=armv7
; RUN: llc < %s -mtriple=aarch64 | FileCheck %s --check-prefix=aarch64

declare ptr @llvm.stackaddress.p0()

define ptr @test() {
; armv7: mov r0, sp
; armv7: bx lr

; aarch64: mov x0, sp
; aarch64: ret
%sp = call ptr @llvm.stackaddress.p0()
ret ptr %sp
}
14 changes: 14 additions & 0 deletions llvm/test/CodeGen/X86/stackaddress.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; 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
}