[llvm] [Exegesis][RISCV] Add RISCV support for llvm-exegesis (PR #89047)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 05:08:09 PDT 2024


================
@@ -113,7 +115,51 @@ static void appendCodeTemplates(const LLVMState &State,
   }
   case ExecutionMode::SERIAL_VIA_MEMORY_INSTR: {
     // Select back-to-back memory instruction.
-    // TODO: Implement me.
+
+    auto &I = Variant.getInstr();
+    if (I.Description.mayLoad()) {
+      // If instruction is load, we can self-alias it in case when instruction
+      // overrides whole address register. For that we use provided scratch
+      // memory.
+
+      // TODO: now it is not checked if load writes the whole register.
+
+      auto DefOpIt = find_if(I.Operands, [](Operand const &op) {
+        return op.isDef() && op.isReg();
+      });
+
+      if (DefOpIt == I.Operands.end())
+        return;
+
+      auto &DefOp = *DefOpIt;
----------------
legrosbuffle wrote:

avoid `auto` here for readability. `getValueFor` has a few overloads, it' not obvious which one is called.

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


More information about the llvm-commits mailing list