1 /*
2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3  * Copyright (c) 2016 SAP SE. All rights reserved.
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 only, as
8  * published by the Free Software Foundation.
9  *
10  * This code is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * version 2 for more details (a copy is included in the LICENSE file that
14  * accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License version
17  * 2 along with this work; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21  * or visit www.oracle.com if you need additional information or have any
22  * questions.
23  *
24  */
25 
26 #ifndef CPU_S390_VM_C1_LINEARSCAN_S390_HPP
27 #define CPU_S390_VM_C1_LINEARSCAN_S390_HPP
28 
is_processed_reg_num(int reg_num)29 inline bool LinearScan::is_processed_reg_num(int reg_num) {
30   // unallocated: Z_thread, Z_fp, Z_SP, Z_R0_scratch, Z_R1_scratch, Z_R14
31   assert(FrameMap::Z_R14_opr->cpu_regnr() == 10, "wrong assumption below");
32   assert(FrameMap::Z_R0_opr->cpu_regnr()  == 11, "wrong assumption below");
33   assert(FrameMap::Z_R1_opr->cpu_regnr()  == 12, "wrong assumption below");
34   assert(FrameMap::Z_R8_opr->cpu_regnr()  == 13, "wrong assumption below");
35   assert(FrameMap::Z_R9_opr->cpu_regnr()  == 14, "wrong assumption below");
36   assert(FrameMap::Z_R15_opr->cpu_regnr() == 15, "wrong assumption below");
37   assert(reg_num >= 0, "invalid reg_num");
38   return reg_num <= FrameMap::last_cpu_reg() || reg_num >= pd_nof_cpu_regs_frame_map;
39 }
40 
num_physical_regs(BasicType type)41 inline int LinearScan::num_physical_regs(BasicType type) {
42   // IBM Z requires one cpu registers for long,
43   // and one fpu register for double.
44   return 1;
45 }
46 
requires_adjacent_regs(BasicType type)47 inline bool LinearScan::requires_adjacent_regs(BasicType type) {
48   return false;
49 }
50 
is_caller_save(int assigned_reg)51 inline bool LinearScan::is_caller_save(int assigned_reg) {
52   assert(assigned_reg >= 0 && assigned_reg < nof_regs, "should call this only for registers");
53   return true; // No callee-saved registers on IBM Z.
54 }
55 
pd_add_temps(LIR_Op * op)56 inline void LinearScan::pd_add_temps(LIR_Op* op) {
57   // No special case behaviours.
58 }
59 
pd_init_regs_for_alloc(Interval * cur)60 inline bool LinearScanWalker::pd_init_regs_for_alloc(Interval* cur) {
61   return false; // No special case behaviours.
62 }
63 
64 #endif // CPU_S390_VM_C1_LINEARSCAN_S390_HPP
65