[llvm] [BOLT][AArch64] Speedup `computeInstructionSize` (PR #121106)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 25 04:19:10 PST 2024


================
@@ -1363,6 +1363,17 @@ class BinaryContext {
     if (std::optional<uint32_t> Size = MIB->getSize(Inst))
       return *Size;
 
+    // Pseudo instrs will not be emiitted and have no size.
+    if (MIB->isPseudo(Inst)) {
+      return 0;
+    }
+
+    // Directly return 4 because AArch64 instructions always have a
+    // fixed size of 4 bytes.
+    if (isAArch64()) {
----------------
liusy58 wrote:

You mean define `getSize ` in `AArch64MCPlusBuilder`, and in `computeInstructionSize`, 

```
if (isAArch64()) { 
   return MIB->getSize(Inst)
}
```

Am I right?

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


More information about the llvm-commits mailing list