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

Annotation of /trunk/common/include/x86emitter/x86emitter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 11 months ago) by william
File MIME type: text/plain
File size: 2902 byte(s)
committing r3113 initial commit again...
1 william 31 /* PCSX2 - PS2 Emulator for PCs
2     * Copyright (C) 2002-2010 PCSX2 Dev Team
3     *
4     * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5     * of the GNU Lesser General Public License as published by the Free Software Found-
6     * ation, either version 3 of the License, or (at your option) any later version.
7     *
8     * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10     * PURPOSE. See the GNU General Public License for more details.
11     *
12     * You should have received a copy of the GNU General Public License along with PCSX2.
13     * If not, see <http://www.gnu.org/licenses/>.
14     */
15    
16     /*
17     * ix86 public header v0.9.1
18     *
19     * Original Authors (v0.6.2 and prior):
20     * linuzappz <linuzappz@pcsx.net>
21     * alexey silinov
22     * goldfinger
23     * zerofrog(@gmail.com)
24     *
25     * Authors of v0.9.1:
26     * Jake.Stine(@gmail.com)
27     * cottonvibes(@gmail.com)
28     * sudonim(1@gmail.com)
29     */
30    
31     //////////////////////////////////////////////////////////////////////////////////////////
32     // New C++ Emitter!
33     //
34     // To use it just include the x86Emitter namespace into your file/class/function off choice.
35     //
36     // This header file is intended for use by public code. It includes the appropriate
37     // inlines and class definitions for efficient codegen. (code internal to the emitter
38     // should usually use ix86_internal.h instead, and manually include the
39     // ix86_inlines.inl file when it is known that inlining of ModSib functions are
40     // wanted).
41     //
42    
43     #pragma once
44    
45     #include "x86types.h"
46     #include "tools.h"
47     #include "instructions.h"
48    
49     // Including legacy items for now, but these should be removed eventually,
50     // once most code is no longer dependent on them.
51     #include "legacy_types.h"
52     #include "legacy_instructions.h"
53    
54     // --------------------------------------------------------------------------------------
55     // CallAddress Macros -- An Optimization work-around hack!
56     // --------------------------------------------------------------------------------------
57     // MSVC 2008 fails to optimize direct invocation of static recompiled code buffers, instead
58     // insisting on "mov eax, immaddr; call eax". Likewise, GCC fails to optimize it also, unless
59     // the typecast is explicitly inlined. These macros account for these problems.
60     //
61    
62     #ifdef _MSC_VER
63    
64     # define CallAddress( ptr ) \
65     __asm{ call offset ptr }
66    
67     # define FastCallAddress( ptr, param1 ) \
68     __asm{ __asm mov ecx, param1 __asm call offset ptr }
69    
70     # define FastCallAddress2( ptr, param1, param2 ) \
71     __asm{ __asm mov ecx, param1 __asm mov edx, param2 __asm call offset ptr }
72    
73     #else
74    
75     # define CallAddress( ptr ) \
76     ( (void (*)()) &(ptr)[0] )()
77    
78     # define FastCallAddress( ptr, param1 ) \
79     ( (void (*)( int )) &(ptr)[0] )( param1 )
80    
81     # define FastCallAddress2( ptr, param1, param2 ) \
82     ( (void (*)( int, int )) &(ptr)[0] )( param1, param2 )
83    
84     #endif

  ViewVC Help
Powered by ViewVC 1.1.22