1 //===- MCDisassembler.cpp - Disassembler interface ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/MC/MCDisassembler/MCDisassembler.h"
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/StringRef.h"
12 #include "llvm/Support/raw_ostream.h"
17 MCDisassembler::~MCDisassembler() = default;
19 MCDisassembler::DecodeStatus
MCDisassembler::onSymbolStart(
20 StringRef Name
, uint64_t &Size
, ArrayRef
<uint8_t> Bytes
, uint64_t Address
,
21 raw_ostream
&VStream
, raw_ostream
&CStream
) const {
23 return MCDisassembler::Success
;
26 bool MCDisassembler::tryAddingSymbolicOperand(MCInst
&Inst
, int64_t Value
,
27 uint64_t Address
, bool IsBranch
,
29 uint64_t InstSize
) const {
30 raw_ostream
&cStream
= CommentStream
? *CommentStream
: nulls();
32 return Symbolizer
->tryAddingSymbolicOperand(Inst
, cStream
, Value
, Address
,
33 IsBranch
, Offset
, InstSize
);
37 void MCDisassembler::tryAddingPcLoadReferenceComment(int64_t Value
,
38 uint64_t Address
) const {
39 raw_ostream
&cStream
= CommentStream
? *CommentStream
: nulls();
41 Symbolizer
->tryAddingPcLoadReferenceComment(cStream
, Value
, Address
);
44 void MCDisassembler::setSymbolizer(std::unique_ptr
<MCSymbolizer
> Symzer
) {
45 Symbolizer
= std::move(Symzer
);