/[pcsx2_0.9.7]/trunk/common/include/x86emitter/internal.h
ViewVC logotype

Diff of /trunk/common/include/x86emitter/internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 31 by william, Tue Sep 7 03:24:11 2010 UTC revision 62 by william, Tue Sep 7 11:08:22 2010 UTC
# Line 18  Line 18 
18  #include "x86types.h"  #include "x86types.h"
19  #include "instructions.h"  #include "instructions.h"
20    
 #define OpWriteSSE( pre, op )           xOpWrite0F( pre, op, to, from )  
21    
22  namespace x86Emitter {  namespace x86Emitter {
23    
24  extern void SimdPrefix( u8 prefix, u16 opcode );  #define OpWriteSSE( pre, op )           xOpWrite0F( pre, op, to, from )
 extern void EmitSibMagic( uint regfield, const void* address );  
 extern void EmitSibMagic( uint regfield, const ModSibBase& info );  
 extern void EmitSibMagic( uint reg1, const xRegisterBase& reg2 );  
 extern void EmitSibMagic( const xRegisterBase& reg1, const xRegisterBase& reg2 );  
 extern void EmitSibMagic( const xRegisterBase& reg1, const void* src );  
 extern void EmitSibMagic( const xRegisterBase& reg1, const ModSibBase& sib );  
   
 extern void _xMovRtoR( const xRegisterInt& to, const xRegisterInt& from );  
 extern void _g1_EmitOp( G1Type InstType, const xRegisterInt& to, const xRegisterInt& from );  
   
 template< typename T > inline  
 void xWrite( T val )  
 {  
         *(T*)x86Ptr = val;  
         x86Ptr += sizeof(T);  
 }  
   
 template< typename T1, typename T2 > __emitinline  
 void xOpWrite( u8 prefix, u8 opcode, const T1& param1, const T2& param2 )  
 {  
         if( prefix != 0 )  
                 xWrite16( (opcode<<8) | prefix );  
         else  
                 xWrite8( opcode );  
   
         EmitSibMagic( param1, param2 );  
 }  
   
 template< typename T1, typename T2 > __emitinline  
 void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2 )  
 {  
         SimdPrefix( prefix, opcode );  
         EmitSibMagic( param1, param2 );  
 }  
25    
26  template< typename T1, typename T2 > __emitinline          extern void SimdPrefix( u8 prefix, u16 opcode );
27  void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2, u8 imm8 )          extern void EmitSibMagic( uint regfield, const void* address );
28  {          extern void EmitSibMagic( uint regfield, const xIndirectVoid& info );
29          xOpWrite0F( prefix, opcode, param1, param2 );          extern void EmitSibMagic( uint reg1, const xRegisterBase& reg2 );
30          xWrite8( imm8 );          extern void EmitSibMagic( const xRegisterBase& reg1, const xRegisterBase& reg2 );
31  }          extern void EmitSibMagic( const xRegisterBase& reg1, const void* src );
32            extern void EmitSibMagic( const xRegisterBase& reg1, const xIndirectVoid& sib );
33    
34            extern void _xMovRtoR( const xRegisterInt& to, const xRegisterInt& from );
35    
36            template< typename T > inline
37                    void xWrite( T val )
38            {
39                    *(T*)x86Ptr = val;
40                    x86Ptr += sizeof(T);
41            }
42    
43            template< typename T1, typename T2 > __emitinline
44                    void xOpWrite( u8 prefix, u8 opcode, const T1& param1, const T2& param2 )
45            {
46                    if( prefix != 0 )
47                            xWrite16( (opcode<<8) | prefix );
48                    else
49                            xWrite8( opcode );
50    
51                    EmitSibMagic( param1, param2 );
52            }
53    
54            template< typename T1, typename T2 > __emitinline
55                    void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2 )
56            {
57                    SimdPrefix( prefix, opcode );
58                    EmitSibMagic( param1, param2 );
59            }
60    
61            template< typename T1, typename T2 > __emitinline
62                    void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2, u8 imm8 )
63            {
64                    xOpWrite0F( prefix, opcode, param1, param2 );
65                    xWrite8( imm8 );
66            }
67    
68  template< typename T1, typename T2 > __emitinline          template< typename T1, typename T2 > __emitinline
69  void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2 )                       { xOpWrite0F( 0, opcode, param1, param2 ); }                  void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2 )                       { xOpWrite0F( 0, opcode, param1, param2 ); }
70    
71  template< typename T1, typename T2 > __emitinline          template< typename T1, typename T2 > __emitinline
72  void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2, u8 imm8 )      { xOpWrite0F( 0, opcode, param1, param2, imm8 ); }                  void xOpWrite0F( u16 opcode, const T1& param1, const T2& param2, u8 imm8 )      { xOpWrite0F( 0, opcode, param1, param2, imm8 ); }
73    
74  }  }
75    

Legend:
Removed from v.31  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.22