Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Param Class Reference

#include <param.h>

Inheritance diagram for Param:

LiteralParam MemoryParam RegParam List of all members.

Public Types

typedef enum Param::MemoryTypes MemoryTypes
enum  TCRegistry { Registry }
enum  TCLiteral { Literal }
enum  TCFarLiteral { FarLiteral }
enum  TCMemory { Memory }
enum  Types { t_registry, t_literal, t_memory, t_farliteral }
enum  MemoryTypes {
  name, name, memNone, memInt8,
  memMmx, memMmx8, memXmm, memFarPointer16,
  memBound16, memDescriptor, memFPFloat32, memFPBCD,
  memFPEnv16, memFPStatus16, memXStatus, memTypeCount
}

Public Methods

enum Types GetType () const
 Param ()
 Param (enum TCRegistry dummy, reg_t reg)
 Param (enum TCLiteral dummy, int _literal, unsigned char _size=0)
 Param (enum TCFarLiteral dummy, int _literal, unsigned char _size, int segment)
 Param (enum TCMemory dummy, int address, MemoryTypes memType=memNone)
 Param (enum TCMemory dummy, reg_t reg, int address=0, MemoryTypes memType=memNone)
 Param (enum TCMemory dummy, reg_t reg1, reg_t reg2, int address=0, unsigned char multiplier=1, MemoryTypes memType=memNone)
bool RegEqual (const Param &rhs) const
unsigned char GetSize () const
unsigned char GetLiteralSize () const
unsigned GetMemSize () const
void SetMemType (MemoryTypes _memType, bool bWriteSize=true)
bool MustWriteMemSize () const

Public Attributes

reg_t mem_reg1
reg_t mem_reg2
int literal
const Relocationrelocation
enum Types type
unsigned char factor

Private Attributes

