[compiler-rt] [SystemZ][XRay] XRay runtime support for SystemZ (PR #113252)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 23 08:44:28 PDT 2024
================
@@ -0,0 +1,111 @@
+//===-- xray_trampoline_s390x.s ---------------------------------*- ASM -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of XRay, a dynamic runtime instrumentation system.
+//
+// This implements the s390x-specific assembler for the trampolines.
+//
+//===----------------------------------------------------------------------===//
+
+ .text
+
+#if __VX__
+// Minimal stack frame size (160) plus space for 8 vector registers a 16 bytes.
+#define STACKSZ 288
+#else
+// Minimal stack frame size
+#define STACKSZ 160
+#endif
+
+//===----------------------------------------------------------------------===//
+
+ .globl __xray_FunctionEntry
+ .p2align 4
+ .type __xray_FunctionEntry, at function
+__xray_FunctionEntry:
+ # The registers r2-15 of the instrumented function are already saved in the
+ # stack frame. On entry, r2 contains the function id, and %r14 the address
+ # of the first instruction of the instrumented function.
+ # Register r14 will be stored in the slot reserved for compiler use.
+ stg %r14, 8(%r15)
+ std %f0, 128(%r15)
+ std %f2, 136(%r15)
+ std %f4, 144(%r15)
+ std %f6, 152(%r15)
+ aghi %r15, -STACKSZ
+#if __VX__
----------------
uweigand wrote:
Runtime check would be possible, but I'd try to avoid this. As I mentioned, if the function call that is being intercepted was compiled to use the vector feature (i.e. actually passes arguments in vector registers), then we can assume that the vector feature must be available at runtime, or else the call would have already crashed. So if we know at instrumentation time that this call uses the vector feature, the instrumentation can choose to use the variant of the trampoline that saves and restores vector registers.
https://github.com/llvm/llvm-project/pull/113252
More information about the llvm-commits
mailing list