[llvm] [BOLT][AArch64] Implement PLTCall optimization (PR #93584)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 03:47:18 PDT 2024


================
@@ -1412,9 +1413,15 @@ class MCPlusBuilder {
     return false;
   }
 
-  /// Modify a direct call instruction \p Inst with an indirect call taking
-  /// a destination from a memory location pointed by \p TargetLocation symbol.
-  virtual bool convertCallToIndirectCall(MCInst &Inst,
+  /// Modify a direct call instruction pointed by the iterator \p It, with an
+  /// indirect call taking a destination from a memory location pointed by \p
+  /// TargetLocation symbol. If additional instructions need to be prepended
+  /// before \p It, then the iterator must be updated to point to the indirect
+  /// call instruction.
+  ///
+  /// \return true on success
+  virtual bool convertCallToIndirectCall(BinaryBasicBlock &BB,
----------------
paschalis-mpeis wrote:

Thanks @rafaelauler  and @samolisov  for the suggestions. I think the way to go is using `InstructionListType`.

I will rename `convertCallToIndirectCall` to `createIndirectPltCall`, addressing my previous concern [here](https://github.com/llvm/llvm-project/pull/93584#discussion_r1617667657), but feel free to suggest a better name.
The function will be adjusted to return an `InstructionListType`, and anything that relates to Binary BB logic will be moved to the pass itself.

I think the closest existing example of this is with the `InlineMemcpy` pass and `createInlineMemcpy`.


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


More information about the llvm-commits mailing list