summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/xray/xray_trampoline_powerpc64.cc
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2017-02-10 21:03:24 +0000
committerTim Shen <timshen91@gmail.com>2017-02-10 21:03:24 +0000
commit918ed871df7398c1c4a384787df8728532ece1db (patch)
tree1cfe7c2a2e372c04729d2ed31f13ef69ed06710f /compiler-rt/lib/xray/xray_trampoline_powerpc64.cc
parent58fc1b50d8b0719460e1bf08734c0e7632fb03c4 (diff)
downloadbcm5719-llvm-918ed871df7398c1c4a384787df8728532ece1db.tar.gz
bcm5719-llvm-918ed871df7398c1c4a384787df8728532ece1db.zip
[XRay] Implement powerpc64le xray.
Summary: powerpc64 big-endian is not supported, but I believe that most logic can be shared, except for xray_powerpc64.cc. Also add a function InvalidateInstructionCache to xray_util.h, which is copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest, and I don't know how. Reviewers: dberris, echristo, iteratee, kbarton, hfinkel Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29742 llvm-svn: 294781
Diffstat (limited to 'compiler-rt/lib/xray/xray_trampoline_powerpc64.cc')
-rw-r--r--compiler-rt/lib/xray/xray_trampoline_powerpc64.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/lib/xray/xray_trampoline_powerpc64.cc b/compiler-rt/lib/xray/xray_trampoline_powerpc64.cc
new file mode 100644
index 00000000000..878c46930fe
--- /dev/null
+++ b/compiler-rt/lib/xray/xray_trampoline_powerpc64.cc
@@ -0,0 +1,15 @@
+#include <atomic>
+#include <xray/xray_interface.h>
+
+namespace __xray {
+
+extern std::atomic<void (*)(int32_t, XRayEntryType)> XRayPatchedFunction;
+
+// Implement this in C++ instead of assembly, to avoid dealing with ToC by hand.
+void CallXRayPatchedFunction(int32_t FuncId, XRayEntryType Type) {
+ auto fptr = __xray::XRayPatchedFunction.load();
+ if (fptr != nullptr)
+ (*fptr)(FuncId, Type);
+}
+
+} // namespace __xray
OpenPOWER on IntegriCloud