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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "libadt/vectset.hpp"
27 #include "memory/allocation.inline.hpp"
28 #include "opto/block.hpp"
29 #include "opto/cfgnode.hpp"
30 #include "opto/chaitin.hpp"
31 #include "opto/loopnode.hpp"
32 #include "opto/machnode.hpp"
33 #include "opto/matcher.hpp"
34 #include "opto/opcodes.hpp"
35 #include "opto/rootnode.hpp"
36 #include "utilities/copy.hpp"
37
38 void Block_Array::grow( uint i ) {
39 assert(i >= Max(), "must be an overflow");
40 debug_only(_limit = i+1);
41 if( i < _size ) return;
42 if( !_size ) {
43 _size = 1;
44 _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) );
45 _blocks[0] = NULL;
46 }
47 uint old = _size;
348
349 void Block::dump(const PhaseCFG* cfg) const {
350 dump_head(cfg);
351 for (uint i=0; i< number_of_nodes(); i++) {
352 get_node(i)->dump();
353 }
354 tty->print("\n");
355 }
356 #endif
357
358 PhaseCFG::PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher)
359 : Phase(CFG)
360 , _block_arena(arena)
361 , _regalloc(NULL)
362 , _scheduling_for_pressure(false)
363 , _root(root)
364 , _matcher(matcher)
365 , _node_to_block_mapping(arena)
366 , _node_latency(NULL)
367 #ifndef PRODUCT
368 , _trace_opto_pipelining(TraceOptoPipelining || C->method_has_option("TraceOptoPipelining"))
369 #endif
370 #ifdef ASSERT
371 , _raw_oops(arena)
372 #endif
373 {
374 ResourceMark rm;
375 // I'll need a few machine-specific GotoNodes. Make an Ideal GotoNode,
376 // then Match it into a machine-specific Node. Then clone the machine
377 // Node on demand.
378 Node *x = new GotoNode(NULL);
379 x->init_req(0, x);
380 _goto = matcher.match_tree(x);
381 assert(_goto != NULL, "");
382 _goto->set_req(0,_goto);
383
384 // Build the CFG in Reverse Post Order
385 _number_of_blocks = build_cfg();
386 _root_block = get_block_for_node(_root);
387 }
388
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "libadt/vectset.hpp"
27 #include "memory/allocation.inline.hpp"
28 #include "compiler/compilerDirectives.hpp"
29 #include "opto/block.hpp"
30 #include "opto/cfgnode.hpp"
31 #include "opto/chaitin.hpp"
32 #include "opto/loopnode.hpp"
33 #include "opto/machnode.hpp"
34 #include "opto/matcher.hpp"
35 #include "opto/opcodes.hpp"
36 #include "opto/rootnode.hpp"
37 #include "utilities/copy.hpp"
38
39 void Block_Array::grow( uint i ) {
40 assert(i >= Max(), "must be an overflow");
41 debug_only(_limit = i+1);
42 if( i < _size ) return;
43 if( !_size ) {
44 _size = 1;
45 _blocks = (Block**)_arena->Amalloc( _size * sizeof(Block*) );
46 _blocks[0] = NULL;
47 }
48 uint old = _size;
349
350 void Block::dump(const PhaseCFG* cfg) const {
351 dump_head(cfg);
352 for (uint i=0; i< number_of_nodes(); i++) {
353 get_node(i)->dump();
354 }
355 tty->print("\n");
356 }
357 #endif
358
359 PhaseCFG::PhaseCFG(Arena* arena, RootNode* root, Matcher& matcher)
360 : Phase(CFG)
361 , _block_arena(arena)
362 , _regalloc(NULL)
363 , _scheduling_for_pressure(false)
364 , _root(root)
365 , _matcher(matcher)
366 , _node_to_block_mapping(arena)
367 , _node_latency(NULL)
368 #ifndef PRODUCT
369 , _trace_opto_pipelining(C->dirset()->TraceOptoPipeliningOption)
370 #endif
371 #ifdef ASSERT
372 , _raw_oops(arena)
373 #endif
374 {
375 ResourceMark rm;
376 // I'll need a few machine-specific GotoNodes. Make an Ideal GotoNode,
377 // then Match it into a machine-specific Node. Then clone the machine
378 // Node on demand.
379 Node *x = new GotoNode(NULL);
380 x->init_req(0, x);
381 _goto = matcher.match_tree(x);
382 assert(_goto != NULL, "");
383 _goto->set_req(0,_goto);
384
385 // Build the CFG in Reverse Post Order
386 _number_of_blocks = build_cfg();
387 _root_block = get_block_for_node(_root);
388 }
389
|