LLVM  9.0.0svn
MCDisassembler.cpp
Go to the documentation of this file.
1 //===- MCDisassembler.cpp - Disassembler interface ------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/StringRef.h"
13 #include <algorithm>
14 
15 using namespace llvm;
16 
18 
20  StringRef Name, uint64_t &Size, ArrayRef<uint8_t> Bytes, uint64_t Address,
21  raw_ostream &VStream, raw_ostream &CStream) const {
22  Size = 0;
24 }
25 
27  uint64_t Address, bool IsBranch,
28  uint64_t Offset,
29  uint64_t InstSize) const {
30  raw_ostream &cStream = CommentStream ? *CommentStream : nulls();
31  if (Symbolizer)
32  return Symbolizer->tryAddingSymbolicOperand(Inst, cStream, Value, Address,
33  IsBranch, Offset, InstSize);
34  return false;
35 }
36 
38  uint64_t Address) const {
39  raw_ostream &cStream = CommentStream ? *CommentStream : nulls();
40  if (Symbolizer)
41  Symbolizer->tryAddingPcLoadReferenceComment(cStream, Value, Address);
42 }
43 
44 void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {
45  Symbolizer = std::move(Symzer);
46 }
This class represents lattice values for constants.
Definition: AllocatorList.h:23
DecodeStatus
Ternary decode status.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
raw_ostream * CommentStream
bool tryAddingSymbolicOperand(MCInst &Inst, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t InstSize) const
void setSymbolizer(std::unique_ptr< MCSymbolizer > Symzer)
Set Symzer as the current symbolizer.
std::unique_ptr< MCSymbolizer > Symbolizer
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
void tryAddingPcLoadReferenceComment(int64_t Value, uint64_t Address) const
virtual ~MCDisassembler()
virtual DecodeStatus onSymbolStart(StringRef Name, uint64_t &Size, ArrayRef< uint8_t > Bytes, uint64_t Address, raw_ostream &VStream, raw_ostream &CStream) const
May parse any prelude that precedes instructions after the start of a symbol.
uint32_t Size
Definition: Profile.cpp:46
LLVM Value Representation.
Definition: Value.h:72
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48