Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,12 @@ class BinaryContext {
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;
Expand Down
5 changes: 5 additions & 0 deletions bolt/include/bolt/Core/MCPlusBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,11 @@ class MCPlusBuilder {
/// 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;

Expand Down
5 changes: 5 additions & 0 deletions bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,11 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
}

uint16_t getMinFunctionAlignment() const override { return 4; }

std::optional<uint32_t>
getInstructionSize(const MCInst &Inst) const override {
return 4;
}
};

} // end anonymous namespace
Expand Down
Loading