1 //===-- MCDisassembler.cpp - Disassembler interface -----------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "llvm/MC/MCDisassembler/MCDisassembler.h" 11 #include "llvm/MC/MCDisassembler/MCExternalSymbolizer.h" 12 #include "llvm/Support/raw_ostream.h" 13 14 using namespace llvm; 15 16 MCDisassembler::~MCDisassembler() { 17 } 18 19 bool MCDisassembler::tryAddingSymbolicOperand(MCInst &Inst, int64_t Value, 20 uint64_t Address, bool IsBranch, 21 uint64_t Offset, 22 uint64_t InstSize) const { 23 raw_ostream &cStream = CommentStream ? *CommentStream : nulls(); 24 if (Symbolizer) 25 return Symbolizer->tryAddingSymbolicOperand(Inst, cStream, Value, Address, 26 IsBranch, Offset, InstSize); 27 return false; 28 } 29 30 void MCDisassembler::tryAddingPcLoadReferenceComment(int64_t Value, 31 uint64_t Address) const { 32 raw_ostream &cStream = CommentStream ? *CommentStream : nulls(); 33 if (Symbolizer) 34 Symbolizer->tryAddingPcLoadReferenceComment(cStream, Value, Address); 35 } 36 37 void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) { 38 Symbolizer = std::move(Symzer); 39 } 40