[PATCH] D151023: [llvm-exegesis] Add Target Memory Utility Functions

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 17:53:30 PDT 2023


aidengrossman added inline comments.


================
Comment at: llvm/tools/llvm-exegesis/lib/X86/Target.cpp:978
 
+#ifdef __linux__
+std::vector<MCInst> ExegesisX86Target::generateLowerMunmap() const {
----------------
courbet wrote:
> All these are extremely complex. Can't we insert a call to a separate module instead ?
> 
> Given that we don't actually care about measuring the setup code, we don't need to inline  each function here.
I agree that they're complex and the readability is not great.

Theoretically, we could do it in a separate module and call into that, but the requirements for setting up a deterministic execution environment with regard to memory require that all the code has to be in blocks of fixed size at known addresses. I don't see any feasible way to do that by just implementing these functions in C/C++ in the `llvm-exegesis` code base. It's theoretically possible to have an implementation that lives outside of the main `llvm-exegesis` code base and gets built/linked in to the JITed snippet and emitted to the same block of memory, but decided against that approach since there was still a lot of complexity with that method and it seemed to be a less prominent path.

Very open to suggestions to improve the readability/complexity though since I'm sure I haven't explored the solution space that thoroughly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151023/new/

https://reviews.llvm.org/D151023



More information about the llvm-commits mailing list