[llvm] Allow MCInstrAnalysis to change MCInst (PR #85906)

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 11:39:45 PDT 2024


================
@@ -52,6 +53,10 @@ class MCInstrAnalysis {
   /// new function), clients should call resetState to clear it.
   virtual void updateState(const MCInst &Inst, uint64_t Addr) {}
 
+  /// Let the analysis update disassembled instruction from a recorded internal
+  /// state.
----------------
rampitec wrote:

Right, the modification merely will add extra info for comment printing. That way the MCInst will be produced consistently with the way codegen does it, and will be handled the same way in the InstPrinter, so no special casing is needed.

I can write an extra code in the asm printer for the case when code comes from disasm and not from codegen, it is just less clean to me. It also would require to make AMDGPUMCInstrAnalysis a class with public interface and move it out of the anonymous namespace. These are the reasons I'd prefer to add that extra info to the MCInst itself.

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


More information about the llvm-commits mailing list