Path: blob/master/runtime/compiler/z/codegen/InMemoryLoadStoreMarking.hpp
6004 views
/*******************************************************************************1* Copyright (c) 2000, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#ifndef IN_MEM_LOAD_STORE_MARK_INCL23#define IN_MEM_LOAD_STORE_MARK_INCL2425#include "codegen/CodeGenerator.hpp"26#include "compile/Compilation.hpp"27#include "env/TRMemory.hpp"28#include "il/Node.hpp"29#include "infra/List.hpp"3031namespace TR { class TreeTop; }3233class InMemoryLoadStoreMarking34{35public:36TR_ALLOC(TR_Memory::CodeGenerator);37InMemoryLoadStoreMarking(TR::CodeGenerator* cg): cg(cg),38_BCDAggrLoadList(cg->comp()->trMemory()),39_BCDAggrStoreList(cg->comp()->trMemory()),40_BCDConditionalCleanLoadList(cg->comp()->trMemory())41{42_comp = cg->comp();43}4445void perform();4647private:4849TR::CodeGenerator * cg;50TR::Compilation *_comp;51List<TR::Node> _BCDAggrLoadList;52List<TR::Node> _BCDAggrStoreList;5354// _BCDConditionalCleanLoadList contains the commoned BCD load nodes that can have skipCopyOnLoad set on55// them under these particular conditions:56//57// pdstore "a" clean58// pdload "a"59//60// =>pdload "a"61//62// Can set skipCopyOnLoad on pdload "a" iff all commoned references have parents who do not rely63// on a clean sign (other cleans, setsign, pd arith etc)...64// Any stores aliased to "a" are explicitly checking for perfect overlap (a 'must' vs a 'may' alias)6566List<TR::Node> _BCDConditionalCleanLoadList;6768// NOTE: update _TR_NodeListTypeNames when adding new node list types69enum TR_NodeListTypes70{71LoadList = 0,72ConditionalCleanLoadList = 1,73StoreList = 2,74NodeList_NumTypes,75UnknownNodeList = NodeList_NumTypes76};7778TR::Compilation *comp() { return _comp; }7980void examineFirstReference(TR::Node *node, TR::TreeTop *tt);81void examineCommonedReference(TR::Node *child, TR::Node *parent, TR::TreeTop *tt);82bool isConditionalCleanLoad(TR::Node *listNode, TR::Node *defNode);83void addToConditionalCleanLoadList(TR::Node *listNode);84void refineConditionalCleanLoadList(TR::Node *child, TR::Node *parent);85void handleLoadLastReference(TR::Node *node, List<TR::Node> &nodeList, TR_NodeListTypes listType);86void processBCDAggrNodeList(List<TR::Node> &nodeList, TR::Node *defNode, TR_NodeListTypes listType);87void handleDef(TR::Node*, TR::TreeTop*);88void visitChildren(TR::Node*, TR::TreeTop*, vcount_t);89bool allListsAreEmpty();90void clearAllLists();91void clearLoadLists();9293static char *getName(TR_NodeListTypes s)94{95if (s < NodeList_NumTypes)96return _TR_NodeListTypeNames[s];97else98return (char*)"UnknownNodeListType";99}100101static char *_TR_NodeListTypeNames[NodeList_NumTypes];102};103104#endif105106107