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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "opto/machnode.hpp"
28 #include "opto/regalloc.hpp"
29
30 //=============================================================================
31 // Return the value requested
32 // result register lookup, corresponding to int_format
33 int MachOper::reg(PhaseRegAlloc *ra_, const Node *node) const {
34 return (int)ra_->get_encode(node);
35 }
36 // input register lookup, corresponding to ext_format
37 int MachOper::reg(PhaseRegAlloc *ra_, const Node *node, int idx) const {
38 return (int)(ra_->get_encode(node->in(idx)));
39 }
40 intptr_t MachOper::constant() const { return 0x00; }
41 relocInfo::relocType MachOper::constant_reloc() const { return relocInfo::none; }
42 jdouble MachOper::constantD() const { ShouldNotReachHere(); return 0.0; }
43 jfloat MachOper::constantF() const { ShouldNotReachHere(); return 0.0; }
44 jlong MachOper::constantL() const { ShouldNotReachHere(); return CONST64(0) ; }
45 TypeOopPtr *MachOper::oop() const { return NULL; }
46 int MachOper::ccode() const { return 0x00; }
47 // A zero, default, indicates this value is not needed.
48 // May need to lookup the base register, as done in int_ and ext_format
570 if( _ideal_reg == fat_proj ) return Type::BOTTOM;
571 // Try the normal mechanism first
572 const Type *t = in(0)->bottom_type();
573 if( t->base() == Type::Tuple ) {
574 const TypeTuple *tt = t->is_tuple();
575 if (_con < tt->cnt())
576 return tt->field_at(_con);
577 }
578 // Else use generic type from ideal register set
579 assert((uint)_ideal_reg < (uint)_last_machine_leaf && Type::mreg2type[_ideal_reg], "in bounds");
580 return Type::mreg2type[_ideal_reg];
581 }
582
583 const TypePtr *MachProjNode::adr_type() const {
584 if (bottom_type() == Type::MEMORY) {
585 // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
586 Node* ctrl = in(0);
587 if (ctrl == NULL) return NULL; // node is dead
588 const TypePtr* adr_type = ctrl->adr_type();
589 #ifdef ASSERT
590 if (!is_error_reported() && !Node::in_dump())
591 assert(adr_type != NULL, "source must have adr_type");
592 #endif
593 return adr_type;
594 }
595 assert(bottom_type()->base() != Type::Memory, "no other memories?");
596 return NULL;
597 }
598
599 #ifndef PRODUCT
600 void MachProjNode::dump_spec(outputStream *st) const {
601 ProjNode::dump_spec(st);
602 switch (_ideal_reg) {
603 case unmatched_proj: st->print("/unmatched"); break;
604 case fat_proj: st->print("/fat"); if (WizardMode) _rout.dump(st); break;
605 }
606 }
607 #endif
608
609 //=============================================================================
610 #ifndef PRODUCT
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "opto/machnode.hpp"
28 #include "opto/regalloc.hpp"
29 #include "utilities/vmError.hpp"
30
31 //=============================================================================
32 // Return the value requested
33 // result register lookup, corresponding to int_format
34 int MachOper::reg(PhaseRegAlloc *ra_, const Node *node) const {
35 return (int)ra_->get_encode(node);
36 }
37 // input register lookup, corresponding to ext_format
38 int MachOper::reg(PhaseRegAlloc *ra_, const Node *node, int idx) const {
39 return (int)(ra_->get_encode(node->in(idx)));
40 }
41 intptr_t MachOper::constant() const { return 0x00; }
42 relocInfo::relocType MachOper::constant_reloc() const { return relocInfo::none; }
43 jdouble MachOper::constantD() const { ShouldNotReachHere(); return 0.0; }
44 jfloat MachOper::constantF() const { ShouldNotReachHere(); return 0.0; }
45 jlong MachOper::constantL() const { ShouldNotReachHere(); return CONST64(0) ; }
46 TypeOopPtr *MachOper::oop() const { return NULL; }
47 int MachOper::ccode() const { return 0x00; }
48 // A zero, default, indicates this value is not needed.
49 // May need to lookup the base register, as done in int_ and ext_format
571 if( _ideal_reg == fat_proj ) return Type::BOTTOM;
572 // Try the normal mechanism first
573 const Type *t = in(0)->bottom_type();
574 if( t->base() == Type::Tuple ) {
575 const TypeTuple *tt = t->is_tuple();
576 if (_con < tt->cnt())
577 return tt->field_at(_con);
578 }
579 // Else use generic type from ideal register set
580 assert((uint)_ideal_reg < (uint)_last_machine_leaf && Type::mreg2type[_ideal_reg], "in bounds");
581 return Type::mreg2type[_ideal_reg];
582 }
583
584 const TypePtr *MachProjNode::adr_type() const {
585 if (bottom_type() == Type::MEMORY) {
586 // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
587 Node* ctrl = in(0);
588 if (ctrl == NULL) return NULL; // node is dead
589 const TypePtr* adr_type = ctrl->adr_type();
590 #ifdef ASSERT
591 if (!VMError::is_error_reported() && !Node::in_dump())
592 assert(adr_type != NULL, "source must have adr_type");
593 #endif
594 return adr_type;
595 }
596 assert(bottom_type()->base() != Type::Memory, "no other memories?");
597 return NULL;
598 }
599
600 #ifndef PRODUCT
601 void MachProjNode::dump_spec(outputStream *st) const {
602 ProjNode::dump_spec(st);
603 switch (_ideal_reg) {
604 case unmatched_proj: st->print("/unmatched"); break;
605 case fat_proj: st->print("/fat"); if (WizardMode) _rout.dump(st); break;
606 }
607 }
608 #endif
609
610 //=============================================================================
611 #ifndef PRODUCT
|