1 /*
2 * Copyright (c) 1998, 2015, 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 *
705 assert(USE_of_memory >= DEF_of_memory, "unpaired memory DEF");
706 USE_of_memory -= DEF_of_memory; // treat paired DEF/USE as one occurrence
707 if( (USE_of_memory + DEF_of_memory) > 0 ) {
708 if( is_simple_chain_rule(globals) ) {
709 //fprintf(stderr, "Warning: chain rule is not really a memory user.\n");
710 //((InstructForm*)this)->dump();
711 // Preceding code prints nothing on sparc and these insns on intel:
712 // leaP8 leaP32 leaPIdxOff leaPIdxScale leaPIdxScaleOff leaP8 leaP32
713 // leaPIdxOff leaPIdxScale leaPIdxScaleOff
714 return NO_MEMORY_OPERAND;
715 }
716
717 if( DEF_of_memory == 1 ) {
718 assert(unique != NULL, "");
719 if( USE_of_memory == 0 ) {
720 // unique def, no uses
721 } else {
722 // // unique def, some uses
723 // // must return bottom unless all uses match def
724 // unique = NULL;
725 }
726 } else if( DEF_of_memory > 0 ) {
727 // multiple defs, don't care about uses
728 unique = NULL;
729 } else if( USE_of_memory == 1) {
730 // unique use, no defs
731 assert(unique != NULL, "");
732 } else if( USE_of_memory > 0 ) {
733 // multiple uses, no defs
734 unique = NULL;
735 } else {
736 assert(false, "bad case analysis");
737 }
738 // process the unique DEF or USE, if there is one
739 if( unique == NULL ) {
740 return MANY_MEMORY_OPERANDS;
741 } else {
742 int pos = components.operand_position(unique->_name);
743 if( unique->isa(Component::DEF) ) {
744 pos += 1; // get corresponding USE from DEF
|
1 /*
2 * Copyright (c) 1998, 2016, 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 *
705 assert(USE_of_memory >= DEF_of_memory, "unpaired memory DEF");
706 USE_of_memory -= DEF_of_memory; // treat paired DEF/USE as one occurrence
707 if( (USE_of_memory + DEF_of_memory) > 0 ) {
708 if( is_simple_chain_rule(globals) ) {
709 //fprintf(stderr, "Warning: chain rule is not really a memory user.\n");
710 //((InstructForm*)this)->dump();
711 // Preceding code prints nothing on sparc and these insns on intel:
712 // leaP8 leaP32 leaPIdxOff leaPIdxScale leaPIdxScaleOff leaP8 leaP32
713 // leaPIdxOff leaPIdxScale leaPIdxScaleOff
714 return NO_MEMORY_OPERAND;
715 }
716
717 if( DEF_of_memory == 1 ) {
718 assert(unique != NULL, "");
719 if( USE_of_memory == 0 ) {
720 // unique def, no uses
721 } else {
722 // // unique def, some uses
723 // // must return bottom unless all uses match def
724 // unique = NULL;
725 #ifdef S390
726 // This case is important for move instructions on s390x.
727 // On other platforms (e.g. x86), all uses always match the def.
728 unique = NULL;
729 #endif
730 }
731 } else if( DEF_of_memory > 0 ) {
732 // multiple defs, don't care about uses
733 unique = NULL;
734 } else if( USE_of_memory == 1) {
735 // unique use, no defs
736 assert(unique != NULL, "");
737 } else if( USE_of_memory > 0 ) {
738 // multiple uses, no defs
739 unique = NULL;
740 } else {
741 assert(false, "bad case analysis");
742 }
743 // process the unique DEF or USE, if there is one
744 if( unique == NULL ) {
745 return MANY_MEMORY_OPERANDS;
746 } else {
747 int pos = components.operand_position(unique->_name);
748 if( unique->isa(Component::DEF) ) {
749 pos += 1; // get corresponding USE from DEF
|