Skip to content

Commit b4c9c4c

Browse files
committed
[BOLT][AArch64] Speedup computeInstructionSize
1 parent 8387cbd commit b4c9c4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,17 @@ class BinaryContext {
13631363
if (std::optional<uint32_t> Size = MIB->getSize(Inst))
13641364
return *Size;
13651365

1366+
// Pseudo instrs will not be emiitted and have no size.
1367+
if (MIB->isPseudo(Inst)) {
1368+
return 0;
1369+
}
1370+
1371+
// Directly return 4 because AArch64 instructions always have a
1372+
// fixed size of 4 bytes.
1373+
if (isAArch64()) {
1374+
return 4;
1375+
}
1376+
13661377
if (!Emitter)
13671378
Emitter = this->MCE.get();
13681379
SmallString<256> Code;

0 commit comments

Comments
 (0)