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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 1 month ago) by william
File MIME type: text/plain
File size: 2906 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* 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 // PCSX2's New C++ Emitter
32 // --------------------------------------------------------------------------------------
33 // To use it just include the x86Emitter namespace into your file/class/function off choice.
34 //
35 // This header file is intended for use by public code. It includes the appropriate
36 // inlines and class definitions for efficient codegen. (code internal to the emitter
37 // should usually use ix86_internal.h instead, and manually include the
38 // ix86_inlines.inl file when it is known that inlining of ModSib functions are
39 // wanted).
40 //
41
42 #pragma once
43
44 #include "x86types.h"
45 #include "tools.h"
46 #include "instructions.h"
47
48 // Including legacy items for now, but these should be removed eventually,
49 // once most code is no longer dependent on them.
50 #include "legacy_types.h"
51 #include "legacy_instructions.h"
52
53 // --------------------------------------------------------------------------------------
54 // CallAddress Macros -- An Optimization work-around hack!
55 // --------------------------------------------------------------------------------------
56 // MSVC 2008 fails to optimize direct invocation of static recompiled code buffers, instead
57 // insisting on "mov eax, immaddr; call eax". Likewise, GCC fails to optimize it also, unless
58 // the typecast is explicitly inlined. These macros account for these problems.
59 //
60
61 #ifdef _MSC_VER
62
63 # define CallAddress( ptr ) \
64 __asm{ call offset ptr }
65
66 # define FastCallAddress( ptr, param1 ) \
67 __asm{ __asm mov ecx, param1 __asm call offset ptr }
68
69 # define FastCallAddress2( ptr, param1, param2 ) \
70 __asm{ __asm mov ecx, param1 __asm mov edx, param2 __asm call offset ptr }
71
72 #else
73
74 # define CallAddress( ptr ) \
75 ( (void (*)()) &(ptr)[0] )()
76
77 # define FastCallAddress( ptr, param1 ) \
78 ( (void (*)( int )) &(ptr)[0] )( param1 )
79
80 # define FastCallAddress2( ptr, param1, param2 ) \
81 ( (void (*)( int, int )) &(ptr)[0] )( param1, param2 )
82
83 #endif

  ViewVC Help
Powered by ViewVC 1.1.22