mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
[BOLT][AArch64] Speedup computeInstructionSize (#121106)
AArch64 instructions have a fixed size 4 bytes, no need to compute.
This commit is contained in:
@@ -1363,6 +1363,12 @@ public:
|
||||
if (std::optional<uint32_t> Size = MIB->getSize(Inst))
|
||||
return *Size;
|
||||
|
||||
if (MIB->isPseudo(Inst))
|
||||
return 0;
|
||||
|
||||
if (std::optional<uint32_t> Size = MIB->getInstructionSize(Inst))
|
||||
return *Size;
|
||||
|
||||
if (!Emitter)
|
||||
Emitter = this->MCE.get();
|
||||
SmallString<256> Code;
|
||||
|
||||
@@ -1204,6 +1204,11 @@ public:
|
||||
/// Get instruction size specified via annotation.
|
||||
std::optional<uint32_t> getSize(const MCInst &Inst) const;
|
||||
|
||||
/// Get target-specific instruction size.
|
||||
virtual std::optional<uint32_t> getInstructionSize(const MCInst &Inst) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Set instruction size.
|
||||
void setSize(MCInst &Inst, uint32_t Size) const;
|
||||
|
||||
|
||||
@@ -1792,6 +1792,11 @@ public:
|
||||
}
|
||||
|
||||
uint16_t getMinFunctionAlignment() const override { return 4; }
|
||||
|
||||
std::optional<uint32_t>
|
||||
getInstructionSize(const MCInst &Inst) const override {
|
||||
return 4;
|
||||
}
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
Reference in New Issue
Block a user