1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/cpu/sparc/vm/c1_LinearScan_sparc.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,78 @@ 1.4 +/* 1.5 + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP 1.29 +#define CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP 1.30 + 1.31 +inline bool LinearScan::is_processed_reg_num(int reg_num) { 1.32 + return reg_num < 26 || reg_num > 31; 1.33 +} 1.34 + 1.35 +inline int LinearScan::num_physical_regs(BasicType type) { 1.36 + // Sparc requires two cpu registers for long 1.37 + // and two cpu registers for double 1.38 +#ifdef _LP64 1.39 + if (type == T_DOUBLE) { 1.40 +#else 1.41 + if (type == T_DOUBLE || type == T_LONG) { 1.42 +#endif 1.43 + return 2; 1.44 + } 1.45 + return 1; 1.46 +} 1.47 + 1.48 + 1.49 +inline bool LinearScan::requires_adjacent_regs(BasicType type) { 1.50 +#ifdef _LP64 1.51 + return type == T_DOUBLE; 1.52 +#else 1.53 + return type == T_DOUBLE || type == T_LONG; 1.54 +#endif 1.55 +} 1.56 + 1.57 +inline bool LinearScan::is_caller_save(int assigned_reg) { 1.58 + return assigned_reg > pd_last_callee_saved_reg && assigned_reg <= pd_last_fpu_reg; 1.59 +} 1.60 + 1.61 + 1.62 +inline void LinearScan::pd_add_temps(LIR_Op* op) { 1.63 + // No special case behaviours yet 1.64 +} 1.65 + 1.66 + 1.67 +inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) { 1.68 + if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::callee_saved)) { 1.69 + assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only"); 1.70 + _first_reg = pd_first_callee_saved_reg; 1.71 + _last_reg = pd_last_callee_saved_reg; 1.72 + return true; 1.73 + } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || cur->type() == T_ADDRESS || cur->type() == T_METADATA) { 1.74 + _first_reg = pd_first_cpu_reg; 1.75 + _last_reg = pd_last_allocatable_cpu_reg; 1.76 + return true; 1.77 + } 1.78 + return false; 1.79 +} 1.80 + 1.81 +#endif // CPU_SPARC_VM_C1_LINEARSCAN_SPARC_HPP