Path: blob/main/contrib/llvm-project/llvm/include/llvm-c/Disassembler.h
35234 views
/*===-- llvm-c/Disassembler.h - Disassembler Public C Interface ---*- C -*-===*\1|* *|2|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|3|* Exceptions. *|4|* See https://llvm.org/LICENSE.txt for license information. *|5|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|6|* *|7|*===----------------------------------------------------------------------===*|8|* *|9|* This header provides a public interface to a disassembler library. *|10|* LLVM provides an implementation of this interface. *|11|* *|12\*===----------------------------------------------------------------------===*/1314#ifndef LLVM_C_DISASSEMBLER_H15#define LLVM_C_DISASSEMBLER_H1617#include "llvm-c/DisassemblerTypes.h"18#include "llvm-c/ExternC.h"1920/**21* @defgroup LLVMCDisassembler Disassembler22* @ingroup LLVMC23*24* @{25*/2627LLVM_C_EXTERN_C_BEGIN2829/**30* Create a disassembler for the TripleName. Symbolic disassembly is supported31* by passing a block of information in the DisInfo parameter and specifying the32* TagType and callback functions as described above. These can all be passed33* as NULL. If successful, this returns a disassembler context. If not, it34* returns NULL. This function is equivalent to calling35* LLVMCreateDisasmCPUFeatures() with an empty CPU name and feature set.36*/37LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo,38int TagType, LLVMOpInfoCallback GetOpInfo,39LLVMSymbolLookupCallback SymbolLookUp);4041/**42* Create a disassembler for the TripleName and a specific CPU. Symbolic43* disassembly is supported by passing a block of information in the DisInfo44* parameter and specifying the TagType and callback functions as described45* above. These can all be passed * as NULL. If successful, this returns a46* disassembler context. If not, it returns NULL. This function is equivalent47* to calling LLVMCreateDisasmCPUFeatures() with an empty feature set.48*/49LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU,50void *DisInfo, int TagType,51LLVMOpInfoCallback GetOpInfo,52LLVMSymbolLookupCallback SymbolLookUp);5354/**55* Create a disassembler for the TripleName, a specific CPU and specific feature56* string. Symbolic disassembly is supported by passing a block of information57* in the DisInfo parameter and specifying the TagType and callback functions as58* described above. These can all be passed * as NULL. If successful, this59* returns a disassembler context. If not, it returns NULL.60*/61LLVMDisasmContextRef62LLVMCreateDisasmCPUFeatures(const char *Triple, const char *CPU,63const char *Features, void *DisInfo, int TagType,64LLVMOpInfoCallback GetOpInfo,65LLVMSymbolLookupCallback SymbolLookUp);6667/**68* Set the disassembler's options. Returns 1 if it can set the Options and 069* otherwise.70*/71int LLVMSetDisasmOptions(LLVMDisasmContextRef DC, uint64_t Options);7273/* The option to produce marked up assembly. */74#define LLVMDisassembler_Option_UseMarkup 175/* The option to print immediates as hex. */76#define LLVMDisassembler_Option_PrintImmHex 277/* The option use the other assembler printer variant */78#define LLVMDisassembler_Option_AsmPrinterVariant 479/* The option to set comment on instructions */80#define LLVMDisassembler_Option_SetInstrComments 881/* The option to print latency information alongside instructions */82#define LLVMDisassembler_Option_PrintLatency 168384/**85* Dispose of a disassembler context.86*/87void LLVMDisasmDispose(LLVMDisasmContextRef DC);8889/**90* Disassemble a single instruction using the disassembler context specified in91* the parameter DC. The bytes of the instruction are specified in the92* parameter Bytes, and contains at least BytesSize number of bytes. The93* instruction is at the address specified by the PC parameter. If a valid94* instruction can be disassembled, its string is returned indirectly in95* OutString whose size is specified in the parameter OutStringSize. This96* function returns the number of bytes in the instruction or zero if there was97* no valid instruction.98*/99size_t LLVMDisasmInstruction(LLVMDisasmContextRef DC, uint8_t *Bytes,100uint64_t BytesSize, uint64_t PC,101char *OutString, size_t OutStringSize);102103/**104* @}105*/106107LLVM_C_EXTERN_C_END108109#endif /* LLVM_C_DISASSEMBLER_H */110111112