1 /*
2 * Copyright (c) 2007, 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 */
582 // Following is used to create a temporary object during
583 // the pattern match of an address expression.
584 SWPointer(SWPointer* p);
585
586 bool valid() { return _adr != NULL; }
587 bool has_iv() { return _scale != 0; }
588
589 Node* base() { return _base; }
590 Node* adr() { return _adr; }
591 MemNode* mem() { return _mem; }
592 int scale_in_bytes() { return _scale; }
593 Node* invar() { return _invar; }
594 bool negate_invar() { return _negate_invar; }
595 int offset_in_bytes() { return _offset; }
596 int memory_size() { return _mem->memory_size(); }
597 Node_Stack* node_stack() { return _nstack; }
598
599 // Comparable?
600 int cmp(SWPointer& q) {
601 if (valid() && q.valid() &&
602 (_adr == q._adr || _base == _adr && q._base == q._adr) &&
603 _scale == q._scale &&
604 _invar == q._invar &&
605 _negate_invar == q._negate_invar) {
606 bool overlap = q._offset < _offset + memory_size() &&
607 _offset < q._offset + q.memory_size();
608 return overlap ? Equal : (_offset < q._offset ? Less : Greater);
609 } else {
610 return NotComparable;
611 }
612 }
613
614 bool not_equal(SWPointer& q) { return not_equal(cmp(q)); }
615 bool equal(SWPointer& q) { return equal(cmp(q)); }
616 bool comparable(SWPointer& q) { return comparable(cmp(q)); }
617 static bool not_equal(int cmp) { return cmp <= NotEqual; }
618 static bool equal(int cmp) { return cmp == Equal; }
619 static bool comparable(int cmp) { return cmp < NotComparable; }
620
621 void print();
622
|
1 /*
2 * Copyright (c) 2007, 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 */
582 // Following is used to create a temporary object during
583 // the pattern match of an address expression.
584 SWPointer(SWPointer* p);
585
586 bool valid() { return _adr != NULL; }
587 bool has_iv() { return _scale != 0; }
588
589 Node* base() { return _base; }
590 Node* adr() { return _adr; }
591 MemNode* mem() { return _mem; }
592 int scale_in_bytes() { return _scale; }
593 Node* invar() { return _invar; }
594 bool negate_invar() { return _negate_invar; }
595 int offset_in_bytes() { return _offset; }
596 int memory_size() { return _mem->memory_size(); }
597 Node_Stack* node_stack() { return _nstack; }
598
599 // Comparable?
600 int cmp(SWPointer& q) {
601 if (valid() && q.valid() &&
602 (_adr == q._adr || (_base == _adr && q._base == q._adr)) &&
603 _scale == q._scale &&
604 _invar == q._invar &&
605 _negate_invar == q._negate_invar) {
606 bool overlap = q._offset < _offset + memory_size() &&
607 _offset < q._offset + q.memory_size();
608 return overlap ? Equal : (_offset < q._offset ? Less : Greater);
609 } else {
610 return NotComparable;
611 }
612 }
613
614 bool not_equal(SWPointer& q) { return not_equal(cmp(q)); }
615 bool equal(SWPointer& q) { return equal(cmp(q)); }
616 bool comparable(SWPointer& q) { return comparable(cmp(q)); }
617 static bool not_equal(int cmp) { return cmp <= NotEqual; }
618 static bool equal(int cmp) { return cmp == Equal; }
619 static bool comparable(int cmp) { return cmp < NotComparable; }
620
621 void print();
622
|