MCDisassembler.h revision 251ef612a812ac99edeab6c08a752bf8ca220921
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//===-- llvm/MC/MCDisassembler.h - Disassembler interface -------*- C++ -*-===// 2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// The LLVM Compiler Infrastructure 4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// This file is distributed under the University of Illinois Open Source 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// License. See LICENSE.TXT for details. 7e4fafb146e85cdfcf9d5418597b6818aa0754adatfarina@chromium.org// 8889bd8bd7f604acae0a6303365bc82c06da1e6f3tomhudson@google.com//===----------------------------------------------------------------------===// 9ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com#ifndef MCDISASSEMBLER_H 1008284e4d2421fb6c1978e68038a3568711cd9877commit-bot@chromium.org#define MCDISASSEMBLER_H 11383963280ddd13030331765fe88d2aefa3e32130bsalomon@google.com 128f6884aab8aecd7657cf3f9cdbc682f0deca29c5tfarina@chromium.org#include "llvm/Support/DataTypes.h" 13ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com 14ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.comnamespace llvm { 152047f00e4698f83499ab91911999a65c21a951c9epoger@google.com 16ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.comclass MCInst; 17ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.comclass MemoryObject; 18ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.comclass raw_ostream; 19ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com 20ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com/// MCDisassembler - Superclass for all disassemblers. Consumes a memory region 21ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com/// and provides an array of assembly instructions. 22fab44db294846ff05d837b9cf0bf97a073891da7bungeman@google.comclass MCDisassembler { 23ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.compublic: 24ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com /// Constructor - Performs initial setup for the disassembler. 25ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com MCDisassembler(); 26ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com 27ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com virtual ~MCDisassembler(); 28ed673310e2551e64d8196f7776d7d4c92085f8c2reed@android.com 298fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// getInstruction - Returns the disassembly of a single instruction. 308fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// 318fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// @param instr - An MCInst to populate with the contents of the 328fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// instruction. 338fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// @param size - A value to populate with the size of the instruction, or 348fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// the number of bytes consumed while attempting to decode 3539d4f3a02c21a32b766b13068d5bb65d4c332846bsalomon@google.com /// an invalid instruction. 368fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// @param region - The memory object to use as a source for machine code. 378fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// @param address - The address, in the memory space of region, of the first 388fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// byte of the instruction. 398fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com /// @param vStream - The stream to print warnings and diagnostic messages on. 40373ebc634573364c27b1ebd35bb537ef1285cba4bsalomon@google.com /// @return - True if the instruction is valid; false otherwise. 41373ebc634573364c27b1ebd35bb537ef1285cba4bsalomon@google.com virtual bool getInstruction(MCInst& instr, 428fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com uint64_t& size, 438fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com const MemoryObject ®ion, 448fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com uint64_t address, 458fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com raw_ostream &vStream) const = 0; 468fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com}; 478fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com 488fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com} // namespace llvm 498fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com 508fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com#endif 518fe84b53a64b5d92f3aabdd8e7fc7b2ee15c0a75bsalomon@google.com