LLVM 20.0.0git
Public Member Functions | List of all members
llvm::AArch64ExternalSymbolizer Class Reference

#include "Target/AArch64/Disassembler/AArch64ExternalSymbolizer.h"

Inheritance diagram for llvm::AArch64ExternalSymbolizer:
Inheritance graph
[legend]

Public Member Functions

 AArch64ExternalSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo)
 
bool tryAddingSymbolicOperand (MCInst &MI, raw_ostream &CommentStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize) override
 tryAddingSymbolicOperand - tryAddingSymbolicOperand trys to add a symbolic operand in place of the immediate Value in the MCInst.
 
- Public Member Functions inherited from llvm::MCExternalSymbolizer
 MCExternalSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo, LLVMOpInfoCallback getOpInfo, LLVMSymbolLookupCallback symbolLookUp, void *disInfo)
 
bool tryAddingSymbolicOperand (MCInst &MI, raw_ostream &CommentStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize) override
 Try to add a symbolic operand instead of Value to the MCInst.
 
void tryAddingPcLoadReferenceComment (raw_ostream &CommentStream, int64_t Value, uint64_t Address) override
 Try to add a comment on the PC-relative load.
 
- Public Member Functions inherited from llvm::MCSymbolizer
 MCSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo)
 Construct an MCSymbolizer, taking ownership of RelInfo.
 
 MCSymbolizer (const MCSymbolizer &)=delete
 
MCSymbolizeroperator= (const MCSymbolizer &)=delete
 
virtual ~MCSymbolizer ()
 
virtual bool tryAddingSymbolicOperand (MCInst &Inst, raw_ostream &cStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize)=0
 Try to add a symbolic operand instead of Value to the MCInst.
 
virtual void tryAddingPcLoadReferenceComment (raw_ostream &cStream, int64_t Value, uint64_t Address)=0
 Try to add a comment on the PC-relative load.
 
virtual ArrayRef< uint64_tgetReferencedAddresses () const
 Get the MCSymbolizer's list of addresses that were referenced by symbolizable operands but not resolved to a symbol.
 

Additional Inherited Members

- Protected Attributes inherited from llvm::MCExternalSymbolizer
LLVMOpInfoCallback GetOpInfo
 
LLVMSymbolLookupCallback SymbolLookUp
 The function to lookup a symbol name.
 
void * DisInfo
 The pointer to the block of symbolic information for above call back.
 
- Protected Attributes inherited from llvm::MCSymbolizer
MCContextCtx
 
std::unique_ptr< MCRelocationInfoRelInfo
 

Detailed Description

Definition at line 20 of file AArch64ExternalSymbolizer.h.

Constructor & Destructor Documentation

◆ AArch64ExternalSymbolizer()

llvm::AArch64ExternalSymbolizer::AArch64ExternalSymbolizer ( MCContext Ctx,
std::unique_ptr< MCRelocationInfo RelInfo,
LLVMOpInfoCallback  GetOpInfo,
LLVMSymbolLookupCallback  SymbolLookUp,
void *  DisInfo 
)
inline

Definition at line 22 of file AArch64ExternalSymbolizer.h.

Member Function Documentation

◆ tryAddingSymbolicOperand()

bool AArch64ExternalSymbolizer::tryAddingSymbolicOperand ( MCInst MI,
raw_ostream CommentStream,
int64_t  Value,
uint64_t  Address,
bool  IsBranch,
uint64_t  Offset,
uint64_t  OpSize,
uint64_t  InstSize 
)
overridevirtual

tryAddingSymbolicOperand - tryAddingSymbolicOperand trys to add a symbolic operand in place of the immediate Value in the MCInst.

The immediate Value has not had any PC adjustment made by the caller. If the instruction is a branch that adds the PC to the immediate Value then isBranch is Success, else Fail. If GetOpInfo is non-null, then it is called to get any symbolic information at the Address for this instrution. If that returns non-zero then the symbolic information it returns is used to create an MCExpr and that is added as an operand to the MCInst. If GetOpInfo() returns zero and isBranch is Success then a symbol look up for Address + Value is done and if a symbol is found an MCExpr is created with that, else an MCExpr with Address + Value is created. If GetOpInfo() returns zero and isBranch is Fail then the Opcode of the MCInst is tested and for ADRP an other instructions that help to load of pointers a symbol look up is done to see it is returns a specific reference type to add to the comment stream. This function returns Success if it adds an operand to the MCInst and Fail otherwise.

Reimplemented from llvm::MCExternalSymbolizer.

Definition at line 60 of file AArch64ExternalSymbolizer.cpp.

References llvm::Add, llvm::Address, LLVMOpInfo1::AddSymbol, llvm::MCSymbolRefExpr::create(), llvm::MCConstantExpr::create(), llvm::MCBinaryExpr::createAdd(), llvm::MCOperand::createExpr(), llvm::MCUnaryExpr::createMinus(), llvm::MCBinaryExpr::createSub(), llvm::MCSymbolizer::Ctx, llvm::MCExternalSymbolizer::DisInfo, llvm::format(), llvm::MCRegisterInfo::getEncodingValue(), llvm::MCExternalSymbolizer::GetOpInfo, llvm::MCContext::getOrCreateSymbol(), llvm::MCContext::getRegisterInfo(), getVariant(), LHS, LLVMDisassembler_ReferenceType_In_ARM64_ADDXri, LLVMDisassembler_ReferenceType_In_ARM64_ADR, LLVMDisassembler_ReferenceType_In_ARM64_ADRP, LLVMDisassembler_ReferenceType_In_ARM64_LDRXl, LLVMDisassembler_ReferenceType_In_ARM64_LDRXui, LLVMDisassembler_ReferenceType_In_Branch, LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr, LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr, LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Message, LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref, LLVMDisassembler_ReferenceType_Out_SymbolStub, MI, LLVMOpInfoSymbol1::Name, Name, LLVMOpInfoSymbol1::Present, LLVMOpInfo1::SubtractSymbol, Sym, llvm::MCExternalSymbolizer::SymbolLookUp, LLVMOpInfoSymbol1::Value, LLVMOpInfo1::Value, LLVMOpInfo1::VariantKind, llvm::MCSymbolRefExpr::VK_None, and llvm::raw_ostream::write_escaped().


The documentation for this class was generated from the following files: