equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
25 |
25 |
26 #ifndef CPU_PPC_VM_REGISTER_PPC_HPP |
26 #ifndef CPU_PPC_VM_REGISTER_PPC_HPP |
27 #define CPU_PPC_VM_REGISTER_PPC_HPP |
27 #define CPU_PPC_VM_REGISTER_PPC_HPP |
28 |
28 |
29 #include "asm/register.hpp" |
29 #include "asm/register.hpp" |
30 #include "vm_version_ppc.hpp" |
|
31 |
30 |
32 // forward declaration |
31 // forward declaration |
33 class Address; |
32 class Address; |
34 class VMRegImpl; |
33 class VMRegImpl; |
35 typedef VMRegImpl* VMReg; |
34 typedef VMRegImpl* VMReg; |
90 |
89 |
91 // general construction |
90 // general construction |
92 inline friend Register as_Register(int encoding); |
91 inline friend Register as_Register(int encoding); |
93 |
92 |
94 // accessors |
93 // accessors |
95 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
94 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
96 VMReg as_VMReg(); |
95 inline VMReg as_VMReg(); |
97 Register successor() const { return as_Register(encoding() + 1); } |
96 Register successor() const { return as_Register(encoding() + 1); } |
98 |
97 |
99 // testers |
98 // testers |
100 bool is_valid() const { return ( 0 <= (value()&0x7F) && (value()&0x7F) < number_of_registers); } |
99 bool is_valid() const { return ( 0 <= (value()&0x7F) && (value()&0x7F) < number_of_registers); } |
101 bool is_volatile() const { return ( 0 <= (value()&0x7F) && (value()&0x7F) <= 13 ); } |
100 bool is_volatile() const { return ( 0 <= (value()&0x7F) && (value()&0x7F) <= 13 ); } |
206 |
205 |
207 // construction. |
206 // construction. |
208 inline friend ConditionRegister as_ConditionRegister(int encoding); |
207 inline friend ConditionRegister as_ConditionRegister(int encoding); |
209 |
208 |
210 // accessors |
209 // accessors |
211 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
210 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
212 VMReg as_VMReg(); |
211 inline VMReg as_VMReg(); |
213 |
212 |
214 // testers |
213 // testers |
215 bool is_valid() const { return (0 <= value() && value() < number_of_registers); } |
214 bool is_valid() const { return (0 <= value() && value() < number_of_registers); } |
216 bool is_nonvolatile() const { return (2 <= (value()&0x7F) && (value()&0x7F) <= 4 ); } |
215 bool is_nonvolatile() const { return (2 <= (value()&0x7F) && (value()&0x7F) <= 4 ); } |
217 |
216 |
262 // construction |
261 // construction |
263 inline friend FloatRegister as_FloatRegister(int encoding); |
262 inline friend FloatRegister as_FloatRegister(int encoding); |
264 |
263 |
265 // accessors |
264 // accessors |
266 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
265 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
267 VMReg as_VMReg(); |
266 inline VMReg as_VMReg(); |
268 FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } |
267 FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } |
269 |
268 |
270 // testers |
269 // testers |
271 bool is_valid() const { return (0 <= value() && value() < number_of_registers); } |
270 bool is_valid() const { return (0 <= value() && value() < number_of_registers); } |
272 |
271 |
363 // construction |
362 // construction |
364 inline friend SpecialRegister as_SpecialRegister(int encoding); |
363 inline friend SpecialRegister as_SpecialRegister(int encoding); |
365 |
364 |
366 // accessors |
365 // accessors |
367 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
366 int encoding() const { assert(is_valid(), "invalid register"); return value(); } |
368 VMReg as_VMReg(); |
367 inline VMReg as_VMReg(); |
369 |
368 |
370 // testers |
369 // testers |
371 bool is_valid() const { return 0 <= value() && value() < number_of_registers; } |
370 bool is_valid() const { return 0 <= value() && value() < number_of_registers; } |
372 |
371 |
373 const char* name() const; |
372 const char* name() const; |