1 /*
2  * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
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_ARM_VM_VMREG_ARM_HPP
26 #define CPU_ARM_VM_VMREG_ARM_HPP
27 
is_Register()28   inline bool is_Register() {
29     return (unsigned int) value() < (unsigned int) ConcreteRegisterImpl::max_gpr;
30   }
31 
is_FloatRegister()32   inline bool is_FloatRegister() {
33     return value() >= ConcreteRegisterImpl::max_gpr && value() < ConcreteRegisterImpl::max_fpr;
34   }
35 
as_Register()36   inline Register as_Register() {
37     assert(is_Register(), "must be");
38     assert(is_concrete(), "concrete register expected");
39     return ::as_Register(value() >> ConcreteRegisterImpl::log_vmregs_per_gpr);
40   }
41 
as_FloatRegister()42   inline FloatRegister as_FloatRegister() {
43     assert(is_FloatRegister(), "must be");
44     assert(is_concrete(), "concrete register expected");
45     return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> ConcreteRegisterImpl::log_vmregs_per_fpr);
46   }
47 
is_concrete()48   inline bool is_concrete() {
49     if (is_Register()) {
50       return ((value() & right_n_bits(ConcreteRegisterImpl::log_vmregs_per_gpr)) == 0);
51     } else if (is_FloatRegister()) {
52       return (((value() - ConcreteRegisterImpl::max_gpr) & right_n_bits(ConcreteRegisterImpl::log_vmregs_per_fpr)) == 0);
53     } else {
54       return false;
55     }
56   }
57 
58 #endif // CPU_ARM_VM_VMREG_ARM_HPP
59