[Openmp-commits] [openmp] [OpenMP][test] Define print_possible_return_addresses on SPARC (PR #138523)

via Openmp-commits openmp-commits at lists.llvm.org
Tue May 13 10:57:04 PDT 2025


================
@@ -311,6 +311,14 @@ ompt_label_##id:
   printf("%" PRIu64 ": current_address=%p or %p or %p\n",                      \
          ompt_get_thread_data()->value, ((char *)addr) - 2,                    \
          ((char *)addr) - 8, ((char *)addr) - 12)
+#elif KMP_ARCH_SPARC
+// FIXME: Need to distinguish between 32 and 64-bit SPARC?
+// On SPARC the NOP instruction is 4 bytes long.
+// FIXME: Explain.  Can use __builtin_frob_return_addr?
+#define print_possible_return_addresses(addr)                                  \
----------------
jprotze wrote:

The value printed by this function will be compared to the value of `__builtin_return_address(0)` executed in the kmpc function generated for the directive before the nop. So, what we try to identify here is not the IP of nop, but the IP of the instruction following the kmpc call. I extended you example by some random kmpc API call (c&p from runtime/tasking/omp51_task_dep_inoutset.c): https://godbolt.org/z/h6KhaYhMW

So, the additional bytes account for the `mov` following the function call (and the `!APP`/`!NO_APP` ?).

https://github.com/llvm/llvm-project/pull/138523


More information about the Openmp-commits mailing list