MCDisassembler.h revision 1f6efa3996dd1929fbc129203ce5009b620e6969
1//===-- llvm/MC/MCDisassembler.h - Disassembler interface -------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9#ifndef MCDISASSEMBLER_H 10#define MCDISASSEMBLER_H 11 12#include "llvm/Support/DataTypes.h" 13 14namespace llvm { 15 16class MCInst; 17class MemoryObject; 18class raw_ostream; 19 20struct EDInstInfo; 21 22/// MCDisassembler - Superclass for all disassemblers. Consumes a memory region 23/// and provides an array of assembly instructions. 24class MCDisassembler { 25public: 26 /// Constructor - Performs initial setup for the disassembler. 27 MCDisassembler() {} 28 29 virtual ~MCDisassembler(); 30 31 /// getInstruction - Returns the disassembly of a single instruction. 32 /// 33 /// @param instr - An MCInst to populate with the contents of the 34 /// instruction. 35 /// @param size - A value to populate with the size of the instruction, or 36 /// the number of bytes consumed while attempting to decode 37 /// an invalid instruction. 38 /// @param region - The memory object to use as a source for machine code. 39 /// @param address - The address, in the memory space of region, of the first 40 /// byte of the instruction. 41 /// @param vStream - The stream to print warnings and diagnostic messages on. 42 /// @return - True if the instruction is valid; false otherwise. 43 virtual bool getInstruction(MCInst& instr, 44 uint64_t& size, 45 const MemoryObject ®ion, 46 uint64_t address, 47 raw_ostream &vStream) const = 0; 48 49 /// getEDInfo - Returns the enhanced insturction information corresponding to 50 /// the disassembler. 51 /// 52 /// @return - An array of instruction information, with one entry for 53 /// each MCInst opcode this disassembler returns. 54 /// NULL if there is no info for this target. 55 virtual EDInstInfo *getEDInfo() const { return (EDInstInfo*)0; } 56}; 57 58} // namespace llvm 59 60#endif 61