//===- AArch64ExternalSymbolizer.cpp - Symbolizer for AArch64 ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "AArch64ExternalSymbolizer.h" #include "MCTargetDesc/AArch64AddressingModes.h" #include "Utils/AArch64BaseInfo.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" usingnamespacellvm; #define DEBUG_TYPE … static MCSymbolRefExpr::VariantKind getVariant(uint64_t LLVMDisassembler_VariantKind) { … } /// 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. 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) { … }