mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
c31671a606
This change implements the llvm intrinsic llvm.read_register for the SystemZ platform which returns the value of the specified register (http://llvm.org/docs/LangRef.html#llvm-read-register-and-llvm-write-register-intrinsics). This implementation returns the value of the stack register, and can be extended to return the value of other registers. The implementation for this intrinsic exists on various other platforms including Power, x86, ARM, etc. but missing on SystemZ. Reviewers: uweigand Differential Revision: https://reviews.llvm.org/D73378
16 lines
352 B
LLVM
16 lines
352 B
LLVM
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
|
|
|
|
define i8* @get_stack() nounwind {
|
|
entry:
|
|
; CHECK-LABEL: get_stack:
|
|
; CHECK: lgr %r2, %r15
|
|
; CHECK-NEXT: br %r14
|
|
%0 = call i64 @llvm.read_register.i64(metadata !0)
|
|
%1 = inttoptr i64 %0 to i8*
|
|
ret i8* %1
|
|
}
|
|
|
|
declare i64 @llvm.read_register.i64(metadata) nounwind
|
|
|
|
!0 = !{!"r15"}
|