union {
   unsigned char   size
   unsigned char   memType
sm

Static Private Attributes

unsigned memTypeSizes [memTypeCount]

Member Typedef Documentation

typedef enum Param::MemoryTypes Param::MemoryTypes
 

Referenced by InstructionDecoder::do_mod_rm(), InstructionDecoder::mod_reg2(), and RegSizeToMemType().


Member Enumeration Documentation

enum Param::MemoryTypes
 

Enumeration values:
name 
name 
memNone 
memInt8 
memMmx 
memMmx8 
memXmm 
memFarPointer16 
memBound16 
memDescriptor 
memFPFloat32 
memFPBCD 
memFPEnv16 
memFPStatus16 
memXStatus 
memTypeCount 

Definition at line 47 of file param.h.

00047                            {
00048 #define DEFINE_MEMTYPE(name,size) name,
00049 #define DEFINE_MEMTYPEI(name,size) name = 0,
00050 #include "memtype.h"
00051 #undef DEFINE_MEMTYPE
00052 #undef DEFINE_MEMTYPEI
00053     memTypeCount
00054   } MemoryTypes;
00055 //  std::string GetString() const;
00056   enum Types GetType() const { return type; };
00057   Param():relocation(NULL) {};
00058   // costruttori per registro
00059   Param(enum TCRegistry dummy,reg_t reg);
00060   // costruttori per letterali (costanti)
00061   Param(enum TCLiteral dummy,int _literal,unsigned char _size=0);
00062   // costruttori per letterali (costanti)
00063   Param(enum TCFarLiteral dummy,int _literal,unsigned char _size,int segment);
00064   // costruttori per memoria
00065   Param(enum TCMemory dummy,int address,MemoryTypes memType = memNone);
00066   Param(enum TCMemory dummy,reg_t reg,int address=0,MemoryTypes memType = memNone);
00067   Param(enum TCMemory dummy,reg_t reg1,reg_t reg2,int address=0,unsigned char multiplier=1,MemoryTypes memType = memNone);
00068 
00069 //protected:
00070 public:
00071   bool RegEqual(const Param& rhs) const
00072   { return type == t_registry && rhs.type == t_registry && mem_reg1 == rhs.mem_reg1; }
00073 //  bool operator==();
00074   reg_t mem_reg1; // null_reg if not present, set if type registry
00075   reg_t mem_reg2; // null_reg if not present
00076   int literal; // 0 if not present
00077   const Relocation* relocation;  // informazioni rilocazione relative a literal
00078   enum Types type;
00079   unsigned char factor; // if mem_reg2 set
00080   unsigned char GetSize() const;
00081   unsigned char GetLiteralSize() const
00082   {
00083     _PRG_ASSERT( type == t_literal || type == t_farliteral );
00084     return sm.size;
00085   };
00086   unsigned GetMemSize() const
00087   {
00088     _PRG_ASSERT( type == t_memory );
00089     _PRG_ASSERT( unsigned(sm.memType&0x7F) < memTypeCount );
00090     return memTypeSizes[sm.memType&0x7F];
00091   };
00092   void SetMemType(MemoryTypes _memType,bool bWriteSize = true)
00093   {
00094     _PRG_ASSERT( type == t_memory );
00095     _PRG_ASSERT( unsigned(_memType) < memTypeCount );
00096     _PRG_ASSERT( memTypeCount < 128 );
00097     sm.memType = (unsigned char)_memType;
00098     if (!bWriteSize)
00099       sm.memType |= 0x80;
00100   };
00101   bool MustWriteMemSize() const
00102   {
00103     _PRG_ASSERT( type == t_memory );
00104     return (sm.memType & 0x80) == 0;
00105   }
00106 private:
00107   union {
00108   unsigned char size; // 0 if unspecified
00109   unsigned char memType;
00110   } sm;
00111   static unsigned memTypeSizes[memTypeCount];
00112 };
00113 
00114 class RegParam: public Param
00115 {
00116 public:
00117   RegParam(reg_t reg);

enum Param::TCFarLiteral
 

Enumeration values:
FarLiteral 

Definition at line 44 of file param.h.

00044 { FarLiteral  };

enum Param::TCLiteral
 

Enumeration values:
Literal 

Definition at line 43 of file param.h.

00043 { Literal  };

enum Param::TCMemory
 

Enumeration values:
Memory 

Definition at line 45 of file param.h.

00045 { Memory   };

enum Param::TCRegistry
 

Enumeration values:
Registry 

Definition at line 42 of file param.h.

00042 { Registry };

enum Param::Types
 

Enumeration values:
t_registry 
t_literal 
t_memory 
t_farliteral 

Definition at line 46 of file param.h.


Constructor & Destructor Documentation

Param::Param   [inline]
 

Definition at line 120 of file param.h.

References LiteralParam::LiteralParam().

00120 : public Param

Param::Param enum TCRegistry    dummy,
reg_t    reg
 

Definition at line 107 of file param.cpp.

References sm.

00107 {
00108   sm.size = 0;
00109 }
00110 
00111 void Param::CheckValid()
00112 {
00113   if (type == t_literal)
00114   {
00115     _PRG_ASSERT(sm.size != 0);

Param::Param enum TCLiteral    dummy,
int    _literal,
unsigned char    _size = 0
 

Definition at line 117 of file param.cpp.

00121 {
00122   switch (type)
00123   {
00124   default:
00125     _PRG_ASSERT(0);

Param::Param enum TCFarLiteral    dummy,
int    _literal,
unsigned char    _size,
int    segment
 

Definition at line 127 of file param.cpp.

References mem_reg1, t_farliteral, t_literal, and t_registry.

00128                 :
00129   case t_farliteral:
00130     return GetLiteralSize();
00131   case t_registry:
00132     return RegistryInfo::GetInfo(mem_reg1)->GetByteSize();
00133   }
00134 }

Param::Param enum TCMemory    dummy,
int    address,
MemoryTypes    memType = memNone
 

Definition at line 137 of file param.cpp.

Param::Param enum TCMemory    dummy,
reg_t    reg,
int    address = 0,
MemoryTypes    memType = memNone
 

Definition at line 147 of file param.cpp.

Param::Param enum TCMemory    dummy,
reg_t    reg1,
reg_t    reg2,
int    address = 0,
unsigned char    multiplier = 1,
MemoryTypes    memType = memNone
 

Definition at line 157 of file param.cpp.


Member Function Documentation

unsigned char Param::GetLiteralSize   const [inline]
 

Definition at line 144 of file param.h.

Referenced by CodeParser::CheckForAddress(), CodeParser::CheckImmediateCodeAddress(), and Instruction::Write().

unsigned Param::GetMemSize   const [inline]
 

Definition at line 149 of file param.h.

Referenced by CodeParser::CheckForAddress(), InstructionDecoder::Decode(), CodeParser::ExecuteComplexReferenceMemory(), Instruction::GetUseType(), and Instruction::Write().

unsigned char Param::GetSize   const
 

Definition at line 183 of file param.cpp.

enum Types Param::GetType   const [inline]
 

Definition at line 119 of file param.h.

Referenced by THeuristicMotor::THeuristicMotor().

00120 : public Param

bool Param::MustWriteMemSize   const [inline]
 

Definition at line 164 of file param.h.

Referenced by Instruction::Write().

bool Param::RegEqual const Param &    rhs const [inline]
 

Definition at line 134 of file param.h.

Referenced by Instruction::WriteRegUsage().

void Param::SetMemType MemoryTypes    _memType,
bool    bWriteSize = true
[inline]
 

Definition at line 155 of file param.h.

Referenced by InstructionDecoder::do_mod_rm().


Member Data Documentation

unsigned char Param::factor
 

Definition at line 142 of file param.h.

Referenced by InstructionDecoder::do_mod_rm(), InstructionDecoder::do_sib(), CodeParser::ExecuteComplexReferenceMemory(), InstructionDecoder::mod0(), InstructionDecoder::mod1(), InstructionDecoder::mod2(), Instruction::Write(), and Instruction::WriteRegUsage().

int Param::literal
 

Definition at line 139 of file param.h.

Referenced by CodeParser::AddTempFlow(), CodeParser::CheckForAddress(), CodeParser::CheckImmediateCodeAddress(), CodeParser::CheckJumpReference(), CodeParser::ContainValidAddress(), CodeParser::ExecuteComplexReferenceMemory(), InstructionDecoder::getv_rel(), CodeParser::IsApiReference(), ScanningComplexReg::ProcessInstruction(), CodeParser::ScanCode(), THeuristicMotor::THeuristicMotor(), Instruction::Write(), and Instruction::WriteRegUsage().

reg_t Param::mem_reg1
 

Definition at line 137 of file param.h.

Referenced by CodeParser::AddTempFlow(), CodeParser::CheckForAddress(), CodeParser::CheckJumpReference(), CodeParser::ExecuteComplexReferenceMemory(), CodeParser::ExecuteComplexReferenceReg(), Instruction::GetUseType(), CodeParser::IsApiReference(), Param(), THeuristicMotor::THeuristicMotor(), Instruction::Write(), and Instruction::WriteRegUsage().

reg_t Param::mem_reg2
 

Definition at line 138 of file param.h.

Referenced by CodeParser::AddTempFlow(), CodeParser::CheckForAddress(), CodeParser::CheckJumpReference(), InstructionDecoder::do_mod_rm(), InstructionDecoder::do_sib(), CodeParser::ExecuteComplexReferenceMemory(), Instruction::GetUseType(), CodeParser::IsApiReference(), InstructionDecoder::mod0(), InstructionDecoder::mod1(), InstructionDecoder::mod2(), THeuristicMotor::THeuristicMotor(), Instruction::Write(), and Instruction::WriteRegUsage().

unsigned char Param::memType [private]
 

Definition at line 172 of file param.h.

unsigned Param::memTypeSizes [static, private]
 

Definition at line 32 of file param.cpp.

const Relocation* Param::relocation
 

Definition at line 140 of file param.h.

Referenced by CodeParser::ContainValidAddress(), InstructionDecoder::Decode(), and InstructionDecoder::getv_rel().

unsigned char Param::size [private]
 

Definition at line 171 of file param.h.

union { ... } Param::sm [private]
 

Referenced by Param().

enum Types Param::type
 

Definition at line 141 of file param.h.

Referenced by CodeParser::AddTempFlow(), CodeParser::CheckForAddress(), CodeParser::CheckImmediateCodeAddress(), CodeParser::CheckJumpReference(), InstructionDecoder::Decode(), CodeParser::ExecuteComplexReference(), CodeParser::ExecuteComplexReferenceMemory(), CodeParser::ExecuteComplexReferenceReg(), Instruction::GetUseType(), CodeParser::IsApiReference(), ScanningComplexReg::ProcessInstruction(), CodeParser::ScanCode(), THeuristicMotor::THeuristicMotor(), and Instruction::Write().


The documentation for this class was generated from the following files:
Generated on Mon Jan 13 22:20:36 2003 for perdr by doxygen1.2.15