00001 /* 00002 * Copyright (C) 1996-2001, The University of Queensland 00003 * Copyright (C) 2001, Sun Microsystems, Inc 00004 * 00005 * See the file "LICENSE.TERMS" for information on usage and 00006 * redistribution of this file, and for a DISCLAIMER OF ALL 00007 * WARRANTIES. 00008 * 00009 */ 00010 00011 /*============================================================================== 00012 * FILE: ppcdecoder.h 00013 * OVERVIEW: The implementation of the instruction decoder for PPC. 00014 *============================================================================*/ 00015 00016 /* 00017 * $Revision: 1.4 $ // 1.3.2.1 00018 * 00019 * 23 Nov 04 - Jay Sweeney and Alejandro Dubrovsky: Created. 00020 */ 00021 00022 #ifndef PPCDECODER 00023 #define PPCDECODER 00024 00025 class Prog; 00026 class NJMCDecoder; 00027 struct DecodeResult; 00028 00029 class PPCDecoder : public NJMCDecoder 00030 { 00031 public: 00032 /* Default constructor 00033 */ 00034 PPCDecoder(Prog* prog); 00035 00036 /* 00037 * Decodes the machine instruction at pc and returns an RTL instance for 00038 * the instruction. 00039 */ 00040 virtual DecodeResult& decodeInstruction (ADDRESS pc, int delta); 00041 00042 /* 00043 * Disassembles the machine instruction at pc and returns the number of 00044 * bytes disassembled. Assembler output goes to global _assembly 00045 */ 00046 virtual int decodeAssemblyInstruction (ADDRESS pc, int delta); 00047 00048 00049 private: 00050 /* 00051 * Various functions to decode the operands of an instruction into an Exp* representation. 00052 */ 00053 Exp* dis_Eaddr(ADDRESS pc, int size = 0); 00054 Exp* dis_RegImm(ADDRESS pc); 00055 Exp* dis_Reg(unsigned r); 00056 Exp* dis_RAmbz(unsigned r); // Special for rA of certain instructions 00057 00058 void unused(int x); 00059 RTL* createBranchRtl(ADDRESS pc, std::list<Statement*>* stmts, const char* name); 00060 bool isFuncPrologue(ADDRESS hostPC); 00061 DWord getDword(ADDRESS lc); 00062 00063 }; 00064 00065 #endif