Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:11

0001 //===-- llvm/MC/MCExternalSymbolizer.h - ------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains the declaration of the MCExternalSymbolizer class, which
0010 // enables library users to provide callbacks (through the C API) to do the
0011 // symbolization externally.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_MC_MCDISASSEMBLER_MCEXTERNALSYMBOLIZER_H
0016 #define LLVM_MC_MCDISASSEMBLER_MCEXTERNALSYMBOLIZER_H
0017 
0018 #include "llvm-c/DisassemblerTypes.h"
0019 #include "llvm/MC/MCDisassembler/MCSymbolizer.h"
0020 #include <memory>
0021 
0022 namespace llvm {
0023 
0024 /// Symbolize using user-provided, C API, callbacks.
0025 ///
0026 /// See llvm-c/Disassembler.h.
0027 class MCExternalSymbolizer : public MCSymbolizer {
0028 protected:
0029   /// \name Hooks for symbolic disassembly via the public 'C' interface.
0030   /// @{
0031   /// The function to get the symbolic information for operands.
0032   LLVMOpInfoCallback GetOpInfo;
0033   /// The function to lookup a symbol name.
0034   LLVMSymbolLookupCallback SymbolLookUp;
0035   /// The pointer to the block of symbolic information for above call back.
0036   void *DisInfo;
0037   /// @}
0038 
0039 public:
0040   MCExternalSymbolizer(MCContext &Ctx,
0041                        std::unique_ptr<MCRelocationInfo> RelInfo,
0042                        LLVMOpInfoCallback getOpInfo,
0043                        LLVMSymbolLookupCallback symbolLookUp, void *disInfo)
0044     : MCSymbolizer(Ctx, std::move(RelInfo)), GetOpInfo(getOpInfo),
0045       SymbolLookUp(symbolLookUp), DisInfo(disInfo) {}
0046 
0047   bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &CommentStream,
0048                                 int64_t Value, uint64_t Address, bool IsBranch,
0049                                 uint64_t Offset, uint64_t OpSize,
0050                                 uint64_t InstSize) override;
0051   void tryAddingPcLoadReferenceComment(raw_ostream &CommentStream,
0052                                        int64_t Value,
0053                                        uint64_t Address) override;
0054 };
0055 
0056 }
0057 
0058 #endif