Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/aarch32/vm/c1_LinearScan_aarch32.hpp
32285 views
/*1* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2014, Red Hat Inc. 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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/24// This file is a derivative work resulting from (and including) modifications25// made by Azul Systems, Inc. The dates of such changes are 2013-2016.26// Copyright 2013-2016 Azul Systems, Inc. All Rights Reserved.27//28// Please contact Azul Systems, 385 Moffett Park Drive, Suite 115, Sunnyvale,29// CA 94089 USA or visit www.azul.com if you need additional information or30// have any questions.3132#ifndef CPU_AARCH32_VM_C1_LINEARSCAN_AARCH32_HPP33#define CPU_AARCH32_VM_C1_LINEARSCAN_AARCH32_HPP3435inline bool LinearScan::is_processed_reg_num(int reg_num) {36return reg_num <= pd_last_cpu_reg || reg_num >= pd_nof_cpu_regs_frame_map;37}3839inline int LinearScan::num_physical_regs(BasicType type) {40if (type == T_LONG || type == T_DOUBLE) {41return 2;42}43return 1;44}4546inline bool LinearScan::requires_adjacent_regs(BasicType type) {47if (type == T_DOUBLE) {48return true;49}50return false;51}5253inline bool LinearScan::is_caller_save(int assigned_reg) {54assert(assigned_reg >= 0 && assigned_reg < nof_regs,55"should call this only for registers");56// TODO: Remove the following line when support for callee-saved registers57// is added58return true;59if (assigned_reg < pd_first_callee_saved_cpu_reg) {60return true;61}62if (assigned_reg > pd_last_callee_saved_cpu_reg &&63assigned_reg < pd_first_callee_saved_fpu_reg) {64return true;65}66if (assigned_reg > pd_last_callee_saved_fpu_reg &&67assigned_reg <= pd_last_fpu_reg) {68return true;69}70return false;71}7273// If there are special cases when some particular LIR operations kill some74// specific registers, this behavior should be described here. An example75// can be found in x86 port.76inline void LinearScan::pd_add_temps(LIR_Op* op) {77if (op->code() == lir_move) {78LIR_Op1* move_op = op->as_Op1();79if (move_op->move_kind() == lir_move_volatile) {80bool is_long = move_op->type() == T_LONG;81bool is_double = move_op->type() == T_DOUBLE;82bool is_store = move_op->in_opr()->is_register();83if (is_double) {84add_temp(reg_num(FrameMap::long0_opr), op->id(), noUse, T_ILLEGAL);85add_temp(reg_numHi(FrameMap::long0_opr), op->id(), noUse, T_ILLEGAL);86}87if (is_store && (is_long || is_double)) {88add_temp(reg_num(FrameMap::long1_opr), op->id(), noUse, T_ILLEGAL);89add_temp(reg_numHi(FrameMap::long1_opr), op->id(), noUse, T_ILLEGAL);90}91}92}93}9495inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {96#ifndef HARD_FLOAT_CC97BasicType type = cur->type();98if(!hasFPU()) {99if (type == T_FLOAT || type == T_DOUBLE) {100_first_reg = pd_first_cpu_reg;101_last_reg = FrameMap::last_cpu_reg();;102return true;103}104}105#endif106return false;107}108109#endif // CPU_AARCH32_VM_C1_LINEARSCAN_AARCH32_HPP110111112