[PATCH] D118088: [BOLT] Enable PLT analyzation for aarch64

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 19:22:54 PST 2022


rafauler added inline comments.


================
Comment at: bolt/include/bolt/Core/MCPlusBuilder.h:1333
+  /// associated got entry address.
+  virtual uint64_t analyzePltEntry(MCInst &Instruction,
+                                   InstructionIterator Begin,
----------------



================
Comment at: bolt/include/bolt/Rewrite/RewriteInstance.h:245
+  /// associated address.
+  void createPltBF(uint64_t TargetAddress, uint64_t EntryAddress,
+                   uint64_t EntrySize);
----------------



================
Comment at: bolt/include/bolt/Rewrite/RewriteInstance.h:249
+  /// Disassemble aarch64-specific .plt \p Section auxiliary function
+  void disassemblePltSectionAArch64(BinarySection &Section);
+
----------------



================
Comment at: bolt/include/bolt/Rewrite/RewriteInstance.h:253
+  /// is the expected .plt \p Section entry function size.
+  void disassemblePltSectionX86(BinarySection &Section, uint64_t EntrySize);
+
----------------



================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:1258
 
+  uint64_t EntryOffset, InstrOffset = 0;
+  // Locate new plt entry
----------------
EntryOffset is not a loop-carried dependency, better to declare it inside the loop.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:1258
 
+  uint64_t EntryOffset, InstrOffset = 0;
+  // Locate new plt entry
----------------
rafauler wrote:
> EntryOffset is not a loop-carried dependency, better to declare it inside the loop.



================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:1263
+    MCInst Instruction;
+    uint64_t InstrSize, EntrySize = 0;
+    EntryOffset = InstrOffset;
----------------



================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:1264
+    uint64_t InstrSize, EntrySize = 0;
+    EntryOffset = InstrOffset;
+    // Loop through entry instructions
----------------



================
Comment at: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp:731
+    // Match ldr instruction
+    SmallVector<MCInst *, 4> &UsesBranch = UDChain[Branch];
+    if (UsesBranch.size() < 1 || UsesBranch[0] == nullptr)
----------------



================
Comment at: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp:746
+    // Match adrp instruction
+    SmallVector<MCInst *, 4> &UsesLdr = UDChain[Ldr];
+    if (UsesLdr.size() == 0 || UsesLdr[1] == nullptr)
----------------



================
Comment at: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp:747
+    SmallVector<MCInst *, 4> &UsesLdr = UDChain[Ldr];
+    if (UsesLdr.size() == 0 || UsesLdr[1] == nullptr)
+      return 0;
----------------
I guess you meant


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118088



More information about the llvm-commits mailing list