b304bad7cebbc34326bea54c1f8501c452f30f54
[platform/upstream/v8.git] / src / ppc / constants-ppc.h
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_PPC_CONSTANTS_PPC_H_
6 #define V8_PPC_CONSTANTS_PPC_H_
7
8 #include <stdint.h>
9
10 #include "src/base/logging.h"
11 #include "src/base/macros.h"
12 #include "src/globals.h"
13
14 namespace v8 {
15 namespace internal {
16
17 // Number of registers
18 const int kNumRegisters = 32;
19
20 // FP support.
21 const int kNumFPDoubleRegisters = 32;
22 const int kNumFPRegisters = kNumFPDoubleRegisters;
23
24 const int kNoRegister = -1;
25
26 // Used in embedded constant pool builder - max reach in bits for
27 // various load instructions (one less due to unsigned)
28 const int kLoadPtrMaxReachBits = 15;
29 const int kLoadDoubleMaxReachBits = 15;
30
31 // sign-extend the least significant 16-bits of value <imm>
32 #define SIGN_EXT_IMM16(imm) ((static_cast<int>(imm) << 16) >> 16)
33
34 // sign-extend the least significant 26-bits of value <imm>
35 #define SIGN_EXT_IMM26(imm) ((static_cast<int>(imm) << 6) >> 6)
36
37 // -----------------------------------------------------------------------------
38 // Conditions.
39
40 // Defines constants and accessor classes to assemble, disassemble and
41 // simulate PPC instructions.
42 //
43 // Section references in the code refer to the "PowerPC Microprocessor
44 // Family: The Programmer.s Reference Guide" from 10/95
45 // https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF778525699600741775/$file/prg.pdf
46 //
47
48 // Constants for specific fields are defined in their respective named enums.
49 // General constants are in an anonymous enum in class Instr.
50 enum Condition {
51   kNoCondition = -1,
52   eq = 0,         // Equal.
53   ne = 1,         // Not equal.
54   ge = 2,         // Greater or equal.
55   lt = 3,         // Less than.
56   gt = 4,         // Greater than.
57   le = 5,         // Less then or equal
58   unordered = 6,  // Floating-point unordered
59   ordered = 7,
60   overflow = 8,  // Summary overflow
61   nooverflow = 9,
62   al = 10  // Always.
63 };
64
65
66 inline Condition NegateCondition(Condition cond) {
67   DCHECK(cond != al);
68   return static_cast<Condition>(cond ^ ne);
69 }
70
71
72 // Commute a condition such that {a cond b == b cond' a}.
73 inline Condition CommuteCondition(Condition cond) {
74   switch (cond) {
75     case lt:
76       return gt;
77     case gt:
78       return lt;
79     case ge:
80       return le;
81     case le:
82       return ge;
83     default:
84       return cond;
85   }
86 }
87
88 // -----------------------------------------------------------------------------
89 // Instructions encoding.
90
91 // Instr is merely used by the Assembler to distinguish 32bit integers
92 // representing instructions from usual 32 bit values.
93 // Instruction objects are pointers to 32bit values, and provide methods to
94 // access the various ISA fields.
95 typedef int32_t Instr;
96
97 // Opcodes as defined in section 4.2 table 34 (32bit PowerPC)
98 enum Opcode {
99   TWI = 3 << 26,       // Trap Word Immediate
100   MULLI = 7 << 26,     // Multiply Low Immediate
101   SUBFIC = 8 << 26,    // Subtract from Immediate Carrying
102   CMPLI = 10 << 26,    // Compare Logical Immediate
103   CMPI = 11 << 26,     // Compare Immediate
104   ADDIC = 12 << 26,    // Add Immediate Carrying
105   ADDICx = 13 << 26,   // Add Immediate Carrying and Record
106   ADDI = 14 << 26,     // Add Immediate
107   ADDIS = 15 << 26,    // Add Immediate Shifted
108   BCX = 16 << 26,      // Branch Conditional
109   SC = 17 << 26,       // System Call
110   BX = 18 << 26,       // Branch
111   EXT1 = 19 << 26,     // Extended code set 1
112   RLWIMIX = 20 << 26,  // Rotate Left Word Immediate then Mask Insert
113   RLWINMX = 21 << 26,  // Rotate Left Word Immediate then AND with Mask
114   RLWNMX = 23 << 26,   // Rotate Left Word then AND with Mask
115   ORI = 24 << 26,      // OR Immediate
116   ORIS = 25 << 26,     // OR Immediate Shifted
117   XORI = 26 << 26,     // XOR Immediate
118   XORIS = 27 << 26,    // XOR Immediate Shifted
119   ANDIx = 28 << 26,    // AND Immediate
120   ANDISx = 29 << 26,   // AND Immediate Shifted
121   EXT5 = 30 << 26,     // Extended code set 5 - 64bit only
122   EXT2 = 31 << 26,     // Extended code set 2
123   LWZ = 32 << 26,      // Load Word and Zero
124   LWZU = 33 << 26,     // Load Word with Zero Update
125   LBZ = 34 << 26,      // Load Byte and Zero
126   LBZU = 35 << 26,     // Load Byte and Zero with Update
127   STW = 36 << 26,      // Store
128   STWU = 37 << 26,     // Store Word with Update
129   STB = 38 << 26,      // Store Byte
130   STBU = 39 << 26,     // Store Byte with Update
131   LHZ = 40 << 26,      // Load Half and Zero
132   LHZU = 41 << 26,     // Load Half and Zero with Update
133   LHA = 42 << 26,      // Load Half Algebraic
134   LHAU = 43 << 26,     // Load Half Algebraic with Update
135   STH = 44 << 26,      // Store Half
136   STHU = 45 << 26,     // Store Half with Update
137   LMW = 46 << 26,      // Load Multiple Word
138   STMW = 47 << 26,     // Store Multiple Word
139   LFS = 48 << 26,      // Load Floating-Point Single
140   LFSU = 49 << 26,     // Load Floating-Point Single with Update
141   LFD = 50 << 26,      // Load Floating-Point Double
142   LFDU = 51 << 26,     // Load Floating-Point Double with Update
143   STFS = 52 << 26,     // Store Floating-Point Single
144   STFSU = 53 << 26,    // Store Floating-Point Single with Update
145   STFD = 54 << 26,     // Store Floating-Point Double
146   STFDU = 55 << 26,    // Store Floating-Point Double with Update
147   LD = 58 << 26,       // Load Double Word
148   EXT3 = 59 << 26,     // Extended code set 3
149   STD = 62 << 26,      // Store Double Word (optionally with Update)
150   EXT4 = 63 << 26      // Extended code set 4
151 };
152
153 // Bits 10-1
154 enum OpcodeExt1 {
155   MCRF = 0 << 1,      // Move Condition Register Field
156   BCLRX = 16 << 1,    // Branch Conditional Link Register
157   CRNOR = 33 << 1,    // Condition Register NOR)
158   RFI = 50 << 1,      // Return from Interrupt
159   CRANDC = 129 << 1,  // Condition Register AND with Complement
160   ISYNC = 150 << 1,   // Instruction Synchronize
161   CRXOR = 193 << 1,   // Condition Register XOR
162   CRNAND = 225 << 1,  // Condition Register NAND
163   CRAND = 257 << 1,   // Condition Register AND
164   CREQV = 289 << 1,   // Condition Register Equivalent
165   CRORC = 417 << 1,   // Condition Register OR with Complement
166   CROR = 449 << 1,    // Condition Register OR
167   BCCTRX = 528 << 1   // Branch Conditional to Count Register
168 };
169
170 // Bits 9-1 or 10-1
171 enum OpcodeExt2 {
172   CMP = 0 << 1,
173   TW = 4 << 1,
174   SUBFCX = 8 << 1,
175   ADDCX = 10 << 1,
176   MULHWUX = 11 << 1,
177   ISEL = 15 << 1,
178   MFCR = 19 << 1,
179   LWARX = 20 << 1,
180   LDX = 21 << 1,
181   LWZX = 23 << 1,  // load word zero w/ x-form
182   SLWX = 24 << 1,
183   CNTLZWX = 26 << 1,
184   SLDX = 27 << 1,
185   ANDX = 28 << 1,
186   CMPL = 32 << 1,
187   SUBFX = 40 << 1,
188   MFVSRD = 51 << 1,  // Move From VSR Doubleword
189   LDUX = 53 << 1,
190   DCBST = 54 << 1,
191   LWZUX = 55 << 1,  // load word zero w/ update x-form
192   CNTLZDX = 58 << 1,
193   ANDCX = 60 << 1,
194   MULHWX = 75 << 1,
195   DCBF = 86 << 1,
196   LBZX = 87 << 1,  // load byte zero w/ x-form
197   NEGX = 104 << 1,
198   MFVSRWZ = 115 << 1,  // Move From VSR Word And Zero
199   LBZUX = 119 << 1,    // load byte zero w/ update x-form
200   NORX = 124 << 1,
201   SUBFEX = 136 << 1,
202   ADDEX = 138 << 1,
203   STDX = 149 << 1,
204   STWX = 151 << 1,    // store word w/ x-form
205   MTVSRD = 179 << 1,  // Move To VSR Doubleword
206   STDUX = 181 << 1,
207   STWUX = 183 << 1,    // store word w/ update x-form
208                        /*
209       MTCRF
210       MTMSR
211       STWCXx
212       SUBFZEX
213     */
214   ADDZEX = 202 << 1,   // Add to Zero Extended
215                        /*
216      MTSR
217    */
218   MTVSRWA = 211 << 1,  // Move To VSR Word Algebraic
219   STBX = 215 << 1,     // store byte w/ x-form
220   MULLD = 233 << 1,    // Multiply Low Double Word
221   MULLW = 235 << 1,    // Multiply Low Word
222   MTVSRWZ = 243 << 1,  // Move To VSR Word And Zero
223   STBUX = 247 << 1,    // store byte w/ update x-form
224   ADDX = 266 << 1,     // Add
225   LHZX = 279 << 1,     // load half-word zero w/ x-form
226   LHZUX = 311 << 1,    // load half-word zero w/ update x-form
227   LWAX = 341 << 1,     // load word algebraic w/ x-form
228   LHAX = 343 << 1,     // load half-word algebraic w/ x-form
229   LHAUX = 375 << 1,    // load half-word algebraic w/ update x-form
230   XORX = 316 << 1,     // Exclusive OR
231   MFSPR = 339 << 1,    // Move from Special-Purpose-Register
232   STHX = 407 << 1,     // store half-word w/ x-form
233   ORC = 412 << 1,      // Or with Complement
234   STHUX = 439 << 1,    // store half-word w/ update x-form
235   ORX = 444 << 1,      // Or
236   DIVDU = 457 << 1,    // Divide Double Word Unsigned
237   DIVWU = 459 << 1,    // Divide Word Unsigned
238   MTSPR = 467 << 1,    // Move to Special-Purpose-Register
239   DIVD = 489 << 1,     // Divide Double Word
240   DIVW = 491 << 1,     // Divide Word
241
242   // Below represent bits 10-1  (any value >= 512)
243   LFSX = 535 << 1,    // load float-single w/ x-form
244   SRWX = 536 << 1,    // Shift Right Word
245   SRDX = 539 << 1,    // Shift Right Double Word
246   LFSUX = 567 << 1,   // load float-single w/ update x-form
247   SYNC = 598 << 1,    // Synchronize
248   LFDX = 599 << 1,    // load float-double w/ x-form
249   LFDUX = 631 << 1,   // load float-double w/ update X-form
250   STFSX = 663 << 1,   // store float-single w/ x-form
251   STFSUX = 695 << 1,  // store float-single w/ update x-form
252   STFDX = 727 << 1,   // store float-double w/ x-form
253   STFDUX = 759 << 1,  // store float-double w/ update x-form
254   SRAW = 792 << 1,    // Shift Right Algebraic Word
255   SRAD = 794 << 1,    // Shift Right Algebraic Double Word
256   SRAWIX = 824 << 1,  // Shift Right Algebraic Word Immediate
257   SRADIX = 413 << 2,  // Shift Right Algebraic Double Word Immediate
258   EXTSH = 922 << 1,   // Extend Sign Halfword
259   EXTSB = 954 << 1,   // Extend Sign Byte
260   ICBI = 982 << 1,    // Instruction Cache Block Invalidate
261   EXTSW = 986 << 1    // Extend Sign Word
262 };
263
264 // Some use Bits 10-1 and other only 5-1 for the opcode
265 enum OpcodeExt4 {
266   // Bits 5-1
267   FDIV = 18 << 1,   // Floating Divide
268   FSUB = 20 << 1,   // Floating Subtract
269   FADD = 21 << 1,   // Floating Add
270   FSQRT = 22 << 1,  // Floating Square Root
271   FSEL = 23 << 1,   // Floating Select
272   FMUL = 25 << 1,   // Floating Multiply
273   FMSUB = 28 << 1,  // Floating Multiply-Subtract
274   FMADD = 29 << 1,  // Floating Multiply-Add
275
276   // Bits 10-1
277   FCMPU = 0 << 1,     // Floating Compare Unordered
278   FRSP = 12 << 1,     // Floating-Point Rounding
279   FCTIW = 14 << 1,    // Floating Convert to Integer Word X-form
280   FCTIWZ = 15 << 1,   // Floating Convert to Integer Word with Round to Zero
281   FNEG = 40 << 1,     // Floating Negate
282   MCRFS = 64 << 1,    // Move to Condition Register from FPSCR
283   FMR = 72 << 1,      // Floating Move Register
284   MTFSFI = 134 << 1,  // Move to FPSCR Field Immediate
285   FABS = 264 << 1,    // Floating Absolute Value
286   FRIN = 392 << 1,    // Floating Round to Integer Nearest
287   FRIZ = 424 << 1,    // Floating Round to Integer Toward Zero
288   FRIP = 456 << 1,    // Floating Round to Integer Plus
289   FRIM = 488 << 1,    // Floating Round to Integer Minus
290   MFFS = 583 << 1,    // move from FPSCR x-form
291   MTFSF = 711 << 1,   // move to FPSCR fields XFL-form
292   FCFID = 846 << 1,   // Floating convert from integer doubleword
293   FCTID = 814 << 1,   // Floating convert from integer doubleword
294   FCTIDZ = 815 << 1   // Floating convert from integer doubleword
295 };
296
297 enum OpcodeExt5 {
298   // Bits 4-2
299   RLDICL = 0 << 1,  // Rotate Left Double Word Immediate then Clear Left
300   RLDICR = 2 << 1,  // Rotate Left Double Word Immediate then Clear Right
301   RLDIC = 4 << 1,   // Rotate Left Double Word Immediate then Clear
302   RLDIMI = 6 << 1,  // Rotate Left Double Word Immediate then Mask Insert
303   // Bits 4-1
304   RLDCL = 8 << 1,  // Rotate Left Double Word then Clear Left
305   RLDCR = 9 << 1   // Rotate Left Double Word then Clear Right
306 };
307
308 // Instruction encoding bits and masks.
309 enum {
310   // Instruction encoding bit
311   B1 = 1 << 1,
312   B4 = 1 << 4,
313   B5 = 1 << 5,
314   B7 = 1 << 7,
315   B8 = 1 << 8,
316   B9 = 1 << 9,
317   B12 = 1 << 12,
318   B18 = 1 << 18,
319   B19 = 1 << 19,
320   B20 = 1 << 20,
321   B22 = 1 << 22,
322   B23 = 1 << 23,
323   B24 = 1 << 24,
324   B25 = 1 << 25,
325   B26 = 1 << 26,
326   B27 = 1 << 27,
327   B28 = 1 << 28,
328   B6 = 1 << 6,
329   B10 = 1 << 10,
330   B11 = 1 << 11,
331   B16 = 1 << 16,
332   B17 = 1 << 17,
333   B21 = 1 << 21,
334
335   // Instruction bit masks
336   kCondMask = 0x1F << 21,
337   kOff12Mask = (1 << 12) - 1,
338   kImm24Mask = (1 << 24) - 1,
339   kOff16Mask = (1 << 16) - 1,
340   kImm16Mask = (1 << 16) - 1,
341   kImm26Mask = (1 << 26) - 1,
342   kBOfieldMask = 0x1f << 21,
343   kOpcodeMask = 0x3f << 26,
344   kExt1OpcodeMask = 0x3ff << 1,
345   kExt2OpcodeMask = 0x3ff << 1,
346   kExt2OpcodeVariant2Mask = 0x1ff << 2,
347   kExt5OpcodeMask = 0x3 << 2,
348   kBOMask = 0x1f << 21,
349   kBIMask = 0x1F << 16,
350   kBDMask = 0x14 << 2,
351   kAAMask = 0x01 << 1,
352   kLKMask = 0x01,
353   kRCMask = 0x01,
354   kTOMask = 0x1f << 21
355 };
356
357 // -----------------------------------------------------------------------------
358 // Addressing modes and instruction variants.
359
360 // Overflow Exception
361 enum OEBit {
362   SetOE = 1 << 10,   // Set overflow exception
363   LeaveOE = 0 << 10  // No overflow exception
364 };
365
366 // Record bit
367 enum RCBit {   // Bit 0
368   SetRC = 1,   // LT,GT,EQ,SO
369   LeaveRC = 0  // None
370 };
371
372 // Link bit
373 enum LKBit {   // Bit 0
374   SetLK = 1,   // Load effective address of next instruction
375   LeaveLK = 0  // No action
376 };
377
378 enum BOfield {        // Bits 25-21
379   DCBNZF = 0 << 21,   // Decrement CTR; branch if CTR != 0 and condition false
380   DCBEZF = 2 << 21,   // Decrement CTR; branch if CTR == 0 and condition false
381   BF = 4 << 21,       // Branch if condition false
382   DCBNZT = 8 << 21,   // Decrement CTR; branch if CTR != 0 and condition true
383   DCBEZT = 10 << 21,  // Decrement CTR; branch if CTR == 0 and condition true
384   BT = 12 << 21,      // Branch if condition true
385   DCBNZ = 16 << 21,   // Decrement CTR; branch if CTR != 0
386   DCBEZ = 18 << 21,   // Decrement CTR; branch if CTR == 0
387   BA = 20 << 21       // Branch always
388 };
389
390 #if V8_OS_AIX
391 #undef CR_LT
392 #undef CR_GT
393 #undef CR_EQ
394 #undef CR_SO
395 #endif
396
397 enum CRBit { CR_LT = 0, CR_GT = 1, CR_EQ = 2, CR_SO = 3, CR_FU = 3 };
398
399 #define CRWIDTH 4
400
401 // -----------------------------------------------------------------------------
402 // Supervisor Call (svc) specific support.
403
404 // Special Software Interrupt codes when used in the presence of the PPC
405 // simulator.
406 // svc (formerly swi) provides a 24bit immediate value. Use bits 22:0 for
407 // standard SoftwareInterrupCode. Bit 23 is reserved for the stop feature.
408 enum SoftwareInterruptCodes {
409   // transition to C code
410   kCallRtRedirected = 0x10,
411   // break point
412   kBreakpoint = 0x821008,  // bits23-0 of 0x7d821008 = twge r2, r2
413   // stop
414   kStopCode = 1 << 23
415 };
416 const uint32_t kStopCodeMask = kStopCode - 1;
417 const uint32_t kMaxStopCode = kStopCode - 1;
418 const int32_t kDefaultStopCode = -1;
419
420 // FP rounding modes.
421 enum FPRoundingMode {
422   RN = 0,  // Round to Nearest.
423   RZ = 1,  // Round towards zero.
424   RP = 2,  // Round towards Plus Infinity.
425   RM = 3,  // Round towards Minus Infinity.
426
427   // Aliases.
428   kRoundToNearest = RN,
429   kRoundToZero = RZ,
430   kRoundToPlusInf = RP,
431   kRoundToMinusInf = RM
432 };
433
434 const uint32_t kFPRoundingModeMask = 3;
435
436 enum CheckForInexactConversion {
437   kCheckForInexactConversion,
438   kDontCheckForInexactConversion
439 };
440
441 // -----------------------------------------------------------------------------
442 // Specific instructions, constants, and masks.
443 // These constants are declared in assembler-arm.cc, as they use named registers
444 // and other constants.
445
446
447 // add(sp, sp, 4) instruction (aka Pop())
448 extern const Instr kPopInstruction;
449
450 // str(r, MemOperand(sp, 4, NegPreIndex), al) instruction (aka push(r))
451 // register r is not encoded.
452 extern const Instr kPushRegPattern;
453
454 // ldr(r, MemOperand(sp, 4, PostIndex), al) instruction (aka pop(r))
455 // register r is not encoded.
456 extern const Instr kPopRegPattern;
457
458 // use TWI to indicate redirection call for simulation mode
459 const Instr rtCallRedirInstr = TWI;
460
461 // -----------------------------------------------------------------------------
462 // Instruction abstraction.
463
464 // The class Instruction enables access to individual fields defined in the PPC
465 // architecture instruction set encoding.
466 // Note that the Assembler uses typedef int32_t Instr.
467 //
468 // Example: Test whether the instruction at ptr does set the condition code
469 // bits.
470 //
471 // bool InstructionSetsConditionCodes(byte* ptr) {
472 //   Instruction* instr = Instruction::At(ptr);
473 //   int type = instr->TypeValue();
474 //   return ((type == 0) || (type == 1)) && instr->HasS();
475 // }
476 //
477 class Instruction {
478  public:
479   enum { kInstrSize = 4, kInstrSizeLog2 = 2, kPCReadOffset = 8 };
480
481 // Helper macro to define static accessors.
482 // We use the cast to char* trick to bypass the strict anti-aliasing rules.
483 #define DECLARE_STATIC_TYPED_ACCESSOR(return_type, Name) \
484   static inline return_type Name(Instr instr) {          \
485     char* temp = reinterpret_cast<char*>(&instr);        \
486     return reinterpret_cast<Instruction*>(temp)->Name(); \
487   }
488
489 #define DECLARE_STATIC_ACCESSOR(Name) DECLARE_STATIC_TYPED_ACCESSOR(int, Name)
490
491   // Get the raw instruction bits.
492   inline Instr InstructionBits() const {
493     return *reinterpret_cast<const Instr*>(this);
494   }
495
496   // Set the raw instruction bits to value.
497   inline void SetInstructionBits(Instr value) {
498     *reinterpret_cast<Instr*>(this) = value;
499   }
500
501   // Read one particular bit out of the instruction bits.
502   inline int Bit(int nr) const { return (InstructionBits() >> nr) & 1; }
503
504   // Read a bit field's value out of the instruction bits.
505   inline int Bits(int hi, int lo) const {
506     return (InstructionBits() >> lo) & ((2 << (hi - lo)) - 1);
507   }
508
509   // Read a bit field out of the instruction bits.
510   inline int BitField(int hi, int lo) const {
511     return InstructionBits() & (((2 << (hi - lo)) - 1) << lo);
512   }
513
514   // Static support.
515
516   // Read one particular bit out of the instruction bits.
517   static inline int Bit(Instr instr, int nr) { return (instr >> nr) & 1; }
518
519   // Read the value of a bit field out of the instruction bits.
520   static inline int Bits(Instr instr, int hi, int lo) {
521     return (instr >> lo) & ((2 << (hi - lo)) - 1);
522   }
523
524
525   // Read a bit field out of the instruction bits.
526   static inline int BitField(Instr instr, int hi, int lo) {
527     return instr & (((2 << (hi - lo)) - 1) << lo);
528   }
529
530   inline int RSValue() const { return Bits(25, 21); }
531   inline int RTValue() const { return Bits(25, 21); }
532   inline int RAValue() const { return Bits(20, 16); }
533   DECLARE_STATIC_ACCESSOR(RAValue);
534   inline int RBValue() const { return Bits(15, 11); }
535   DECLARE_STATIC_ACCESSOR(RBValue);
536   inline int RCValue() const { return Bits(10, 6); }
537   DECLARE_STATIC_ACCESSOR(RCValue);
538
539   inline int OpcodeValue() const { return static_cast<Opcode>(Bits(31, 26)); }
540   inline Opcode OpcodeField() const {
541     return static_cast<Opcode>(BitField(24, 21));
542   }
543
544   // Fields used in Software interrupt instructions
545   inline SoftwareInterruptCodes SvcValue() const {
546     return static_cast<SoftwareInterruptCodes>(Bits(23, 0));
547   }
548
549   // Instructions are read of out a code stream. The only way to get a
550   // reference to an instruction is to convert a pointer. There is no way
551   // to allocate or create instances of class Instruction.
552   // Use the At(pc) function to create references to Instruction.
553   static Instruction* At(byte* pc) {
554     return reinterpret_cast<Instruction*>(pc);
555   }
556
557
558  private:
559   // We need to prevent the creation of instances of class Instruction.
560   DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction);
561 };
562
563
564 // Helper functions for converting between register numbers and names.
565 class Registers {
566  public:
567   // Return the name of the register.
568   static const char* Name(int reg);
569
570   // Lookup the register number for the name provided.
571   static int Number(const char* name);
572
573   struct RegisterAlias {
574     int reg;
575     const char* name;
576   };
577
578  private:
579   static const char* names_[kNumRegisters];
580   static const RegisterAlias aliases_[];
581 };
582
583 // Helper functions for converting between FP register numbers and names.
584 class FPRegisters {
585  public:
586   // Return the name of the register.
587   static const char* Name(int reg);
588
589   // Lookup the register number for the name provided.
590   static int Number(const char* name);
591
592  private:
593   static const char* names_[kNumFPRegisters];
594 };
595 }
596 }  // namespace v8::internal
597
598 #endif  // V8_PPC_CONSTANTS_PPC_H_