Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/z/codegen/InMemoryLoadStoreMarking.hpp
6004 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#ifndef IN_MEM_LOAD_STORE_MARK_INCL
24
#define IN_MEM_LOAD_STORE_MARK_INCL
25
26
#include "codegen/CodeGenerator.hpp"
27
#include "compile/Compilation.hpp"
28
#include "env/TRMemory.hpp"
29
#include "il/Node.hpp"
30
#include "infra/List.hpp"
31
32
namespace TR { class TreeTop; }
33
34
class InMemoryLoadStoreMarking
35
{
36
public:
37
TR_ALLOC(TR_Memory::CodeGenerator);
38
InMemoryLoadStoreMarking(TR::CodeGenerator* cg): cg(cg),
39
_BCDAggrLoadList(cg->comp()->trMemory()),
40
_BCDAggrStoreList(cg->comp()->trMemory()),
41
_BCDConditionalCleanLoadList(cg->comp()->trMemory())
42
{
43
_comp = cg->comp();
44
}
45
46
void perform();
47
48
private:
49
50
TR::CodeGenerator * cg;
51
TR::Compilation *_comp;
52
List<TR::Node> _BCDAggrLoadList;
53
List<TR::Node> _BCDAggrStoreList;
54
55
// _BCDConditionalCleanLoadList contains the commoned BCD load nodes that can have skipCopyOnLoad set on
56
// them under these particular conditions:
57
//
58
// pdstore "a" clean
59
// pdload "a"
60
//
61
// =>pdload "a"
62
//
63
// Can set skipCopyOnLoad on pdload "a" iff all commoned references have parents who do not rely
64
// on a clean sign (other cleans, setsign, pd arith etc)...
65
// Any stores aliased to "a" are explicitly checking for perfect overlap (a 'must' vs a 'may' alias)
66
67
List<TR::Node> _BCDConditionalCleanLoadList;
68
69
// NOTE: update _TR_NodeListTypeNames when adding new node list types
70
enum TR_NodeListTypes
71
{
72
LoadList = 0,
73
ConditionalCleanLoadList = 1,
74
StoreList = 2,
75
NodeList_NumTypes,
76
UnknownNodeList = NodeList_NumTypes
77
};
78
79
TR::Compilation *comp() { return _comp; }
80
81
void examineFirstReference(TR::Node *node, TR::TreeTop *tt);
82
void examineCommonedReference(TR::Node *child, TR::Node *parent, TR::TreeTop *tt);
83
bool isConditionalCleanLoad(TR::Node *listNode, TR::Node *defNode);
84
void addToConditionalCleanLoadList(TR::Node *listNode);
85
void refineConditionalCleanLoadList(TR::Node *child, TR::Node *parent);
86
void handleLoadLastReference(TR::Node *node, List<TR::Node> &nodeList, TR_NodeListTypes listType);
87
void processBCDAggrNodeList(List<TR::Node> &nodeList, TR::Node *defNode, TR_NodeListTypes listType);
88
void handleDef(TR::Node*, TR::TreeTop*);
89
void visitChildren(TR::Node*, TR::TreeTop*, vcount_t);
90
bool allListsAreEmpty();
91
void clearAllLists();
92
void clearLoadLists();
93
94
static char *getName(TR_NodeListTypes s)
95
{
96
if (s < NodeList_NumTypes)
97
return _TR_NodeListTypeNames[s];
98
else
99
return (char*)"UnknownNodeListType";
100
}
101
102
static char *_TR_NodeListTypeNames[NodeList_NumTypes];
103
};
104
105
#endif
106
107