-
Notifications
You must be signed in to change notification settings - Fork 747
/
Copy pathJ9Simplifier.hpp
105 lines (84 loc) · 4.21 KB
/
J9Simplifier.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*******************************************************************************
* Copyright IBM Corp. and others 2000
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
#ifndef J9_SIMPLIFIER_INCL
#define J9_SIMPLIFIER_INCL
#include "optimizer/OMRSimplifier.hpp"
namespace J9
{
class Simplifier : public OMR::Simplifier
{
public:
Simplifier(TR::OptimizationManager *manager) : OMR::Simplifier(manager)
{}
virtual bool isLegalToUnaryCancel(TR::Node *node, TR::Node *firstChild, TR::ILOpCodes opcode);
virtual TR::Node *unaryCancelOutWithChild(TR::Node * node, TR::Node * firstChild, TR::TreeTop* anchorTree, TR::ILOpCodes opcode, bool anchorChildren=true);
virtual bool isLegalToFold(TR::Node *node, TR::Node *firstChild);
virtual bool isBoundDefinitelyGELength(TR::Node *boundChild, TR::Node *lengthChild);
virtual TR::Node *simplifyiCallMethods(TR::Node * node, TR::Block * block);
virtual TR::Node *simplifylCallMethods(TR::Node * node, TR::Block * block);
virtual TR::Node *simplifyaCallMethods(TR::Node * node, TR::Block * block);
virtual TR::Node *simplifyiOrPatterns(TR::Node *node);
virtual TR::Node *simplifyi2sPatterns(TR::Node *node);
virtual TR::Node *simplifyd2fPatterns(TR::Node *node);
virtual TR::Node *simplifyIndirectLoadPatterns(TR::Node *node);
virtual void setNodePrecisionIfNeeded(TR::Node *baseNode, TR::Node *node, TR::NodeChecklist& visited);
private:
bool isRecognizedPowMethod(TR::Node *node);
bool isRecognizedAbsMethod(TR::Node *node);
/**
* \brief Checks whether this node represents a call to the value
* comparison non-helper
* \param node Call node to check
* \param nonHelperSymbol The value comparison non-helper symbol, if
* that is what this node represents
* \return \c true if \c node is a call to the value
* comparison non-helper;
* \c false, otherwise.
*/
bool isRecognizedObjectComparisonNonHelper(TR::Node *node, TR::SymbolReferenceTable::CommonNonhelperSymbol &nonHelperSymbol);
TR::Node *getUnsafeIorByteChild(TR::Node * child, TR::ILOpCodes b2iOpCode, int32_t mulConst);
TR::Node *getLastUnsafeIorByteChild(TR::Node * child);
TR::Node *getArrayByteChildWithMultiplier(TR::Node * child, TR::ILOpCodes b2iOpCode, int32_t mulConst);
TR::Node *getLastArrayByteChild(TR::Node * child);
TR::Node *getArrayBaseAddr(TR::Node * node);
TR::Node *getArrayOffset(TR::Node * node, int32_t isubConst);
TR::Node *getOrOfTwoConsecutiveBytes(TR::Node * ior);
TR::Node *foldAbs(TR::Node *node);
/*! \brief Convert System.currentTimeMillis() into currentTimeMaxPrecision
*
* \param node The "System.currentTimeMillis()" lcall node
* \param block The corresponding basic block
*
* \return Node that points to the transformed subtree
*/
TR::Node *convertCurrentTimeMillis(TR::Node * node, TR::Block * block);
/*! \brief Convert System.nanoTime() into currentTimeMaxPrecision
*
* \param node The "System.nanoTime" lcall node
* \param block The corresponding basic block
*
* \return Node that points to the transformed subtree
*/
TR::Node *convertNanoTime(TR::Node * node, TR::Block * block);
};
}
#endif