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/intrinsicnode.hpp"
|
|
27 |
#include "opto/memnode.hpp"
|
|
28 |
#include "opto/phaseX.hpp"
|
|
29 |
|
|
30 |
//=============================================================================
|
|
31 |
// Do not match memory edge.
|
|
32 |
uint StrIntrinsicNode::match_edge(uint idx) const {
|
|
33 |
return idx == 2 || idx == 3;
|
|
34 |
}
|
|
35 |
|
|
36 |
//------------------------------Ideal------------------------------------------
|
|
37 |
// Return a node which is more "ideal" than the current node. Strip out
|
|
38 |
// control copies
|
|
39 |
Node *StrIntrinsicNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
|
40 |
if (remove_dead_region(phase, can_reshape)) return this;
|
|
41 |
// Don't bother trying to transform a dead node
|
|
42 |
if (in(0) && in(0)->is_top()) return NULL;
|
|
43 |
|
|
44 |
if (can_reshape) {
|
|
45 |
Node* mem = phase->transform(in(MemNode::Memory));
|
|
46 |
// If transformed to a MergeMem, get the desired slice
|
|
47 |
uint alias_idx = phase->C->get_alias_index(adr_type());
|
|
48 |
mem = mem->is_MergeMem() ? mem->as_MergeMem()->memory_at(alias_idx) : mem;
|
|
49 |
if (mem != in(MemNode::Memory)) {
|
|
50 |
set_req(MemNode::Memory, mem);
|
|
51 |
return this;
|
|
52 |
}
|
|
53 |
}
|
|
54 |
return NULL;
|
|
55 |
}
|
|
56 |
|
|
57 |
//------------------------------Value------------------------------------------
|
|
58 |
const Type *StrIntrinsicNode::Value( PhaseTransform *phase ) const {
|
|
59 |
if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
|
|
60 |
return bottom_type();
|
|
61 |
}
|
|
62 |
|
|
63 |
//=============================================================================
|
|
64 |
//------------------------------match_edge-------------------------------------
|
|
65 |
// Do not match memory edge
|
|
66 |
uint EncodeISOArrayNode::match_edge(uint idx) const {
|
|
67 |
return idx == 2 || idx == 3; // EncodeISOArray src (Binary dst len)
|
|
68 |
}
|
|
69 |
|
|
70 |
//------------------------------Ideal------------------------------------------
|
|
71 |
// Return a node which is more "ideal" than the current node. Strip out
|
|
72 |
// control copies
|
|
73 |
Node *EncodeISOArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
|
74 |
return remove_dead_region(phase, can_reshape) ? this : NULL;
|
|
75 |
}
|
|
76 |
|
|
77 |
//------------------------------Value------------------------------------------
|
|
78 |
const Type *EncodeISOArrayNode::Value(PhaseTransform *phase) const {
|
|
79 |
if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
|
|
80 |
return bottom_type();
|
|
81 |
}
|
|
82 |
|