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
8 changes: 6 additions & 2 deletions llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,21 @@ bool MCDisassembler::tryAddingSymbolicOperand(MCInst &Inst, int64_t Value,
uint64_t Address, bool IsBranch,
uint64_t Offset, uint64_t OpSize,
uint64_t InstSize) const {
if (Symbolizer)
if (Symbolizer) {
assert(CommentStream && "CommentStream is not set.");
return Symbolizer->tryAddingSymbolicOperand(Inst, *CommentStream, Value,
Address, IsBranch, Offset,
OpSize, InstSize);
}
return false;
}

void MCDisassembler::tryAddingPcLoadReferenceComment(int64_t Value,
uint64_t Address) const {
if (Symbolizer)
if (Symbolizer) {
assert(CommentStream && "CommentStream is not set.");
Symbolizer->tryAddingPcLoadReferenceComment(*CommentStream, Value, Address);
}
}

void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ DecodeStatus RISCVDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
uint64_t Address,
raw_ostream &CS) const {
CommentStream = &CS;
// It's a 16 bit instruction if bit 0 and 1 are not 0b11.
if ((Bytes[0] & 0b11) != 0b11)
return getInstruction16(MI, Size, Bytes, Address, CS);
Expand Down