1 /*
   2  * Copyright (c) 2013, Red Hat Inc.
   3  * Copyright (c) 2005, 2010, Oracle and/or its affiliates.
   4  * All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #ifndef CPU_AARCH64_VM_C1_LINEARSCAN_HPP
  28 #define CPU_AARCH64_VM_C1_LINEARSCAN_HPP
  29 
  30 inline bool LinearScan::is_processed_reg_num(int reg_num) {
  31   return reg_num <= FrameMap::last_cpu_reg() || reg_num >= pd_nof_cpu_regs_frame_map;
  32 }
  33 
  34 inline int LinearScan::num_physical_regs(BasicType type) {
  35   return 1;
  36 }
  37 
  38 
  39 inline bool LinearScan::requires_adjacent_regs(BasicType type) {
  40   return false;
  41 }
  42 
  43 inline bool LinearScan::is_caller_save(int assigned_reg) {
  44   assert(assigned_reg >= 0 && assigned_reg < nof_regs, "should call this only for registers");
  45   if (assigned_reg < pd_first_callee_saved_reg)
  46     return true;
  47   if (assigned_reg > pd_last_callee_saved_reg && assigned_reg < pd_first_callee_saved_fpu_reg)
  48     return true;
  49   if (assigned_reg > pd_last_callee_saved_fpu_reg && assigned_reg < pd_last_fpu_reg)
  50     return true;
  51   return false;
  52 }
  53 
  54 
  55 inline void LinearScan::pd_add_temps(LIR_Op* op) {
  56   // FIXME ??
  57 }
  58 
  59 
  60 // Implementation of LinearScanWalker
  61 
  62 inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {
  63   if (allocator()->gen()->is_vreg_flag_set(cur->reg_num(), LIRGenerator::callee_saved)) {
  64     assert(cur->type() != T_FLOAT && cur->type() != T_DOUBLE, "cpu regs only");
  65     _first_reg = pd_first_callee_saved_reg;
  66     _last_reg = pd_last_callee_saved_reg;
  67     return true;
  68   } else if (cur->type() == T_INT || cur->type() == T_LONG || cur->type() == T_OBJECT || cur->type() == T_ADDRESS || cur->type() == T_METADATA) {
  69     _first_reg = pd_first_cpu_reg;
  70     _last_reg = pd_last_allocatable_cpu_reg;
  71     return true;
  72   }
  73   return false;
  74 }
  75 
  76 
  77 #endif // CPU_AARCH64_VM_C1_LINEARSCAN_HPP