1 /*
2 * Copyright (c) 1997, 2013, 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 *
400 PhaseGVN( PhaseGVN *gvn, const char *dummy ) : PhaseValues( gvn, dummy ) {}
401
402 // Return a node which computes the same function as this node, but
403 // in a faster or cheaper fashion.
404 Node *transform( Node *n );
405 Node *transform_no_reclaim( Node *n );
406
407 void replace_with(PhaseGVN* gvn) {
408 _table.replace_with(&gvn->_table);
409 _types = gvn->_types;
410 }
411
412 // Check for a simple dead loop when a data node references itself.
413 DEBUG_ONLY(void dead_loop_check(Node *n);)
414 };
415
416 //------------------------------PhaseIterGVN-----------------------------------
417 // Phase for iteratively performing local, pessimistic GVN-style optimizations.
418 // and ideal transformations on the graph.
419 class PhaseIterGVN : public PhaseGVN {
420 private:
421 bool _delay_transform; // When true simply register the node when calling transform
422 // instead of actually optimizing it
423
424 // Idealize old Node 'n' with respect to its inputs and its value
425 virtual Node *transform_old( Node *a_node );
426
427 // Subsume users of node 'old' into node 'nn'
428 void subsume_node( Node *old, Node *nn );
429
430 Node_Stack _stack; // Stack used to avoid recursion
431
432 protected:
433
434 // Idealize new Node 'n' with respect to its inputs and its value
435 virtual Node *transform( Node *a_node );
436
437 // Warm up hash table, type table and initial worklist
438 void init_worklist( Node *a_root );
439
440 virtual const Type* saturate(const Type* new_type, const Type* old_type,
|
1 /*
2 * Copyright (c) 1997, 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 *
400 PhaseGVN( PhaseGVN *gvn, const char *dummy ) : PhaseValues( gvn, dummy ) {}
401
402 // Return a node which computes the same function as this node, but
403 // in a faster or cheaper fashion.
404 Node *transform( Node *n );
405 Node *transform_no_reclaim( Node *n );
406
407 void replace_with(PhaseGVN* gvn) {
408 _table.replace_with(&gvn->_table);
409 _types = gvn->_types;
410 }
411
412 // Check for a simple dead loop when a data node references itself.
413 DEBUG_ONLY(void dead_loop_check(Node *n);)
414 };
415
416 //------------------------------PhaseIterGVN-----------------------------------
417 // Phase for iteratively performing local, pessimistic GVN-style optimizations.
418 // and ideal transformations on the graph.
419 class PhaseIterGVN : public PhaseGVN {
420 private:
421 bool _delay_transform; // When true simply register the node when calling transform
422 // instead of actually optimizing it
423
424 // Idealize old Node 'n' with respect to its inputs and its value
425 virtual Node *transform_old( Node *a_node );
426
427 // Subsume users of node 'old' into node 'nn'
428 void subsume_node( Node *old, Node *nn );
429
430 Node_Stack _stack; // Stack used to avoid recursion
431
432 protected:
433
434 // Idealize new Node 'n' with respect to its inputs and its value
435 virtual Node *transform( Node *a_node );
436
437 // Warm up hash table, type table and initial worklist
438 void init_worklist( Node *a_root );
439
440 virtual const Type* saturate(const Type* new_type, const Type* old_type,
|