[clang] [compiler-rt] [llvm] [XRay][RISCV] RISCV support for XRay (PR #117368)
Min-Yih Hsu via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 11:09:56 PST 2024
================
@@ -0,0 +1,87 @@
+//===-- xray_trampoline_riscv32.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 riscv32-specific assembler for the trampolines.
+//
+//===----------------------------------------------------------------------===//
+
+.macro SAVE_ARG_REGISTERS
+ // Push argument registers to stack
+ addi sp, sp, -112
+ .cfi_def_cfa_offset 112
+ sw ra, 108(sp)
+ .cfi_offset ra, -4
+ sw a7, 104(sp)
+ sw a6, 100(sp)
+ sw a5, 96(sp)
+ sw a4, 92(sp)
+ sw a3, 88(sp)
+ sw a2, 84(sp)
+ sw a1, 80(sp)
+ sw a0, 76(sp)
+ fsd fa7, 64(sp)
+ fsd fa6, 56(sp)
+ fsd fa5, 48(sp)
+ fsd fa4, 40(sp)
+ fsd fa3, 32(sp)
+ fsd fa2, 24(sp)
+ fsd fa1, 16(sp)
+ fsd fa0, 8(sp)
----------------
mshockwave wrote:
It's true that only some of the XRay targets implement CFI (e.g. x86_64), but I'm incline to have a correct frame address since showing the trampoline name in the stack trace is pretty useful sometimes. I have kept the CFI directives regarding CFA and removed all the other directives.
https://github.com/llvm/llvm-project/pull/117368
More information about the cfe-commits
mailing list