1 //
2 // Copyright (c) 1998, 2017, Oracle and/or its affiliates. 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 it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 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 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
1278 assert( do_polling(), "no return for this epilog node");
1279 return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord;
1280 }
1281
1282 //=============================================================================
1283
1284 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack
1285 enum RC { rc_bad, rc_int, rc_float, rc_stack };
1286 static enum RC rc_class( OptoReg::Name reg ) {
1287 if (!OptoReg::is_valid(reg)) return rc_bad;
1288 if (OptoReg::is_stack(reg)) return rc_stack;
1289 VMReg r = OptoReg::as_VMReg(reg);
1290 if (r->is_Register()) return rc_int;
1291 assert(r->is_FloatRegister(), "must be");
1292 return rc_float;
1293 }
1294
1295 #ifndef PRODUCT
1296 ATTRIBUTE_PRINTF(2, 3)
1297 static void print_helper(outputStream* st, const char* format, ...) {
1298 if (st->position() > 0) {
1299 st->cr();
1300 st->sp();
1301 }
1302 va_list ap;
1303 va_start(ap, format);
1304 st->vprint(format, ap);
1305 va_end(ap);
1306 }
1307 #endif // !PRODUCT
1308
1309 static void impl_helper(const MachNode* mach, CodeBuffer* cbuf, PhaseRegAlloc* ra, bool is_load, int offset, int reg, int opcode, const char *op_str, outputStream* st) {
1310 if (cbuf) {
1311 emit_form3_mem_reg(*cbuf, ra, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]);
1312 }
1313 #ifndef PRODUCT
1314 else {
1315 if (is_load) {
1316 print_helper(st, "%s [R_SP + #%d],R_%s\t! spill", op_str, offset, OptoReg::regname(reg));
1317 } else {
1318 print_helper(st, "%s R_%s,[R_SP + #%d]\t! spill", op_str, OptoReg::regname(reg), offset);
|
1 //
2 // Copyright (c) 1998, 2019, Oracle and/or its affiliates. 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 it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 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 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
1278 assert( do_polling(), "no return for this epilog node");
1279 return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord;
1280 }
1281
1282 //=============================================================================
1283
1284 // Figure out which register class each belongs in: rc_int, rc_float, rc_stack
1285 enum RC { rc_bad, rc_int, rc_float, rc_stack };
1286 static enum RC rc_class( OptoReg::Name reg ) {
1287 if (!OptoReg::is_valid(reg)) return rc_bad;
1288 if (OptoReg::is_stack(reg)) return rc_stack;
1289 VMReg r = OptoReg::as_VMReg(reg);
1290 if (r->is_Register()) return rc_int;
1291 assert(r->is_FloatRegister(), "must be");
1292 return rc_float;
1293 }
1294
1295 #ifndef PRODUCT
1296 ATTRIBUTE_PRINTF(2, 3)
1297 static void print_helper(outputStream* st, const char* format, ...) {
1298 const int tab_size = 8;
1299 if (st->position() > tab_size) {
1300 st->cr();
1301 st->sp();
1302 }
1303 va_list ap;
1304 va_start(ap, format);
1305 st->vprint(format, ap);
1306 va_end(ap);
1307 }
1308 #endif // !PRODUCT
1309
1310 static void impl_helper(const MachNode* mach, CodeBuffer* cbuf, PhaseRegAlloc* ra, bool is_load, int offset, int reg, int opcode, const char *op_str, outputStream* st) {
1311 if (cbuf) {
1312 emit_form3_mem_reg(*cbuf, ra, mach, opcode, -1, R_SP_enc, offset, 0, Matcher::_regEncode[reg]);
1313 }
1314 #ifndef PRODUCT
1315 else {
1316 if (is_load) {
1317 print_helper(st, "%s [R_SP + #%d],R_%s\t! spill", op_str, offset, OptoReg::regname(reg));
1318 } else {
1319 print_helper(st, "%s R_%s,[R_SP + #%d]\t! spill", op_str, OptoReg::regname(reg), offset);
|