src/cpu/sparc/vm/c1_LinearScan_sparc.hpp

changeset 435
a61af66fc99e
child 1907
c18cbe5936b8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/cpu/sparc/vm/c1_LinearScan_sparc.hpp	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,73 @@
     1.4 +/*
     1.5 + * Copyright 2005-2006 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +inline bool LinearScan::is_processed_reg_num(int reg_num) {
    1.29 +  return reg_num < 26 || reg_num > 31;
    1.30 +}
    1.31 +
    1.32 +inline int LinearScan::num_physical_regs(BasicType type) {
    1.33 +  // Sparc requires two cpu registers for long
    1.34 +  // and two cpu registers for double
    1.35 +#ifdef _LP64
    1.36 +  if (type == T_DOUBLE) {
    1.37 +#else
    1.38 +  if (type == T_DOUBLE || type == T_LONG) {
    1.39 +#endif
    1.40 +    return 2;
    1.41 +  }
    1.42 +  return 1;
    1.43 +}
    1.44 +
    1.45 +
    1.46 +inline bool LinearScan::requires_adjacent_regs(BasicType type) {
    1.47 +#ifdef _LP64
    1.48 +  return type == T_DOUBLE;
    1.49 +#else
    1.50 +  return type == T_DOUBLE || type == T_LONG;
    1.51 +#endif
    1.52 +}
    1.53 +
    1.54 +inline bool LinearScan::is_caller_save(int assigned_reg) {
    1.55 +  return assigned_reg > pd_last_callee_saved_reg && assigned_reg <= pd_last_fpu_reg;
    1.56 +}
    1.57 +
    1.58 +
    1.59 +inline void LinearScan::pd_add_temps(LIR_Op* op) {
    1.60 +  // No special case behaviours yet
    1.61 +}
    1.62 +
    1.63 +
    1.64 +inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {
    1.65 +  if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::callee_saved)) {
    1.66 +    assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only");
    1.67 +    _first_reg = pd_first_callee_saved_reg;
    1.68 +    _last_reg = pd_last_callee_saved_reg;
    1.69 +    return true;
    1.70 +  } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT) {
    1.71 +    _first_reg = pd_first_cpu_reg;
    1.72 +    _last_reg = pd_last_allocatable_cpu_reg;
    1.73 +    return true;
    1.74 +  }
    1.75 +  return false;
    1.76 +}

mercurial