📄 parser.h
字号:
/**
* Copyright (c) 2005 Zhejiang University, P.R.China
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//=============================================================================
/**
* \class PPC_Parser
*
* \brief Parser to parse ppc instructions
*
* \author Chenfeng Zhou <ini_autumn@163.com>
*
* Created : <2005-02-09 23:24:33 by Cheney Chow>
* Last update: <2005-02-11 23:33:23 by Cheney Chow>
*
* $Id: Parser.h,v 1.1 2005/06/16 06:01:50 qilj Exp $
*/
//=============================================================================
#ifndef _PPC_PARSER_H_
#define _PPC_PARSER_H_
#include "Types.h"
namespace PPC
{
/**
* @class PPC_Parser
* @brief Base Parser class
*/
class PPC_Parser
{
public:
typedef
enum {D_SIMM, D_UIMM,
X} Parse_Type;
protected:
PPC_Parser () {}
virtual ~PPC_Parser () {}
};
/**
* @class D_Form_Parser
* @brief Parse D Form instructions
*/
class D_Form_Parser : public PPC_Parser
{
public:
virtual ~D_Form_Parser () {}
public:
/// Signed immediate
static void parse_simm (PPC_Instr_T,
PPC_s32 &D, PPC_s32 &A, PPC_u32 &SImm);
/// Unsigned immediate
static void parse_uimm (PPC_Instr_T,
PPC_s32 &D, PPC_s32 &A, PPC_u32 &UImm);
/// Shifted immediate
static void parse_shift16 (PPC_Instr_T,
PPC_s32 &D, PPC_s32 &A, PPC_u32 &Imm16);
};
/**
* @class I_Form_Parser
* @brief Parse I Form instructions
*/
class I_Form_Parser : public PPC_Parser
{
public:
virtual ~I_Form_Parser () {}
static void parse (PPC_Instr_T, PPC_u32 &LI);
};
/**
* @class B_Form_Parser
* @brief Parse B Form instructions
*/
class B_Form_Parser : public PPC_Parser
{
public:
virtual ~B_Form_Parser () {}
static void parse (PPC_Instr_T,
PPC_u32 &BO, PPC_u32 &BD, PPC_u32 &BI);
};
/**
* @class A_Form_Parser
* @brief Parse A Form instructions
*/
class A_Form_Parser : public PPC_Parser
{
public:
virtual ~A_Form_Parser () {}
static void parse (PPC_Instr_T,
PPC_s32 &D, PPC_s32 &A, PPC_s32 &B, PPC_s32 &C);
};
/**
* @class X_Form_Parser
* @brief Parse X Form instructions
*/
class X_Form_Parser : public PPC_Parser
{
public:
virtual ~X_Form_Parser () {}
static void parse_x (PPC_Instr_T,
PPC_s32 &S, PPC_s32 &A, PPC_s32 &B);
static void parse_xfx (PPC_Instr_T,
PPC_s32 &S, PPC_u32 &crm);
static void parse_xo (PPC_Instr_T,
PPC_s32 &D, PPC_s32 &A, PPC_s32 &B);
static void parse_xl (PPC_Instr_T,
PPC_u32 &BO, PPC_u32 &BI, PPC_u32 &BD);
static void parse_xfl (PPC_Instr_T,
PPC_s32 &B, PPC_u32 &fm);
};
class M_Form_Parser : public PPC_Parser
{
public:
virtual ~M_Form_Parser () {}
static void parse (PPC_Instr_T,
PPC_s32 &S, PPC_s32 &A, PPC_s32 &SH, PPC_s32 &MB, PPC_s32 &ME);
};
} // namespace PPC
#endif // _PPC_PARSER_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -