author | jcbeyler |
Thu, 28 Mar 2019 11:06:00 -0700 | |
changeset 54327 | a4d19817609c |
parent 49487 | bde392011cd8 |
permissions | -rw-r--r-- |
23528 | 1 |
/* |
2 |
* Copyright (c) 2014, 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 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
26 |
#include "opto/opaquenode.hpp" |
|
27 |
#include "opto/phaseX.hpp" |
|
28 |
||
29 |
//============================================================================= |
|
30 |
// Do not allow value-numbering |
|
31 |
uint Opaque1Node::hash() const { return NO_HASH; } |
|
54327 | 32 |
bool Opaque1Node::cmp( const Node &n ) const { |
23528 | 33 |
return (&n == this); // Always fail except on self |
34 |
} |
|
35 |
||
36 |
//------------------------------Identity--------------------------------------- |
|
37 |
// If _major_progress, then more loop optimizations follow. Do NOT remove |
|
38 |
// the opaque Node until no more loop ops can happen. Note the timing of |
|
39 |
// _major_progress; it's set in the major loop optimizations THEN comes the |
|
40 |
// call to IterGVN and any chance of hitting this code. Hence there's no |
|
41 |
// phase-ordering problem with stripping Opaque1 in IGVN followed by some |
|
42 |
// more loop optimizations that require it. |
|
35551
36ef3841fb34
8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents:
28912
diff
changeset
|
43 |
Node* Opaque1Node::Identity(PhaseGVN* phase) { |
23528 | 44 |
return phase->C->major_progress() ? this : in(1); |
45 |
} |
|
46 |
||
47 |
//============================================================================= |
|
48 |
// A node to prevent unwanted optimizations. Allows constant folding. Stops |
|
49 |
// value-numbering, most Ideal calls or Identity functions. This Node is |
|
50 |
// specifically designed to prevent the pre-increment value of a loop trip |
|
51 |
// counter from being live out of the bottom of the loop (hence causing the |
|
52 |
// pre- and post-increment values both being live and thus requiring an extra |
|
53 |
// temp register and an extra move). If we "accidentally" optimize through |
|
54 |
// this kind of a Node, we'll get slightly pessimal, but correct, code. Thus |
|
55 |
// it's OK to be slightly sloppy on optimizations here. |
|
56 |
||
57 |
// Do not allow value-numbering |
|
58 |
uint Opaque2Node::hash() const { return NO_HASH; } |
|
54327 | 59 |
bool Opaque2Node::cmp( const Node &n ) const { |
23528 | 60 |
return (&n == this); // Always fail except on self |
61 |
} |
|
62 |
||
46525
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
35551
diff
changeset
|
63 |
const Type* Opaque4Node::Value(PhaseGVN* phase) const { |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
35551
diff
changeset
|
64 |
return phase->type(in(1)); |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
35551
diff
changeset
|
65 |
} |
3a5c833a43de
8176506: C2: loop unswitching and unsafe accesses cause crash
roland
parents:
35551
diff
changeset
|
66 |
|
28912
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
67 |
//============================================================================= |
23528 | 68 |
|
28912
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
69 |
uint ProfileBooleanNode::hash() const { return NO_HASH; } |
54327 | 70 |
bool ProfileBooleanNode::cmp( const Node &n ) const { |
28912
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
71 |
return (&n == this); |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
72 |
} |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
73 |
|
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
74 |
Node *ProfileBooleanNode::Ideal(PhaseGVN *phase, bool can_reshape) { |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
75 |
if (can_reshape && _delay_removal) { |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
76 |
_delay_removal = false; |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
77 |
return this; |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
78 |
} else { |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
79 |
return NULL; |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
80 |
} |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
81 |
} |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
82 |
|
35551
36ef3841fb34
8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents:
28912
diff
changeset
|
83 |
Node* ProfileBooleanNode::Identity(PhaseGVN* phase) { |
28912
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
84 |
if (_delay_removal) { |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
85 |
return this; |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
86 |
} else { |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
87 |
assert(_consumed, "profile should be consumed before elimination"); |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
88 |
return in(1); |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
89 |
} |
27fac2f8fdbe
8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
vlivanov
parents:
23528
diff
changeset
|
90 |
} |