< prev index next >

src/share/vm/opto/matcher.cpp

Print this page




1628 // the recursion here.  After building the MachNode, we need to recurse
1629 // the tree checking for these cases:
1630 // (1) Child is an instruction -
1631 //     Build the instruction (recursively), add it as an edge.
1632 //     Build a simple operand (register) to hold the result of the instruction.
1633 // (2) Child is an interior part of an instruction -
1634 //     Skip over it (do nothing)
1635 // (3) Child is the start of a operand -
1636 //     Build the operand, place it inside the instruction
1637 //     Call ReduceOper.
1638 MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
1639   assert( rule >= NUM_OPERANDS, "called with operand rule" );
1640 
1641   MachNode* shared_node = find_shared_node(s->_leaf, rule);
1642   if (shared_node != NULL) {
1643     return shared_node;
1644   }
1645 
1646   // Build the object to represent this state & prepare for recursive calls
1647   MachNode *mach = s->MachNodeGenerator(rule);

1648   mach->_opnds[0] = s->MachOperGenerator(_reduceOp[rule]);
1649   assert( mach->_opnds[0] != NULL, "Missing result operand" );
1650   Node *leaf = s->_leaf;
1651   // Check for instruction or instruction chain rule
1652   if( rule >= _END_INST_CHAIN_RULE || rule < _BEGIN_INST_CHAIN_RULE ) {
1653     assert(C->node_arena()->contains(s->_leaf) || !has_new_node(s->_leaf),
1654            "duplicating node that's already been matched");
1655     // Instruction
1656     mach->add_req( leaf->in(0) ); // Set initial control
1657     // Reduce interior of complex instruction
1658     ReduceInst_Interior( s, rule, mem, mach, 1 );
1659   } else {
1660     // Instruction chain rules are data-dependent on their inputs
1661     mach->add_req(0);             // Set initial control to none
1662     ReduceInst_Chain_Rule( s, rule, mem, mach );
1663   }
1664 
1665   // If a Memory was used, insert a Memory edge
1666   if( mem != (Node*)1 ) {
1667     mach->ins_req(MemNode::Memory,mem);




1628 // the recursion here.  After building the MachNode, we need to recurse
1629 // the tree checking for these cases:
1630 // (1) Child is an instruction -
1631 //     Build the instruction (recursively), add it as an edge.
1632 //     Build a simple operand (register) to hold the result of the instruction.
1633 // (2) Child is an interior part of an instruction -
1634 //     Skip over it (do nothing)
1635 // (3) Child is the start of a operand -
1636 //     Build the operand, place it inside the instruction
1637 //     Call ReduceOper.
1638 MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
1639   assert( rule >= NUM_OPERANDS, "called with operand rule" );
1640 
1641   MachNode* shared_node = find_shared_node(s->_leaf, rule);
1642   if (shared_node != NULL) {
1643     return shared_node;
1644   }
1645 
1646   // Build the object to represent this state & prepare for recursive calls
1647   MachNode *mach = s->MachNodeGenerator(rule);
1648   guarantee(mach != NULL, "Missing MachNode");
1649   mach->_opnds[0] = s->MachOperGenerator(_reduceOp[rule]);
1650   assert( mach->_opnds[0] != NULL, "Missing result operand" );
1651   Node *leaf = s->_leaf;
1652   // Check for instruction or instruction chain rule
1653   if( rule >= _END_INST_CHAIN_RULE || rule < _BEGIN_INST_CHAIN_RULE ) {
1654     assert(C->node_arena()->contains(s->_leaf) || !has_new_node(s->_leaf),
1655            "duplicating node that's already been matched");
1656     // Instruction
1657     mach->add_req( leaf->in(0) ); // Set initial control
1658     // Reduce interior of complex instruction
1659     ReduceInst_Interior( s, rule, mem, mach, 1 );
1660   } else {
1661     // Instruction chain rules are data-dependent on their inputs
1662     mach->add_req(0);             // Set initial control to none
1663     ReduceInst_Chain_Rule( s, rule, mem, mach );
1664   }
1665 
1666   // If a Memory was used, insert a Memory edge
1667   if( mem != (Node*)1 ) {
1668     mach->ins_req(MemNode::Memory,mem);


< prev index next >