Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: src/ppc/constants-ppc.h

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

Powered by Google App Engine
This is Rietveld 408576698