blob: e4a00133fd07c2d80fefe18c2a60b1611174980f [file] [log] [blame]
cerionbcf8c3e2005-02-04 16:17:07 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
ceriond0eae2d2005-12-23 11:43:01 +00004/*--- This file (host-ppc/hdefs.h) is ---*/
sewardjdbcfae72005-08-02 11:14:04 +00005/*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*/
cerionbcf8c3e2005-02-04 16:17:07 +00006/*--- ---*/
7/*---------------------------------------------------------------*/
8
9/*
10 This file is part of LibVEX, a library for dynamic binary
11 instrumentation and translation.
12
sewardj7bd6ffe2005-08-03 16:07:36 +000013 Copyright (C) 2004-2005 OpenWorks LLP. All rights reserved.
cerionbcf8c3e2005-02-04 16:17:07 +000014
sewardj7bd6ffe2005-08-03 16:07:36 +000015 This library is made available under a dual licensing scheme.
cerionbcf8c3e2005-02-04 16:17:07 +000016
sewardj7bd6ffe2005-08-03 16:07:36 +000017 If you link LibVEX against other code all of which is itself
18 licensed under the GNU General Public License, version 2 dated June
19 1991 ("GPL v2"), then you may use LibVEX under the terms of the GPL
20 v2, as appearing in the file LICENSE.GPL. If the file LICENSE.GPL
21 is missing, you can obtain a copy of the GPL v2 from the Free
22 Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 02110-1301, USA.
24
25 For any other uses of LibVEX, you must first obtain a commercial
26 license from OpenWorks LLP. Please contact info@open-works.co.uk
27 for information about commercial licensing.
28
29 This software is provided by OpenWorks LLP "as is" and any express
30 or implied warranties, including, but not limited to, the implied
31 warranties of merchantability and fitness for a particular purpose
32 are disclaimed. In no event shall OpenWorks LLP be liable for any
33 direct, indirect, incidental, special, exemplary, or consequential
34 damages (including, but not limited to, procurement of substitute
35 goods or services; loss of use, data, or profits; or business
36 interruption) however caused and on any theory of liability,
37 whether in contract, strict liability, or tort (including
38 negligence or otherwise) arising in any way out of the use of this
39 software, even if advised of the possibility of such damage.
cerionbcf8c3e2005-02-04 16:17:07 +000040
41 Neither the names of the U.S. Department of Energy nor the
42 University of California nor the names of its contributors may be
43 used to endorse or promote products derived from this software
44 without prior written permission.
cerionbcf8c3e2005-02-04 16:17:07 +000045*/
46
cerion5b2325f2005-12-23 00:55:09 +000047#ifndef __LIBVEX_HOST_PPC_HDEFS_H
48#define __LIBVEX_HOST_PPC_HDEFS_H
cerionbcf8c3e2005-02-04 16:17:07 +000049
cerion2c49e032005-02-09 17:29:49 +000050/* Num registers used for function calls */
cerionf0de28c2005-12-13 20:21:11 +000051#define PPC_N_REGPARMS 8
cerion2c49e032005-02-09 17:29:49 +000052
cerionbcf8c3e2005-02-04 16:17:07 +000053
54/* --------- Registers. --------- */
55
56/* The usual HReg abstraction. There are 32 real int regs,
cerion225a0342005-09-12 20:49:09 +000057 32 real float regs, and 32 real vector regs.
cerionbcf8c3e2005-02-04 16:17:07 +000058*/
59
cerion5b2325f2005-12-23 00:55:09 +000060extern void ppHRegPPC ( HReg );
cerionbcf8c3e2005-02-04 16:17:07 +000061
cerionf0de28c2005-12-13 20:21:11 +000062extern HReg hregPPC_GPR0 ( Bool mode64 ); // scratch reg / zero reg
63extern HReg hregPPC_GPR1 ( Bool mode64 ); // Stack Frame Pointer
64extern HReg hregPPC_GPR2 ( Bool mode64 ); // not used: TOC pointer
65extern HReg hregPPC_GPR3 ( Bool mode64 );
66extern HReg hregPPC_GPR4 ( Bool mode64 );
67extern HReg hregPPC_GPR5 ( Bool mode64 );
68extern HReg hregPPC_GPR6 ( Bool mode64 );
69extern HReg hregPPC_GPR7 ( Bool mode64 );
70extern HReg hregPPC_GPR8 ( Bool mode64 );
71extern HReg hregPPC_GPR9 ( Bool mode64 );
72extern HReg hregPPC_GPR10 ( Bool mode64 );
cerion5b2325f2005-12-23 00:55:09 +000073extern HReg hregPPC_GPR11 ( Bool mode64 );
74extern HReg hregPPC_GPR12 ( Bool mode64 );
75extern HReg hregPPC_GPR13 ( Bool mode64 );
cerionf0de28c2005-12-13 20:21:11 +000076extern HReg hregPPC_GPR14 ( Bool mode64 );
77extern HReg hregPPC_GPR15 ( Bool mode64 );
78extern HReg hregPPC_GPR16 ( Bool mode64 );
79extern HReg hregPPC_GPR17 ( Bool mode64 );
80extern HReg hregPPC_GPR18 ( Bool mode64 );
81extern HReg hregPPC_GPR19 ( Bool mode64 );
82extern HReg hregPPC_GPR20 ( Bool mode64 );
83extern HReg hregPPC_GPR21 ( Bool mode64 );
84extern HReg hregPPC_GPR22 ( Bool mode64 );
85extern HReg hregPPC_GPR23 ( Bool mode64 );
86extern HReg hregPPC_GPR24 ( Bool mode64 );
87extern HReg hregPPC_GPR25 ( Bool mode64 );
88extern HReg hregPPC_GPR26 ( Bool mode64 );
89extern HReg hregPPC_GPR27 ( Bool mode64 );
90extern HReg hregPPC_GPR28 ( Bool mode64 );
sewardjb8a8dba2005-12-15 21:33:50 +000091extern HReg hregPPC_GPR29 ( Bool mode64 ); // reserved for dispatcher
cerion5b2325f2005-12-23 00:55:09 +000092extern HReg hregPPC_GPR30 ( Bool mode64 ); // used as VMX spill temp
sewardjb8a8dba2005-12-15 21:33:50 +000093extern HReg hregPPC_GPR31 ( Bool mode64 ); // GuestStatePtr (callee-saved)
cerionbcf8c3e2005-02-04 16:17:07 +000094
cerion5b2325f2005-12-23 00:55:09 +000095extern HReg hregPPC_FPR0 ( void );
96extern HReg hregPPC_FPR1 ( void );
97extern HReg hregPPC_FPR2 ( void );
98extern HReg hregPPC_FPR3 ( void );
99extern HReg hregPPC_FPR4 ( void );
100extern HReg hregPPC_FPR5 ( void );
101extern HReg hregPPC_FPR6 ( void );
102extern HReg hregPPC_FPR7 ( void );
103extern HReg hregPPC_FPR8 ( void );
104extern HReg hregPPC_FPR9 ( void );
105extern HReg hregPPC_FPR10 ( void );
106extern HReg hregPPC_FPR11 ( void );
107extern HReg hregPPC_FPR12 ( void );
108extern HReg hregPPC_FPR13 ( void );
109extern HReg hregPPC_FPR14 ( void );
110extern HReg hregPPC_FPR15 ( void );
111extern HReg hregPPC_FPR16 ( void );
112extern HReg hregPPC_FPR17 ( void );
113extern HReg hregPPC_FPR18 ( void );
114extern HReg hregPPC_FPR19 ( void );
115extern HReg hregPPC_FPR20 ( void );
116extern HReg hregPPC_FPR21 ( void );
117extern HReg hregPPC_FPR22 ( void );
118extern HReg hregPPC_FPR23 ( void );
119extern HReg hregPPC_FPR24 ( void );
120extern HReg hregPPC_FPR25 ( void );
121extern HReg hregPPC_FPR26 ( void );
122extern HReg hregPPC_FPR27 ( void );
123extern HReg hregPPC_FPR28 ( void );
124extern HReg hregPPC_FPR29 ( void );
125extern HReg hregPPC_FPR30 ( void );
126extern HReg hregPPC_FPR31 ( void );
cerionbcf8c3e2005-02-04 16:17:07 +0000127
cerion5b2325f2005-12-23 00:55:09 +0000128extern HReg hregPPC_VR0 ( void );
129extern HReg hregPPC_VR1 ( void );
130extern HReg hregPPC_VR2 ( void );
131extern HReg hregPPC_VR3 ( void );
132extern HReg hregPPC_VR4 ( void );
133extern HReg hregPPC_VR5 ( void );
134extern HReg hregPPC_VR6 ( void );
135extern HReg hregPPC_VR7 ( void );
136extern HReg hregPPC_VR8 ( void );
137extern HReg hregPPC_VR9 ( void );
138extern HReg hregPPC_VR10 ( void );
139extern HReg hregPPC_VR11 ( void );
140extern HReg hregPPC_VR12 ( void );
141extern HReg hregPPC_VR13 ( void );
142extern HReg hregPPC_VR14 ( void );
143extern HReg hregPPC_VR15 ( void );
144extern HReg hregPPC_VR16 ( void );
145extern HReg hregPPC_VR17 ( void );
146extern HReg hregPPC_VR18 ( void );
147extern HReg hregPPC_VR19 ( void );
148extern HReg hregPPC_VR20 ( void );
149extern HReg hregPPC_VR21 ( void );
150extern HReg hregPPC_VR22 ( void );
151extern HReg hregPPC_VR23 ( void );
152extern HReg hregPPC_VR24 ( void );
153extern HReg hregPPC_VR25 ( void );
154extern HReg hregPPC_VR26 ( void );
155extern HReg hregPPC_VR27 ( void );
156extern HReg hregPPC_VR28 ( void );
157extern HReg hregPPC_VR29 ( void );
158extern HReg hregPPC_VR30 ( void );
159extern HReg hregPPC_VR31 ( void );
cerionbcf8c3e2005-02-04 16:17:07 +0000160
cerionf0de28c2005-12-13 20:21:11 +0000161#define StackFramePtr(_mode64) hregPPC_GPR1(_mode64)
162#define GuestStatePtr(_mode64) hregPPC_GPR31(_mode64)
cerionbcf8c3e2005-02-04 16:17:07 +0000163
cerion2c49e032005-02-09 17:29:49 +0000164
165
sewardjb51f0f42005-07-18 11:38:02 +0000166/* --------- Condition codes --------- */
cerion2c49e032005-02-09 17:29:49 +0000167
sewardjb51f0f42005-07-18 11:38:02 +0000168/* This gives names from bitfields in CR; hence it names BI numbers */
169/* Using IBM/hardware indexing convention */
cerion2c49e032005-02-09 17:29:49 +0000170typedef
sewardjb51f0f42005-07-18 11:38:02 +0000171 enum {
172 // CR7, which we use for integer compares
173 Pcf_7LT = 28, /* neg | lt */
174 Pcf_7GT = 29, /* pos | gt */
175 Pcf_7EQ = 30, /* zero | equal */
176 Pcf_7SO = 31 /* summary overflow */
cerionab9132d2005-02-15 15:46:59 +0000177 }
cerion5b2325f2005-12-23 00:55:09 +0000178 PPCCondFlag;
cerion2c49e032005-02-09 17:29:49 +0000179
cerionab9132d2005-02-15 15:46:59 +0000180typedef
cerion7cf8e4e2005-02-16 16:08:17 +0000181 enum { /* Maps bc bitfield BO */
cerion33aa6da2005-02-16 10:25:26 +0000182 Pct_FALSE = 0x4,
183 Pct_TRUE = 0xC,
184 Pct_ALWAYS = 0x14
cerionab9132d2005-02-15 15:46:59 +0000185 }
cerion5b2325f2005-12-23 00:55:09 +0000186 PPCCondTest;
cerionab9132d2005-02-15 15:46:59 +0000187
188typedef
189 struct {
cerion5b2325f2005-12-23 00:55:09 +0000190 PPCCondFlag flag;
191 PPCCondTest test;
cerion2c49e032005-02-09 17:29:49 +0000192 }
cerion5b2325f2005-12-23 00:55:09 +0000193 PPCCondCode;
cerion2c49e032005-02-09 17:29:49 +0000194
cerion5b2325f2005-12-23 00:55:09 +0000195extern HChar* showPPCCondCode ( PPCCondCode );
cerionbcf8c3e2005-02-04 16:17:07 +0000196
cerion7cf8e4e2005-02-16 16:08:17 +0000197/* constructor */
cerion5b2325f2005-12-23 00:55:09 +0000198extern PPCCondCode mk_PPCCondCode ( PPCCondTest, PPCCondFlag );
cerion7cf8e4e2005-02-16 16:08:17 +0000199
200/* false->true, true->false */
cerion5b2325f2005-12-23 00:55:09 +0000201extern PPCCondTest invertCondTest ( PPCCondTest );
cerionbcf8c3e2005-02-04 16:17:07 +0000202
cerionab9132d2005-02-15 15:46:59 +0000203
204
cerion33aa6da2005-02-16 10:25:26 +0000205
cerionbcf8c3e2005-02-04 16:17:07 +0000206/* --------- Memory address expressions (amodes). --------- */
207
208typedef
209 enum {
sewardja5f957d2005-07-02 01:29:32 +0000210 Pam_IR, /* Immediate (signed 16-bit) + Reg */
cerionbcf8c3e2005-02-04 16:17:07 +0000211 Pam_RR /* Reg1 + Reg2 */
212 }
cerion5b2325f2005-12-23 00:55:09 +0000213 PPCAModeTag;
cerionbcf8c3e2005-02-04 16:17:07 +0000214
215typedef
216 struct {
cerion5b2325f2005-12-23 00:55:09 +0000217 PPCAModeTag tag;
cerionbcf8c3e2005-02-04 16:17:07 +0000218 union {
219 struct {
220 HReg base;
sewardja5f957d2005-07-02 01:29:32 +0000221 Int index;
cerionbcf8c3e2005-02-04 16:17:07 +0000222 } IR;
223 struct {
224 HReg base;
225 HReg index;
226 } RR;
227 } Pam;
228 }
cerion5b2325f2005-12-23 00:55:09 +0000229 PPCAMode;
cerionbcf8c3e2005-02-04 16:17:07 +0000230
cerion5b2325f2005-12-23 00:55:09 +0000231extern PPCAMode* PPCAMode_IR ( Int, HReg );
232extern PPCAMode* PPCAMode_RR ( HReg, HReg );
cerionbcf8c3e2005-02-04 16:17:07 +0000233
cerion5b2325f2005-12-23 00:55:09 +0000234extern PPCAMode* dopyPPCAMode ( PPCAMode* );
cerionbcf8c3e2005-02-04 16:17:07 +0000235
cerion5b2325f2005-12-23 00:55:09 +0000236extern void ppPPCAMode ( PPCAMode* );
cerionbcf8c3e2005-02-04 16:17:07 +0000237
238
sewardjb51f0f42005-07-18 11:38:02 +0000239/* --------- Operand, which can be a reg or a u16/s16. --------- */
240/* ("RH" == "Register or Halfword immediate") */
cerionbcf8c3e2005-02-04 16:17:07 +0000241typedef
242 enum {
sewardjb51f0f42005-07-18 11:38:02 +0000243 Prh_Imm=1,
244 Prh_Reg=2
cerionbcf8c3e2005-02-04 16:17:07 +0000245 }
cerion5b2325f2005-12-23 00:55:09 +0000246 PPCRHTag;
sewardjb51f0f42005-07-18 11:38:02 +0000247
248typedef
249 struct {
cerion5b2325f2005-12-23 00:55:09 +0000250 PPCRHTag tag;
sewardjb51f0f42005-07-18 11:38:02 +0000251 union {
252 struct {
253 Bool syned;
254 UShort imm16;
255 } Imm;
256 struct {
257 HReg reg;
258 } Reg;
259 }
260 Prh;
261 }
cerion5b2325f2005-12-23 00:55:09 +0000262 PPCRH;
sewardjb51f0f42005-07-18 11:38:02 +0000263
cerion5b2325f2005-12-23 00:55:09 +0000264extern PPCRH* PPCRH_Imm ( Bool, UShort );
265extern PPCRH* PPCRH_Reg ( HReg );
sewardjb51f0f42005-07-18 11:38:02 +0000266
cerion5b2325f2005-12-23 00:55:09 +0000267extern void ppPPCRH ( PPCRH* );
sewardjb51f0f42005-07-18 11:38:02 +0000268
269
cerionf0de28c2005-12-13 20:21:11 +0000270/* --------- Operand, which can be a reg or a u32/64. --------- */
sewardjb51f0f42005-07-18 11:38:02 +0000271
272typedef
273 enum {
274 Pri_Imm=3,
275 Pri_Reg=4
276 }
cerion5b2325f2005-12-23 00:55:09 +0000277 PPCRITag;
cerionbcf8c3e2005-02-04 16:17:07 +0000278
279typedef
280 struct {
cerion5b2325f2005-12-23 00:55:09 +0000281 PPCRITag tag;
cerionbcf8c3e2005-02-04 16:17:07 +0000282 union {
cerionf0de28c2005-12-13 20:21:11 +0000283 ULong Imm;
284 HReg Reg;
cerionbcf8c3e2005-02-04 16:17:07 +0000285 }
286 Pri;
287 }
cerion5b2325f2005-12-23 00:55:09 +0000288 PPCRI;
cerionbcf8c3e2005-02-04 16:17:07 +0000289
cerion5b2325f2005-12-23 00:55:09 +0000290extern PPCRI* PPCRI_Imm ( ULong );
291extern PPCRI* PPCRI_Reg ( HReg );
cerionbcf8c3e2005-02-04 16:17:07 +0000292
cerion5b2325f2005-12-23 00:55:09 +0000293extern void ppPPCRI ( PPCRI* );
cerionbcf8c3e2005-02-04 16:17:07 +0000294
295
cerion27b3d7e2005-09-14 20:35:47 +0000296/* --------- Operand, which can be a vector reg or a s6. --------- */
297/* ("VI" == "Vector Register or Immediate") */
298typedef
299 enum {
300 Pvi_Imm=5,
301 Pvi_Reg=6
302 }
cerion5b2325f2005-12-23 00:55:09 +0000303 PPCVI5sTag;
cerion27b3d7e2005-09-14 20:35:47 +0000304
305typedef
306 struct {
cerion5b2325f2005-12-23 00:55:09 +0000307 PPCVI5sTag tag;
cerion27b3d7e2005-09-14 20:35:47 +0000308 union {
309 Char Imm5s;
310 HReg Reg;
311 }
312 Pvi;
313 }
cerion5b2325f2005-12-23 00:55:09 +0000314 PPCVI5s;
cerion27b3d7e2005-09-14 20:35:47 +0000315
cerion5b2325f2005-12-23 00:55:09 +0000316extern PPCVI5s* PPCVI5s_Imm ( Char );
317extern PPCVI5s* PPCVI5s_Reg ( HReg );
cerion27b3d7e2005-09-14 20:35:47 +0000318
cerion5b2325f2005-12-23 00:55:09 +0000319extern void ppPPCVI5s ( PPCVI5s* );
cerion27b3d7e2005-09-14 20:35:47 +0000320
321
cerioncd304492005-02-08 19:40:24 +0000322/* --------- Instructions. --------- */
cerionbcf8c3e2005-02-04 16:17:07 +0000323
cerion2c49e032005-02-09 17:29:49 +0000324/* --------- */
325typedef
326 enum {
327 Pun_NEG,
cerione13bb312005-02-10 19:51:03 +0000328 Pun_NOT,
cerion07b07a92005-12-22 14:32:35 +0000329 Pun_CLZ32,
330 Pun_CLZ64
cerion2c49e032005-02-09 17:29:49 +0000331 }
cerion5b2325f2005-12-23 00:55:09 +0000332 PPCUnaryOp;
cerion2c49e032005-02-09 17:29:49 +0000333
cerion5b2325f2005-12-23 00:55:09 +0000334extern HChar* showPPCUnaryOp ( PPCUnaryOp );
cerioncd304492005-02-08 19:40:24 +0000335
336
337/* --------- */
338typedef
339 enum {
340 Palu_INVALID,
sewardjb51f0f42005-07-18 11:38:02 +0000341 Palu_ADD, Palu_SUB,
342 Palu_AND, Palu_OR, Palu_XOR,
cerioncd304492005-02-08 19:40:24 +0000343 }
cerion5b2325f2005-12-23 00:55:09 +0000344 PPCAluOp;
cerioncd304492005-02-08 19:40:24 +0000345
sewardjb51f0f42005-07-18 11:38:02 +0000346extern
cerion5b2325f2005-12-23 00:55:09 +0000347HChar* showPPCAluOp ( PPCAluOp,
348 Bool /* is the 2nd operand an immediate? */);
cerionbb01b7c2005-12-16 13:40:18 +0000349
350
351/* --------- */
352typedef
353 enum {
354 Pshft_INVALID,
355 Pshft_SHL, Pshft_SHR, Pshft_SAR,
356 }
cerion5b2325f2005-12-23 00:55:09 +0000357 PPCShftOp;
cerionbb01b7c2005-12-16 13:40:18 +0000358
359extern
cerion5b2325f2005-12-23 00:55:09 +0000360HChar* showPPCShftOp ( PPCShftOp,
361 Bool /* is the 2nd operand an immediate? */,
362 Bool /* is this a 32bit or 64bit op? */ );
cerionab9132d2005-02-15 15:46:59 +0000363
364
cerion094d1392005-06-20 13:45:57 +0000365/* --------- */
366typedef
367 enum {
368 Pfp_INVALID,
369 /* Binary */
370 Pfp_ADD, Pfp_SUB, Pfp_MUL, Pfp_DIV,
371
372 /* Unary */
373 Pfp_SQRT, Pfp_ABS, Pfp_NEG, Pfp_MOV
374 }
cerion5b2325f2005-12-23 00:55:09 +0000375 PPCFpOp;
cerion094d1392005-06-20 13:45:57 +0000376
cerion5b2325f2005-12-23 00:55:09 +0000377extern HChar* showPPCFpOp ( PPCFpOp );
cerionbcf8c3e2005-02-04 16:17:07 +0000378
379
380/* --------- */
381typedef
382 enum {
cerionc3d8bdc2005-06-28 18:06:23 +0000383 Pav_INVALID,
384
385 /* Integer Unary */
386 Pav_MOV, /* Mov */
387 Pav_NOT, /* Bitwise */
388 Pav_UNPCKH8S, Pav_UNPCKH16S, /* Unpack */
389 Pav_UNPCKL8S, Pav_UNPCKL16S,
390 Pav_UNPCKHPIX, Pav_UNPCKLPIX,
391
392 /* Integer Binary */
cerion8ea0d3e2005-11-14 00:44:47 +0000393 Pav_AND, Pav_OR, Pav_XOR, /* Bitwise */
cerionf34ccc42005-09-16 08:55:50 +0000394 Pav_ADDU, Pav_QADDU, Pav_QADDS,
cerionf34ccc42005-09-16 08:55:50 +0000395 Pav_SUBU, Pav_QSUBU, Pav_QSUBS,
cerion6b6f59e2005-06-28 20:59:18 +0000396 Pav_OMULU, Pav_OMULS, Pav_EMULU, Pav_EMULS,
cerion6b6f59e2005-06-28 20:59:18 +0000397 Pav_AVGU, Pav_AVGS,
398 Pav_MAXU, Pav_MAXS,
399 Pav_MINU, Pav_MINS,
cerionc3d8bdc2005-06-28 18:06:23 +0000400
401 /* Compare (always affects CR field 6) */
cerion6b6f59e2005-06-28 20:59:18 +0000402 Pav_CMPEQU, Pav_CMPGTU, Pav_CMPGTS,
cerionc3d8bdc2005-06-28 18:06:23 +0000403
404 /* Shift */
cerion6b6f59e2005-06-28 20:59:18 +0000405 Pav_SHL, Pav_SHR, Pav_SAR, Pav_ROTL,
cerionc3d8bdc2005-06-28 18:06:23 +0000406
407 /* Pack */
cerionf34ccc42005-09-16 08:55:50 +0000408 Pav_PACKUU, Pav_QPACKUU, Pav_QPACKSU, Pav_QPACKSS,
cerion6b6f59e2005-06-28 20:59:18 +0000409 Pav_PACKPXL,
cerionc3d8bdc2005-06-28 18:06:23 +0000410
411 /* Merge */
cerion6b6f59e2005-06-28 20:59:18 +0000412 Pav_MRGHI, Pav_MRGLO,
cerionc3d8bdc2005-06-28 18:06:23 +0000413 }
cerion5b2325f2005-12-23 00:55:09 +0000414 PPCAvOp;
cerionc3d8bdc2005-06-28 18:06:23 +0000415
cerion5b2325f2005-12-23 00:55:09 +0000416extern HChar* showPPCAvOp ( PPCAvOp );
cerionc3d8bdc2005-06-28 18:06:23 +0000417
418
419/* --------- */
420typedef
421 enum {
cerion8ea0d3e2005-11-14 00:44:47 +0000422 Pavfp_INVALID,
423
424 /* Floating point binary */
425 Pavfp_ADDF, Pavfp_SUBF, Pavfp_MULF,
426 Pavfp_MAXF, Pavfp_MINF,
427 Pavfp_CMPEQF, Pavfp_CMPGTF, Pavfp_CMPGEF,
428
429 /* Floating point unary */
430 Pavfp_RCPF, Pavfp_RSQRTF,
ceriond963eb42005-11-16 18:02:58 +0000431 Pavfp_CVTU2F, Pavfp_CVTS2F, Pavfp_QCVTF2U, Pavfp_QCVTF2S,
432 Pavfp_ROUNDM, Pavfp_ROUNDP, Pavfp_ROUNDN, Pavfp_ROUNDZ,
cerion8ea0d3e2005-11-14 00:44:47 +0000433 }
cerion5b2325f2005-12-23 00:55:09 +0000434 PPCAvFpOp;
cerion8ea0d3e2005-11-14 00:44:47 +0000435
cerion5b2325f2005-12-23 00:55:09 +0000436extern HChar* showPPCAvFpOp ( PPCAvFpOp );
cerion8ea0d3e2005-11-14 00:44:47 +0000437
438
439/* --------- */
440typedef
441 enum {
cerionf0de28c2005-12-13 20:21:11 +0000442 Pin_LI, /* load word (32/64-bit) immediate (fake insn) */
cerionbb01b7c2005-12-16 13:40:18 +0000443 Pin_Alu, /* word add/sub/and/or/xor */
444 Pin_Shft, /* word shl/shr/sar */
cerion5b2325f2005-12-23 00:55:09 +0000445 Pin_AddSubC, /* add/sub with read/write carry */
cerionf0de28c2005-12-13 20:21:11 +0000446 Pin_Cmp, /* word compare */
447 Pin_Unary, /* not, neg, clz */
cerioned623db2005-06-20 12:42:04 +0000448 Pin_MulL, /* widening multiply */
449 Pin_Div, /* div */
450 Pin_Call, /* call to address in register */
451 Pin_Goto, /* conditional/unconditional jmp to dst */
cerionf0de28c2005-12-13 20:21:11 +0000452 Pin_CMov, /* conditional move */
cerion5b2325f2005-12-23 00:55:09 +0000453 Pin_Load, /* load a 8|16|32|64 bit value from mem */
454 Pin_Store, /* store a 8|16|32|64 bit value to mem */
455 Pin_Set, /* convert condition code to value 0 or 1 */
sewardjb51f0f42005-07-18 11:38:02 +0000456 Pin_MfCR, /* move from condition register to GPR */
457 Pin_MFence, /* mem fence */
cerionc3d8bdc2005-06-28 18:06:23 +0000458
cerion094d1392005-06-20 13:45:57 +0000459 Pin_FpUnary, /* FP unary op */
460 Pin_FpBinary, /* FP binary op */
461 Pin_FpLdSt, /* FP load/store */
462 Pin_FpF64toF32, /* FP round IEEE754 double to IEEE754 single */
463 Pin_FpF64toI32, /* FP round IEEE754 double to 32-bit integer */
cerion5b2325f2005-12-23 00:55:09 +0000464 Pin_FpF64toI64, /* FP round IEEE754 double to 64-bit integer */
cerion07b07a92005-12-22 14:32:35 +0000465 Pin_FpI64toF64, /* FP round IEEE754 64-bit integer to double */
cerion094d1392005-06-20 13:45:57 +0000466 Pin_FpCMov, /* FP floating point conditional move */
467 Pin_FpLdFPSCR, /* mtfsf */
468 Pin_FpCmp, /* FP compare, generating value into int reg */
cerionc3d8bdc2005-06-28 18:06:23 +0000469 Pin_RdWrLR, /* Read/Write Link Register */
470
471// Pin_AvConst, /* Generate restricted AV literal */
472 Pin_AvLdSt, /* AV load/store (kludging for AMode_IR) */
473 Pin_AvUnary, /* AV unary general reg=>reg */
cerion6b6f59e2005-06-28 20:59:18 +0000474
cerionc3d8bdc2005-06-28 18:06:23 +0000475 Pin_AvBinary, /* AV binary general reg,reg=>reg */
cerion6b6f59e2005-06-28 20:59:18 +0000476 Pin_AvBin8x16, /* AV binary, 8x4 */
477 Pin_AvBin16x8, /* AV binary, 16x4 */
478 Pin_AvBin32x4, /* AV binary, 32x4 */
479
480 Pin_AvBin32Fx4, /* AV FP binary, 32Fx4 */
cerion8ea0d3e2005-11-14 00:44:47 +0000481 Pin_AvUn32Fx4, /* AV FP unary, 32Fx4 */
cerionc3d8bdc2005-06-28 18:06:23 +0000482
483 Pin_AvPerm, /* AV permute (shuffle) */
484 Pin_AvSel, /* AV select */
485 Pin_AvShlDbl, /* AV shift-left double by imm */
486 Pin_AvSplat, /* One elem repeated throughout dst */
cerion6b6f59e2005-06-28 20:59:18 +0000487 Pin_AvLdVSCR, /* mtvscr */
488 Pin_AvCMov /* AV conditional move */
cerionbcf8c3e2005-02-04 16:17:07 +0000489 }
cerion5b2325f2005-12-23 00:55:09 +0000490 PPCInstrTag;
cerionbcf8c3e2005-02-04 16:17:07 +0000491
cerioncd304492005-02-08 19:40:24 +0000492/* Destinations are on the LEFT (first operand) */
cerionbcf8c3e2005-02-04 16:17:07 +0000493
494typedef
495 struct {
cerion5b2325f2005-12-23 00:55:09 +0000496 PPCInstrTag tag;
cerioncd304492005-02-08 19:40:24 +0000497 union {
cerion5b2325f2005-12-23 00:55:09 +0000498 /* Get a 32/64-bit literal into a register.
499 May turn into a number of real insns. */
sewardjb51f0f42005-07-18 11:38:02 +0000500 struct {
501 HReg dst;
cerionf0de28c2005-12-13 20:21:11 +0000502 ULong imm64;
503 } LI;
cerionbb01b7c2005-12-16 13:40:18 +0000504 /* Integer add/sub/and/or/xor. Limitations:
sewardjb51f0f42005-07-18 11:38:02 +0000505 - For add, the immediate, if it exists, is a signed 16.
506 - For sub, the immediate, if it exists, is a signed 16
507 which may not be -32768, since no such instruction
508 exists, and so we have to emit addi with +32768, but
509 that is not possible.
510 - For and/or/xor, the immediate, if it exists,
511 is an unsigned 16.
sewardjb51f0f42005-07-18 11:38:02 +0000512 */
cerioncd304492005-02-08 19:40:24 +0000513 struct {
cerion5b2325f2005-12-23 00:55:09 +0000514 PPCAluOp op;
515 HReg dst;
516 HReg srcL;
517 PPCRH* srcR;
cerionf0de28c2005-12-13 20:21:11 +0000518 } Alu;
cerionbb01b7c2005-12-16 13:40:18 +0000519 /* Integer shl/shr/sar.
520 Limitations: the immediate, if it exists,
521 is a signed 5-bit value between 1 and 31 inclusive.
522 */
523 struct {
cerion5b2325f2005-12-23 00:55:09 +0000524 PPCShftOp op;
525 Bool sz32; /* mode64 has both 32 and 64bit shft */
526 HReg dst;
527 HReg srcL;
528 PPCRH* srcR;
cerionbb01b7c2005-12-16 13:40:18 +0000529 } Shft;
cerion4a49b032005-11-08 16:23:07 +0000530 /* */
531 struct {
532 Bool isAdd; /* else sub */
533 Bool setC; /* else read carry */
534 HReg dst;
535 HReg srcL;
536 HReg srcR;
cerion5b2325f2005-12-23 00:55:09 +0000537 } AddSubC;
sewardjb51f0f42005-07-18 11:38:02 +0000538 /* If signed, the immediate, if it exists, is a signed 16,
539 else it is an unsigned 16. */
cerioncd304492005-02-08 19:40:24 +0000540 struct {
cerion5b2325f2005-12-23 00:55:09 +0000541 Bool syned;
542 Bool sz32; /* mode64 has both 32 and 64bit cmp */
543 UInt crfD;
544 HReg srcL;
545 PPCRH* srcR;
cerionf0de28c2005-12-13 20:21:11 +0000546 } Cmp;
cerion2c49e032005-02-09 17:29:49 +0000547 /* Not and Neg */
548 struct {
cerion5b2325f2005-12-23 00:55:09 +0000549 PPCUnaryOp op;
550 HReg dst;
551 HReg src;
552 } Unary;
cerion92f5dc72005-02-10 16:11:35 +0000553 struct {
sewardjb51f0f42005-07-18 11:38:02 +0000554 Bool syned; /* meaningless if hi32==False */
cerionf0de28c2005-12-13 20:21:11 +0000555 Bool hi; /* False=>low, True=>high */
cerionbb01b7c2005-12-16 13:40:18 +0000556 Bool sz32; /* mode64 has both 32 & 64bit mull */
sewardjb51f0f42005-07-18 11:38:02 +0000557 HReg dst;
558 HReg srcL;
559 HReg srcR;
cerion92f5dc72005-02-10 16:11:35 +0000560 } MulL;
cerion9e263e32005-03-03 17:21:51 +0000561 /* ppc32 div/divu instruction. */
cerionc0e707e2005-02-10 22:35:34 +0000562 struct {
cerion33aa6da2005-02-16 10:25:26 +0000563 Bool syned;
cerionbb01b7c2005-12-16 13:40:18 +0000564 Bool sz32; /* mode64 has both 32 & 64bit div */
cerion33aa6da2005-02-16 10:25:26 +0000565 HReg dst;
ceriona2f75882005-03-15 16:33:38 +0000566 HReg srcL;
567 HReg srcR;
cerionc0e707e2005-02-10 22:35:34 +0000568 } Div;
cerion2c49e032005-02-09 17:29:49 +0000569 /* Pseudo-insn. Call target (an absolute address), on given
sewardj6a64a9f2005-08-21 00:48:37 +0000570 condition (which could be Pct_ALWAYS). argiregs indicates
571 which of r3 .. r10 carries argument values for this call,
572 using a bit mask (1<<N is set if rN holds an arg, for N in
573 3 .. 10 inclusive). */
cerion2c49e032005-02-09 17:29:49 +0000574 struct {
cerion5b2325f2005-12-23 00:55:09 +0000575 PPCCondCode cond;
576 Addr64 target;
577 UInt argiregs;
cerion2c49e032005-02-09 17:29:49 +0000578 } Call;
579 /* Pseudo-insn. Goto dst, on given condition (which could be
sewardjb51f0f42005-07-18 11:38:02 +0000580 Pct_ALWAYS). */
cerion2c49e032005-02-09 17:29:49 +0000581 struct {
cerion5b2325f2005-12-23 00:55:09 +0000582 IRJumpKind jk;
583 PPCCondCode cond;
584 PPCRI* dst;
cerion2c49e032005-02-09 17:29:49 +0000585 } Goto;
cerionb536af92005-02-10 15:03:19 +0000586 /* Mov src to dst on the given condition, which may not
cerion9abfcbc2005-02-25 11:16:58 +0000587 be the bogus Pct_ALWAYS. */
cerionb536af92005-02-10 15:03:19 +0000588 struct {
cerion5b2325f2005-12-23 00:55:09 +0000589 PPCCondCode cond;
cerioncd304492005-02-08 19:40:24 +0000590 HReg dst;
cerion5b2325f2005-12-23 00:55:09 +0000591 PPCRI* src;
592 } CMov;
593 /* Sign/Zero extending loads. Dst size is host word size */
594 struct {
595 UChar sz; /* 1|2|4|8 */
596 Bool syned;
597 HReg dst;
598 PPCAMode* src;
cerion7cf8e4e2005-02-16 16:08:17 +0000599 } Load;
cerion5b2325f2005-12-23 00:55:09 +0000600 /* 64/32/16/8 bit stores */
cerioncd304492005-02-08 19:40:24 +0000601 struct {
cerion5b2325f2005-12-23 00:55:09 +0000602 UChar sz; /* 1|2|4|8 */
603 PPCAMode* dst;
604 HReg src;
cerioncd304492005-02-08 19:40:24 +0000605 } Store;
cerion5b2325f2005-12-23 00:55:09 +0000606 /* Convert a ppc condition code to value 0 or 1. */
cerionb536af92005-02-10 15:03:19 +0000607 struct {
cerion5b2325f2005-12-23 00:55:09 +0000608 PPCCondCode cond;
609 HReg dst;
610 } Set;
sewardjb51f0f42005-07-18 11:38:02 +0000611 /* Move the entire CR to a GPR */
612 struct {
613 HReg dst;
614 } MfCR;
cerion98411db2005-02-16 14:14:49 +0000615 /* Mem fence. In short, an insn which flushes all preceding
616 loads and stores as much as possible before continuing.
cerion5b2325f2005-12-23 00:55:09 +0000617 On PPC we emit a "sync". */
cerion92f5dc72005-02-10 16:11:35 +0000618 struct {
cerion92f5dc72005-02-10 16:11:35 +0000619 } MFence;
cerioncd304492005-02-08 19:40:24 +0000620
cerion5b2325f2005-12-23 00:55:09 +0000621 /* PPC Floating point */
cerion094d1392005-06-20 13:45:57 +0000622 struct {
cerion5b2325f2005-12-23 00:55:09 +0000623 PPCFpOp op;
624 HReg dst;
625 HReg src;
cerion094d1392005-06-20 13:45:57 +0000626 } FpUnary;
627 struct {
cerion5b2325f2005-12-23 00:55:09 +0000628 PPCFpOp op;
629 HReg dst;
630 HReg srcL;
631 HReg srcR;
cerion094d1392005-06-20 13:45:57 +0000632 } FpBinary;
633 struct {
cerion5b2325f2005-12-23 00:55:09 +0000634 Bool isLoad;
635 UChar sz; /* only 4 (IEEE single) or 8 (IEEE double) */
636 HReg reg;
637 PPCAMode* addr;
cerion094d1392005-06-20 13:45:57 +0000638 } FpLdSt;
cerion5b2325f2005-12-23 00:55:09 +0000639 /* By observing the current FPU rounding mode, round src->dst,
cerion094d1392005-06-20 13:45:57 +0000640 re-interpreting dst to an IEEE754 32-bit (float) type. */
641 struct {
642 HReg src;
643 HReg dst;
644 } FpF64toF32;
cerion5b2325f2005-12-23 00:55:09 +0000645 /* By observing the current FPU rounding mode, round src->dst,
cerion094d1392005-06-20 13:45:57 +0000646 re-interpreting dst to an 32-bit integer type. */
647 struct {
648 HReg src;
649 HReg dst;
650 } FpF64toI32;
cerion07b07a92005-12-22 14:32:35 +0000651 /* Ditto to 64-bit integer type. */
652 struct {
653 HReg src;
654 HReg dst;
655 } FpF64toI64;
cerion5b2325f2005-12-23 00:55:09 +0000656 /* By observing the current FPU rounding mode, reinterpret src
657 from a 64bit integer to double type, and round into dst. */
cerion07b07a92005-12-22 14:32:35 +0000658 struct {
659 HReg src;
660 HReg dst;
661 } FpI64toF64;
cerion094d1392005-06-20 13:45:57 +0000662 /* Mov src to dst on the given condition, which may not
663 be the bogus Xcc_ALWAYS. */
664 struct {
cerion5b2325f2005-12-23 00:55:09 +0000665 PPCCondCode cond;
666 HReg dst;
667 HReg src;
cerion094d1392005-06-20 13:45:57 +0000668 } FpCMov;
669 /* Load FP Status & Control Register */
670 struct {
671 HReg src;
672 } FpLdFPSCR;
sewardjb51f0f42005-07-18 11:38:02 +0000673 /* Do a compare, generating result into an int register. */
cerion094d1392005-06-20 13:45:57 +0000674 struct {
675 UChar crfD;
676 HReg dst;
677 HReg srcL;
678 HReg srcR;
679 } FpCmp;
cerioncd304492005-02-08 19:40:24 +0000680
cerion7f000af2005-02-22 20:36:49 +0000681 /* Read/Write Link Register */
682 struct {
683 Bool wrLR;
684 HReg gpr;
685 } RdWrLR;
cerionc3d8bdc2005-06-28 18:06:23 +0000686
687 /* Simplistic AltiVec */
688 struct {
cerion5b2325f2005-12-23 00:55:09 +0000689 Bool isLoad;
690 UChar sz; /* 8|16|32|128 */
691 HReg reg;
692 PPCAMode* addr;
cerionc3d8bdc2005-06-28 18:06:23 +0000693 } AvLdSt;
694 struct {
cerion5b2325f2005-12-23 00:55:09 +0000695 PPCAvOp op;
696 HReg dst;
697 HReg src;
cerionc3d8bdc2005-06-28 18:06:23 +0000698 } AvUnary;
699 struct {
cerion5b2325f2005-12-23 00:55:09 +0000700 PPCAvOp op;
701 HReg dst;
702 HReg srcL;
703 HReg srcR;
cerionc3d8bdc2005-06-28 18:06:23 +0000704 } AvBinary;
cerion6b6f59e2005-06-28 20:59:18 +0000705 struct {
cerion5b2325f2005-12-23 00:55:09 +0000706 PPCAvOp op;
707 HReg dst;
708 HReg srcL;
709 HReg srcR;
cerion6b6f59e2005-06-28 20:59:18 +0000710 } AvBin8x16;
711 struct {
cerion5b2325f2005-12-23 00:55:09 +0000712 PPCAvOp op;
713 HReg dst;
714 HReg srcL;
715 HReg srcR;
cerion6b6f59e2005-06-28 20:59:18 +0000716 } AvBin16x8;
717 struct {
cerion5b2325f2005-12-23 00:55:09 +0000718 PPCAvOp op;
719 HReg dst;
720 HReg srcL;
721 HReg srcR;
cerion6b6f59e2005-06-28 20:59:18 +0000722 } AvBin32x4;
723 struct {
cerion5b2325f2005-12-23 00:55:09 +0000724 PPCAvFpOp op;
cerion6b6f59e2005-06-28 20:59:18 +0000725 HReg dst;
726 HReg srcL;
727 HReg srcR;
728 } AvBin32Fx4;
cerion8ea0d3e2005-11-14 00:44:47 +0000729 struct {
cerion5b2325f2005-12-23 00:55:09 +0000730 PPCAvFpOp op;
cerion8ea0d3e2005-11-14 00:44:47 +0000731 HReg dst;
732 HReg src;
733 } AvUn32Fx4;
cerionc3d8bdc2005-06-28 18:06:23 +0000734 /* Perm,Sel,SlDbl,Splat are all weird AV permutations */
735 struct {
cerionc3d8bdc2005-06-28 18:06:23 +0000736 HReg dst;
737 HReg srcL;
738 HReg srcR;
cerion92d9d872005-09-15 21:58:50 +0000739 HReg ctl;
cerionc3d8bdc2005-06-28 18:06:23 +0000740 } AvPerm;
741 struct {
cerionc3d8bdc2005-06-28 18:06:23 +0000742 HReg dst;
743 HReg srcL;
744 HReg srcR;
cerion92d9d872005-09-15 21:58:50 +0000745 HReg ctl;
cerionc3d8bdc2005-06-28 18:06:23 +0000746 } AvSel;
747 struct {
748 UChar shift;
749 HReg dst;
750 HReg srcL;
751 HReg srcR;
752 } AvShlDbl;
753 struct {
754 UChar sz; /* 8,16,32 */
755 HReg dst;
cerion5b2325f2005-12-23 00:55:09 +0000756 PPCVI5s* src;
cerionc3d8bdc2005-06-28 18:06:23 +0000757 } AvSplat;
cerion6b6f59e2005-06-28 20:59:18 +0000758 /* Mov src to dst on the given condition, which may not
759 be the bogus Xcc_ALWAYS. */
760 struct {
cerion5b2325f2005-12-23 00:55:09 +0000761 PPCCondCode cond;
762 HReg dst;
763 HReg src;
cerion6b6f59e2005-06-28 20:59:18 +0000764 } AvCMov;
sewardjb51f0f42005-07-18 11:38:02 +0000765 /* Load AltiVec Status & Control Register */
cerionc3d8bdc2005-06-28 18:06:23 +0000766 struct {
767 HReg src;
768 } AvLdVSCR;
cerioncd304492005-02-08 19:40:24 +0000769 } Pin;
cerionbcf8c3e2005-02-04 16:17:07 +0000770 }
cerion5b2325f2005-12-23 00:55:09 +0000771 PPCInstr;
cerionbcf8c3e2005-02-04 16:17:07 +0000772
cerioncd304492005-02-08 19:40:24 +0000773
cerion5b2325f2005-12-23 00:55:09 +0000774extern PPCInstr* PPCInstr_LI ( HReg, ULong, Bool );
775extern PPCInstr* PPCInstr_Alu ( PPCAluOp, HReg, HReg, PPCRH* );
776extern PPCInstr* PPCInstr_Shft ( PPCShftOp, Bool sz32, HReg, HReg, PPCRH* );
777extern PPCInstr* PPCInstr_AddSubC ( Bool, Bool, HReg, HReg, HReg );
778extern PPCInstr* PPCInstr_Cmp ( Bool, Bool, UInt, HReg, PPCRH* );
779extern PPCInstr* PPCInstr_Unary ( PPCUnaryOp op, HReg dst, HReg src );
780extern PPCInstr* PPCInstr_MulL ( Bool syned, Bool hi32, Bool sz32, HReg, HReg, HReg );
781extern PPCInstr* PPCInstr_Div ( Bool syned, Bool sz32, HReg dst, HReg srcL, HReg srcR );
782extern PPCInstr* PPCInstr_Call ( PPCCondCode, Addr64, UInt );
783extern PPCInstr* PPCInstr_Goto ( IRJumpKind, PPCCondCode cond, PPCRI* dst );
784extern PPCInstr* PPCInstr_CMov ( PPCCondCode, HReg dst, PPCRI* src );
785extern PPCInstr* PPCInstr_Load ( UChar sz, Bool syned,
786 HReg dst, PPCAMode* src, Bool mode64 );
787extern PPCInstr* PPCInstr_Store ( UChar sz, PPCAMode* dst,
788 HReg src, Bool mode64 );
789extern PPCInstr* PPCInstr_Set ( PPCCondCode cond, HReg dst );
790extern PPCInstr* PPCInstr_MfCR ( HReg dst );
791extern PPCInstr* PPCInstr_MFence ( void );
cerioned623db2005-06-20 12:42:04 +0000792
cerion5b2325f2005-12-23 00:55:09 +0000793extern PPCInstr* PPCInstr_FpUnary ( PPCFpOp op, HReg dst, HReg src );
794extern PPCInstr* PPCInstr_FpBinary ( PPCFpOp op, HReg dst, HReg srcL, HReg srcR );
795extern PPCInstr* PPCInstr_FpLdSt ( Bool isLoad, UChar sz, HReg, PPCAMode* );
796extern PPCInstr* PPCInstr_FpF64toF32 ( HReg dst, HReg src );
797extern PPCInstr* PPCInstr_FpF64toI32 ( HReg dst, HReg src );
798extern PPCInstr* PPCInstr_FpF64toI64 ( HReg dst, HReg src );
799extern PPCInstr* PPCInstr_FpI64toF64 ( HReg dst, HReg src );
800extern PPCInstr* PPCInstr_FpCMov ( PPCCondCode, HReg dst, HReg src );
801extern PPCInstr* PPCInstr_FpLdFPSCR ( HReg src );
802extern PPCInstr* PPCInstr_FpCmp ( HReg dst, HReg srcL, HReg srcR );
cerionbcf8c3e2005-02-04 16:17:07 +0000803
cerion5b2325f2005-12-23 00:55:09 +0000804extern PPCInstr* PPCInstr_RdWrLR ( Bool wrLR, HReg gpr );
cerion7f000af2005-02-22 20:36:49 +0000805
cerion5b2325f2005-12-23 00:55:09 +0000806extern PPCInstr* PPCInstr_AvLdSt ( Bool isLoad, UChar sz, HReg, PPCAMode* );
807extern PPCInstr* PPCInstr_AvUnary ( PPCAvOp op, HReg dst, HReg src );
808extern PPCInstr* PPCInstr_AvBinary ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
809extern PPCInstr* PPCInstr_AvBin8x16 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
810extern PPCInstr* PPCInstr_AvBin16x8 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
811extern PPCInstr* PPCInstr_AvBin32x4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
812extern PPCInstr* PPCInstr_AvBin32Fx4 ( PPCAvOp op, HReg dst, HReg srcL, HReg srcR );
813extern PPCInstr* PPCInstr_AvUn32Fx4 ( PPCAvOp op, HReg dst, HReg src );
814extern PPCInstr* PPCInstr_AvPerm ( HReg dst, HReg srcL, HReg srcR, HReg ctl );
815extern PPCInstr* PPCInstr_AvSel ( HReg ctl, HReg dst, HReg srcL, HReg srcR );
816extern PPCInstr* PPCInstr_AvShlDbl ( UChar shift, HReg dst, HReg srcL, HReg srcR );
817extern PPCInstr* PPCInstr_AvSplat ( UChar sz, HReg dst, PPCVI5s* src );
818extern PPCInstr* PPCInstr_AvCMov ( PPCCondCode, HReg dst, HReg src );
819extern PPCInstr* PPCInstr_AvLdVSCR ( HReg src );
cerionbcf8c3e2005-02-04 16:17:07 +0000820
cerion5b2325f2005-12-23 00:55:09 +0000821extern void ppPPCInstr ( PPCInstr*, Bool mode64 );
cerionbcf8c3e2005-02-04 16:17:07 +0000822
823/* Some functions that insulate the register allocator from details
824 of the underlying instruction set. */
cerion5b2325f2005-12-23 00:55:09 +0000825extern void getRegUsage_PPCInstr ( HRegUsage*, PPCInstr*, Bool mode64 );
826extern void mapRegs_PPCInstr ( HRegRemap*, PPCInstr* , Bool mode64);
827extern Bool isMove_PPCInstr ( PPCInstr*, HReg*, HReg* );
828extern Int emit_PPCInstr ( UChar* buf, Int nbuf, PPCInstr*,
829 Bool mode64, void* dispatch );
830extern PPCInstr* genSpill_PPC ( HReg rreg, UShort offsetB, Bool mode64 );
831extern PPCInstr* genReload_PPC ( HReg rreg, UShort offsetB, Bool mode64 );
832extern void getAllocableRegs_PPC ( Int*, HReg**, Bool mode64 );
833extern HInstrArray* iselBB_PPC ( IRBB*, VexArchInfo* );
cerionbcf8c3e2005-02-04 16:17:07 +0000834
cerion5b2325f2005-12-23 00:55:09 +0000835#endif /* ndef __LIBVEX_HOST_PPC_HDEFS_H */
cerionbcf8c3e2005-02-04 16:17:07 +0000836
837/*---------------------------------------------------------------*/
ceriond0eae2d2005-12-23 11:43:01 +0000838/*--- end host-ppc/hdefs.h ---*/
cerionbcf8c3e2005-02-04 16:17:07 +0000839/*---------------------------------------------------------------*/