1963
1964 //------------------------------find_receiver----------------------------------
1965 // For a given signature, return the OptoReg for parameter 0.
1966 OptoReg::Name Matcher::find_receiver( bool is_outgoing ) {
1967 VMRegPair regs;
1968 BasicType sig_bt = T_OBJECT;
1969 calling_convention(&sig_bt, ®s, 1, is_outgoing);
1970 // Return argument 0 register. In the LP64 build pointers
1971 // take 2 registers, but the VM wants only the 'main' name.
1972 return OptoReg::as_OptoReg(regs.first());
1973 }
1974
1975 bool Matcher::is_vshift_con_pattern(Node *n, Node *m) {
1976 if (n != NULL && m != NULL) {
1977 return VectorNode::is_vector_shift(n) &&
1978 VectorNode::is_vector_shift_count(m) && m->in(1)->is_Con();
1979 }
1980 return false;
1981 }
1982
1983
1984 bool Matcher::clone_node(Node* n, Node* m, Matcher::MStack& mstack) {
1985 // Must clone all producers of flags, or we will not match correctly.
1986 // Suppose a compare setting int-flags is shared (e.g., a switch-tree)
1987 // then it will match into an ideal Op_RegFlags. Alas, the fp-flags
1988 // are also there, so we may match a float-branch to int-flags and
1989 // expect the allocator to haul the flags from the int-side to the
1990 // fp-side. No can do.
1991 if (_must_clone[m->Opcode()]) {
1992 mstack.push(m, Visit);
1993 return true;
1994 }
1995 return pd_clone_node(n, m, mstack);
1996 }
1997
1998 bool Matcher::clone_base_plus_offset_address(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) {
1999 Node *off = m->in(AddPNode::Offset);
2000 if (off->is_Con()) {
2001 address_visited.test_set(m->_idx); // Flag as address_visited
2002 mstack.push(m->in(AddPNode::Address), Pre_Visit);
2003 // Clone X+offset as it also folds into most addressing expressions
2324 n->set_req(1, pair);
2325 n->set_req(2, n->in(3));
2326 n->del_req(3);
2327 break;
2328 }
2329 case Op_StoreVectorScatter: {
2330 Node* pair = new BinaryNode(n->in(MemNode::ValueIn), n->in(MemNode::ValueIn+1));
2331 n->set_req(MemNode::ValueIn, pair);
2332 n->del_req(MemNode::ValueIn+1);
2333 break;
2334 }
2335 case Op_MulAddS2I: {
2336 Node* pair1 = new BinaryNode(n->in(1), n->in(2));
2337 Node* pair2 = new BinaryNode(n->in(3), n->in(4));
2338 n->set_req(1, pair1);
2339 n->set_req(2, pair2);
2340 n->del_req(4);
2341 n->del_req(3);
2342 break;
2343 }
2344 #ifdef X86
2345 case Op_VectorMaskCmp: {
2346 n->set_req(1, new BinaryNode(n->in(1), n->in(2)));
2347 n->set_req(2, n->in(3));
2348 n->del_req(3);
2349 break;
2350 }
2351 #endif
2352 default:
2353 break;
2354 }
2355 }
2356
2357 #ifdef ASSERT
2358 // machine-independent root to machine-dependent root
2359 void Matcher::dump_old2new_map() {
2360 _old2new_map.dump();
2361 }
2362 #endif
2363
2364 //---------------------------collect_null_checks-------------------------------
2365 // Find null checks in the ideal graph; write a machine-specific node for
2366 // it. Used by later implicit-null-check handling. Actually collects
2367 // either an IfTrue or IfFalse for the common NOT-null path, AND the ideal
2368 // value being tested.
2369 void Matcher::collect_null_checks( Node *proj, Node *orig_proj ) {
2370 Node *iff = proj->in(0);
2371 if( iff->Opcode() == Op_If ) {
|
1963
1964 //------------------------------find_receiver----------------------------------
1965 // For a given signature, return the OptoReg for parameter 0.
1966 OptoReg::Name Matcher::find_receiver( bool is_outgoing ) {
1967 VMRegPair regs;
1968 BasicType sig_bt = T_OBJECT;
1969 calling_convention(&sig_bt, ®s, 1, is_outgoing);
1970 // Return argument 0 register. In the LP64 build pointers
1971 // take 2 registers, but the VM wants only the 'main' name.
1972 return OptoReg::as_OptoReg(regs.first());
1973 }
1974
1975 bool Matcher::is_vshift_con_pattern(Node *n, Node *m) {
1976 if (n != NULL && m != NULL) {
1977 return VectorNode::is_vector_shift(n) &&
1978 VectorNode::is_vector_shift_count(m) && m->in(1)->is_Con();
1979 }
1980 return false;
1981 }
1982
1983 bool Matcher::clone_node(Node* n, Node* m, Matcher::MStack& mstack) {
1984 // Must clone all producers of flags, or we will not match correctly.
1985 // Suppose a compare setting int-flags is shared (e.g., a switch-tree)
1986 // then it will match into an ideal Op_RegFlags. Alas, the fp-flags
1987 // are also there, so we may match a float-branch to int-flags and
1988 // expect the allocator to haul the flags from the int-side to the
1989 // fp-side. No can do.
1990 if (_must_clone[m->Opcode()]) {
1991 mstack.push(m, Visit);
1992 return true;
1993 }
1994 return pd_clone_node(n, m, mstack);
1995 }
1996
1997 bool Matcher::clone_base_plus_offset_address(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) {
1998 Node *off = m->in(AddPNode::Offset);
1999 if (off->is_Con()) {
2000 address_visited.test_set(m->_idx); // Flag as address_visited
2001 mstack.push(m->in(AddPNode::Address), Pre_Visit);
2002 // Clone X+offset as it also folds into most addressing expressions
2323 n->set_req(1, pair);
2324 n->set_req(2, n->in(3));
2325 n->del_req(3);
2326 break;
2327 }
2328 case Op_StoreVectorScatter: {
2329 Node* pair = new BinaryNode(n->in(MemNode::ValueIn), n->in(MemNode::ValueIn+1));
2330 n->set_req(MemNode::ValueIn, pair);
2331 n->del_req(MemNode::ValueIn+1);
2332 break;
2333 }
2334 case Op_MulAddS2I: {
2335 Node* pair1 = new BinaryNode(n->in(1), n->in(2));
2336 Node* pair2 = new BinaryNode(n->in(3), n->in(4));
2337 n->set_req(1, pair1);
2338 n->set_req(2, pair2);
2339 n->del_req(4);
2340 n->del_req(3);
2341 break;
2342 }
2343 case Op_VectorMaskCmp: {
2344 n->set_req(1, new BinaryNode(n->in(1), n->in(2)));
2345 n->set_req(2, n->in(3));
2346 n->del_req(3);
2347 break;
2348 }
2349 default:
2350 break;
2351 }
2352 }
2353
2354 #ifdef ASSERT
2355 // machine-independent root to machine-dependent root
2356 void Matcher::dump_old2new_map() {
2357 _old2new_map.dump();
2358 }
2359 #endif
2360
2361 //---------------------------collect_null_checks-------------------------------
2362 // Find null checks in the ideal graph; write a machine-specific node for
2363 // it. Used by later implicit-null-check handling. Actually collects
2364 // either an IfTrue or IfFalse for the common NOT-null path, AND the ideal
2365 // value being tested.
2366 void Matcher::collect_null_checks( Node *proj, Node *orig_proj ) {
2367 Node *iff = proj->in(0);
2368 if( iff->Opcode() == Op_If ) {
|