[llvm] [llvm-exegesis] Set stack pointer register after starting perf counter (PR #72489)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 06:27:30 PST 2023


================
@@ -170,6 +170,12 @@ class ExegesisTarget {
         "configurePerfCounter is not implemented on the current architecture");
   }
 
+  // Returns the stack register for the platform.
+  virtual unsigned getStackRegister() const {
+    report_fatal_error(
+        "getStackRegister is not implemented on the current architecture");
+  }
----------------
legrosbuffle wrote:

We can probably avoid introducing a new virtual call by using `TargetLowering` in `LLVMState`.

The stack pointer is `state.getSubtargetInfo().getTargetLowering()->getStackPointerRegisterToSaveRestore();`

This would avoid having to reimplement that in `ExegesisTarget` for every architecture.

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


More information about the llvm-commits mailing list