8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef CPU_X86_VM_VMREG_X86_INLINE_HPP 26 #define CPU_X86_VM_VMREG_X86_INLINE_HPP 27 28 inline VMReg RegisterImpl::as_VMReg() { 29 if( this==noreg ) return VMRegImpl::Bad(); 30 #ifdef AMD64 31 return VMRegImpl::as_VMReg(encoding() << 1 ); 32 #else 33 return VMRegImpl::as_VMReg(encoding() ); 34 #endif // AMD64 35 } 36 37 inline VMReg FloatRegisterImpl::as_VMReg() { 38 return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); 39 } 40 41 inline VMReg XMMRegisterImpl::as_VMReg() { 42 return VMRegImpl::as_VMReg((encoding() << 3) + ConcreteRegisterImpl::max_fpr); 43 } 44 45 46 inline bool VMRegImpl::is_Register() { 47 return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; 48 } 49 50 inline bool VMRegImpl::is_FloatRegister() { 51 return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; 52 } 53 54 inline bool VMRegImpl::is_XMMRegister() { 55 return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm; 56 } 57 58 inline Register VMRegImpl::as_Register() { 59 60 assert( is_Register(), "must be"); 61 // Yuk | 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef CPU_X86_VM_VMREG_X86_INLINE_HPP 26 #define CPU_X86_VM_VMREG_X86_INLINE_HPP 27 28 inline VMReg Register::as_VMReg() const { 29 if (encoding() == noreg.encoding()) { 30 return VMRegImpl::Bad(); 31 } 32 #ifdef AMD64 33 return VMRegImpl::as_VMReg(encoding() << 1 ); 34 #else 35 return VMRegImpl::as_VMReg(encoding() ); 36 #endif // AMD64 37 } 38 39 inline VMReg FloatRegister::as_VMReg() const { 40 return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr); 41 } 42 43 inline VMReg XMMRegister::as_VMReg() const { 44 return VMRegImpl::as_VMReg((encoding() << 3) + ConcreteRegisterImpl::max_fpr); 45 } 46 47 48 inline bool VMRegImpl::is_Register() { 49 return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr; 50 } 51 52 inline bool VMRegImpl::is_FloatRegister() { 53 return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr; 54 } 55 56 inline bool VMRegImpl::is_XMMRegister() { 57 return value() >= ConcreteRegisterImpl::max_fpr && value() < ConcreteRegisterImpl::max_xmm; 58 } 59 60 inline Register VMRegImpl::as_Register() { 61 62 assert( is_Register(), "must be"); 63 // Yuk |