本文整理汇总了C++中tr::Node::getSymbolReference方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::getSymbolReference方法的具体用法?C++ Node::getSymbolReference怎么用?C++ Node::getSymbolReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tr::Node
的用法示例。
在下文中一共展示了Node::getSymbolReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
TR::Node *TR_OutlinedInstructions::createOutlinedCallNode(TR::Node *callNode, TR::ILOpCodes callOp)
{
int32_t i;
TR::Node *child;
//We pass true for getSymbolReference because
TR::Node *newCallNode = TR::Node::createWithSymRef(callNode, callOp, callNode->getNumChildren(), callNode->getSymbolReference());
newCallNode->setReferenceCount(1);
for (i=0; i<callNode->getNumChildren(); i++)
{
child = callNode->getChild(i);
if (child->getRegister() != NULL)
{
// Child has already been evaluated outside this tree.
//
newCallNode->setAndIncChild(i, child);
}
else if (child->getOpCode().isLoadConst())
{
// Copy unevaluated constant nodes.
//
child = TR::Node::copy(child);
child->setReferenceCount(1);
newCallNode->setChild(i, child);
}
else
{
if ((child->getOpCodeValue() == TR::loadaddr) &&
/*(callNode->getOpCodeValue() == TR::instanceof || callNode->getOpCodeValue() == TR::checkcast || callNode->getOpCodeValue() == TR::checkcastAndNULLCHK || callNode->getOpCodeValue() == TR::New || callNode->getOpCodeValue() == TR::anewarray) &&*/
(child->getSymbolReference()->getSymbol()) &&
(child->getSymbolReference()->getSymbol()->getStaticSymbol()))
{
child = TR::Node::copy(child);
child->setReferenceCount(1);
newCallNode->setChild(i, child);
}
else
{
// Be very conservative at this point, even though it is possible to make it less so. For example, this will catch
// the case of an unevaluated argument not persisting outside of the outlined region even though one of its subtrees will.
//
(void)_cg->evaluate(child);
// Do not decrement the reference count here. It will be decremented when the call node is evaluated
// again in the helper instruction stream.
//
newCallNode->setAndIncChild(i, child);
}
}
}
if(callNode->isPreparedForDirectJNI())
{
newCallNode->setPreparedForDirectJNI();
}
return newCallNode;
}
示例2:
// resolved casts that are not to abstract, interface, or array need a super test
bool OMR::TreeEvaluator::instanceOfOrCheckCastNeedSuperTest(TR::Node * node, TR::CodeGenerator *cg)
{
TR::Node *castClassNode = node->getSecondChild();
TR::MethodSymbol *helperSym = node->getSymbol()->castToMethodSymbol();
TR::SymbolReference *castClassSymRef = castClassNode->getSymbolReference();
if (!TR::TreeEvaluator::isStaticClassSymRef(castClassSymRef))
{
// We could theoretically do a super test on something with no sym, but it would require significant
// changes to platform code. The benefit is little at this point (shows up from reference arraycopy reductions)
if (cg->supportsInliningOfIsInstance() &&
node->getOpCodeValue() == TR::instanceof &&
node->getSecondChild()->getOpCodeValue() != TR::loadaddr)
return true;
else
return false;
}
TR::StaticSymbol *castClassSym = castClassSymRef->getSymbol()->getStaticSymbol();
if (castClassSymRef->isUnresolved())
{
return false;
}
else
{
TR_OpaqueClassBlock * clazz;
// If the class is a regular class (i.e., not an interface nor an array) and
// not known to be a final class, an inline superclass test can be generated.
// If the helper does not preserve all the registers there will not be
// enough registers to do the superclass test inline.
// Also, don't generate the superclass test if optimizing for space.
//
if (castClassSym &&
(clazz = (TR_OpaqueClassBlock *) castClassSym->getStaticAddress()) &&
!TR::Compiler->cls.isClassArray(cg->comp(), clazz) &&
!TR::Compiler->cls.isInterfaceClass(cg->comp(), clazz) &&
!TR::Compiler->cls.isClassFinal(cg->comp(), clazz) &&
helperSym->preservesAllRegisters() &&
!cg->comp()->getOption(TR_OptimizeForSpace))
return true;
}
return false;
}
示例3: return
int32_t TR_LocalAnalysisInfo::HashTable::hash(TR::Node *node)
{
// Hash on the opcode and value numbers of the children
//
uint32_t h, g;
int32_t numChildren = node->getNumChildren();
h = (node->getOpCodeValue() << 4) + numChildren;
g = 0;
for (int32_t i = numChildren-1; i >= 0; i--)
{
TR::Node *child = node->getChild(i);
h <<= 4;
if (child->getOpCode().hasSymbolReference())
h += (int32_t)(intptrj_t)child->getSymbolReference()->getSymbol();
else
h++;
g = h & 0xF0000000;
h ^= g >> 24;
}
return (h ^ g) % _numBuckets;
}
示例4: tranformSummationReductionCandidate
bool TR_ExpressionsSimplification::tranformSummationReductionCandidate(TR::TreeTop *treeTop, LoopInfo *loopInfo, bool *isPreheaderBlockInvalid)
{
TR::Node *node = treeTop->getNode();
TR::Node *opNode = node->getFirstChild();
TR::Node *expNode = NULL;
int32_t expChildNumber = 0;
bool removeOnly = false;
bool replaceWithNewNode = false;
if (opNode->getOpCodeValue() == TR::iadd || opNode->getOpCodeValue() == TR::isub)
{
if (opNode->getSecondChild()->getOpCode().hasSymbolReference() &&
node->getSymbolReference() == opNode->getSecondChild()->getSymbolReference())
{
expChildNumber = 0;
expNode = opNode->getFirstChild();
}
else
{
expChildNumber = 1;
expNode = opNode->getSecondChild();
}
expNode = iaddisubSimplifier(expNode, loopInfo);
replaceWithNewNode = true;
}
else if (opNode->getOpCodeValue() == TR::ixor || opNode->getOpCodeValue() == TR::ineg)
{
expNode = ixorinegSimplifier(opNode, loopInfo, &removeOnly);
}
if (expNode)
{
if (trace())
comp()->getDebug()->print(comp()->getOutFile(), expNode, 0, true);
TR::Block *entryBlock = _currentRegion->getEntryBlock();
TR::Block *preheaderBlock = findPredecessorBlock(entryBlock);
if (!preheaderBlock)
{
if (trace())
traceMsg(comp(), "Fail to find a place to put the hoist code in\n");
*isPreheaderBlockInvalid = true;
return true;
}
if (loopInfo->getNumIterations() > 0 || // make sure that the loop is going to be executed at least once
_currentRegion->isCanonicalizedLoop()) // or that the loop is canonicalized, in which case the preheader is
{ // executed in its first iteration and is protected.
if (performTransformation(comp(), "%sMove out loop-invariant node [%p] to block_%d\n", OPT_DETAILS, node, preheaderBlock->getNumber()))
{
if (!(removeOnly))
{
TR::Node *newNode = node->duplicateTree();
if (replaceWithNewNode)
newNode->getFirstChild()->setAndIncChild(expChildNumber, expNode);
transformNode(newNode, preheaderBlock);
}
TR::TransformUtil::removeTree(comp(), treeTop);
}
}
}
return (expNode != NULL);
}
示例5: stackRegion
int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *endTree)
{
TR::StackMemoryRegion stackRegion(*comp()->trMemory());
LongestPathMap longestPaths(std::less<TR::Node*>(), stackRegion);
typedef TR::typed_allocator<CRAnchor, TR::Region&> CRAnchorAlloc;
typedef TR::forward_list<CRAnchor, CRAnchorAlloc> CRAnchorList;
CRAnchorList anchors(stackRegion);
vcount_t visitCount = comp()->incOrResetVisitCount();
TR::TreeTop *treeTop;
for (treeTop = startTree; (treeTop != endTree); treeTop = treeTop->getNextTreeTop())
treeTop->getNode()->initializeFutureUseCounts(visitCount);
TR::Block *block = NULL;
bool delayedRegStoresBeforeThisPass = _delayedRegStores;
// Update visitCount as they are used in this optimization and need to be
visitCount = comp()->incOrResetVisitCount();
for (TR::TreeTopIterator iter(startTree, comp()); iter != endTree; ++iter)
{
TR::Node *node = iter.currentTree()->getNode();
if (node->getOpCodeValue() == TR::BBStart)
{
block = node->getBlock();
if (!block->isExtensionOfPreviousBlock())
longestPaths.clear();
}
int vcountLimit = MAX_VCOUNT - 3;
if (comp()->getVisitCount() > vcountLimit)
{
dumpOptDetails(comp(),
"%sVisit count %d exceeds limit %d; stopping\n",
optDetailString(), comp()->getVisitCount(), vcountLimit);
return 0;
}
// correct at all intermediate stages
//
if ((node->getOpCodeValue() != TR::treetop) &&
(!node->getOpCode().isAnchor() || (node->getFirstChild()->getReferenceCount() != 1)) &&
(!node->getOpCode().isStoreReg() || (node->getFirstChild()->getReferenceCount() != 1)) &&
(delayedRegStoresBeforeThisPass ||
(iter.currentTree() == block->getLastRealTreeTop()) ||
!node->getOpCode().isStoreReg() ||
(node->getVisitCount() == visitCount)))
{
if (node->getOpCode().isAnchor() && node->getFirstChild()->getOpCode().isLoadIndirect())
anchors.push_front(CRAnchor(iter.currentTree(), block));
TR::TransformUtil::recursivelySetNodeVisitCount(node, visitCount);
continue;
}
if (node->getOpCode().isStoreReg())
_delayedRegStores = true;
TR::Node *child = node->getFirstChild();
if (child->getOpCodeValue() == TR::PassThrough)
{
TR::Node *newChild = child->getFirstChild();
node->setAndIncChild(0, newChild);
newChild->incFutureUseCount();
if (child->getReferenceCount() <= 1)
optimizer()->prepareForNodeRemoval(child);
child->recursivelyDecReferenceCount();
recursivelyDecFutureUseCount(child);
child = newChild;
}
bool treeTopCanBeEliminated = false;
// If the treetop child has been seen before then it must be anchored
// somewhere above already; so we don't need the treetop to be anchoring
// this node (as the computation is already done at the first reference to
// the node).
//
if (visitCount == child->getVisitCount())
{
treeTopCanBeEliminated = true;
}
else
{
TR::ILOpCode &childOpCode = child->getOpCode();
TR::ILOpCodes opCodeValue = childOpCode.getOpCodeValue();
bool seenConditionalBranch = false;
bool callWithNoSideEffects = child->getOpCode().isCall() &&
child->getSymbolReference()->getSymbol()->isResolvedMethod() &&
child->getSymbolReference()->getSymbol()->castToResolvedMethodSymbol()->isSideEffectFree();
if (callWithNoSideEffects)
{
treeTopCanBeEliminated = true;
}
else if (!((childOpCode.isCall() && !callWithNoSideEffects) ||
childOpCode.isStore() ||
//.........这里部分代码省略.........
示例6: if
void
TR_S390BinaryAnalyser::genericAnalyser(TR::Node * root,
TR::InstOpCode::Mnemonic regToRegOpCode,
TR::InstOpCode::Mnemonic memToRegOpCode,
TR::InstOpCode::Mnemonic copyOpCode)
{
TR::Node * firstChild;
TR::Node * secondChild;
firstChild = root->getFirstChild();
secondChild = root->getSecondChild();
TR::Register * firstRegister = firstChild->getRegister();
TR::Register * secondRegister = secondChild->getRegister();
TR::Compilation *comp = TR::comp();
TR::SymbolReference * firstReference = firstChild->getOpCode().hasSymbolReference() ? firstChild->getSymbolReference() : NULL;
TR::SymbolReference * secondReference = secondChild->getOpCode().hasSymbolReference() ? secondChild->getSymbolReference() : NULL;
setInputs(firstChild, firstRegister, secondChild, secondRegister,
false, false, comp,
(cg()->isAddressOfStaticSymRefWithLockedReg(firstReference) ||
cg()->isAddressOfPrivateStaticSymRefWithLockedReg(firstReference)),
(cg()->isAddressOfStaticSymRefWithLockedReg(secondReference) ||
cg()->isAddressOfPrivateStaticSymRefWithLockedReg(secondReference)));
/*
* Check if SH or CH can be used to evaluate this integer subtract/compare node.
* The second operand of SH/CH is a 16-bit number from memory. And using
* these directly can save a load instruction.
*/
bool is16BitMemory2Operand = false;
if (secondChild->getOpCodeValue() == TR::s2i &&
secondChild->getFirstChild()->getOpCodeValue() == TR::sloadi &&
secondChild->isSingleRefUnevaluated() &&
secondChild->getFirstChild()->isSingleRefUnevaluated())
{
bool supported = true;
if (memToRegOpCode == TR::InstOpCode::S)
{
memToRegOpCode = TR::InstOpCode::SH;
}
else if (memToRegOpCode == TR::InstOpCode::C)
{
memToRegOpCode = TR::InstOpCode::CH;
}
else
{
supported = false;
}
if (supported)
{
setMem2();
is16BitMemory2Operand = true;
}
}
if (getEvalChild1())
{
firstRegister = cg()->evaluate(firstChild);
}
if (getEvalChild2())
{
secondRegister = cg()->evaluate(secondChild);
}
remapInputs(firstChild, firstRegister, secondChild, secondRegister);
if (getCopyReg1())
{
TR::Register * thirdReg;
bool done = false;
if (firstRegister->getKind() == TR_GPR64)
{
thirdReg = cg()->allocate64bitRegister();
}
else if (firstRegister->getKind() == TR_VRF)
{
TR_ASSERT(false,"VRF: genericAnalyser unimplemented");
}
else if (firstRegister->getKind() != TR_FPR && firstRegister->getKind() != TR_VRF)
{
thirdReg = cg()->allocateRegister();
}
else
{
thirdReg = cg()->allocateRegister(TR_FPR);
}
if (cg()->getS390ProcessorInfo()->supportsArch(TR_S390ProcessorInfo::TR_z196))
{
if (getBinaryReg3Reg2() || secondRegister != NULL)
{
if (regToRegOpCode == TR::InstOpCode::SR)
{
generateRRRInstruction(cg(), TR::InstOpCode::SRK, root, thirdReg, firstRegister, secondRegister);
done = true;
}
//.........这里部分代码省略.........
示例7: isAnySymInDefinedOrUsedBy
// Returns true if there is any constraint to the move
bool TR_LocalLiveRangeReduction::isAnySymInDefinedOrUsedBy(TR_TreeRefInfo *currentTreeRefInfo, TR::Node *currentNode, TR_TreeRefInfo *movingTreeRefInfo )
{
TR::Node *movingNode = movingTreeRefInfo->getTreeTop()->getNode();
// ignore anchors
//
if (movingNode->getOpCode().isAnchor())
movingNode = movingNode->getFirstChild();
TR::ILOpCode &opCode = currentNode->getOpCode();
////if ((opCode.getOpCodeValue() == TR::monent) || (opCode.getOpCodeValue() == TR::monexit))
if (nodeMaybeMonitor(currentNode))
{
if (trace())
traceMsg(comp(),"cannot move %p beyond monitor %p\n",movingNode,currentNode);
return true;
}
// Don't move gc points or things across gc points
//
if (movingNode->canGCandReturn() ||
currentNode->canGCandReturn())
{
if (trace())
traceMsg(comp(), "cannot move gc points %p past %p\n", movingNode, currentNode);
return true;
}
// Don't move checks or calls at all
//
if (containsCallOrCheck(movingTreeRefInfo,movingNode))
{
if (trace())
traceMsg(comp(),"cannot move check or call %s\n", getDebug()->getName(movingNode));
return true;
}
// Don't move object header store past a GC point
//
if ((currentNode->getOpCode().isWrtBar() || currentNode->canCauseGC()) && mayBeObjectHeaderStore(movingNode, fe()))
{
if (trace())
traceMsg(comp(),"cannot move possible object header store %s past GC point %s\n", getDebug()->getName(movingNode), getDebug()->getName(currentNode));
return true;
}
if (TR::Compiler->target.cpu.isPower() && opCode.getOpCodeValue() == TR::allocationFence)
{
// Can't move allocations past flushes
if (movingNode->getOpCodeValue() == TR::treetop &&
movingNode->getFirstChild()->getOpCode().isNew() &&
(currentNode->getAllocation() == NULL ||
currentNode->getAllocation() == movingNode->getFirstChild()))
{
if (trace())
{
traceMsg(comp(),"cannot move %p beyond flush %p - ", movingNode, currentNode);
if (currentNode->getAllocation() == NULL)
traceMsg(comp(),"(flush with null allocation)\n");
else
traceMsg(comp(),"(flush for allocation %p)\n", currentNode->getAllocation());
}
return true;
}
// Can't move certain stores past flushes
// Exclude all indirect stores, they may be for stack allocs, in which case the flush is needed at least as a scheduling barrier
// Direct stores to autos and parms are the only safe candidates
if (movingNode->getOpCode().isStoreIndirect() ||
(movingNode->getOpCode().isStoreDirect() && !movingNode->getSymbol()->isParm() && !movingNode->getSymbol()->isAuto()))
{
if (trace())
traceMsg(comp(),"cannot move %p beyond flush %p - (flush for possible stack alloc)", movingNode, currentNode);
return true;
}
}
for (int32_t i = 0; i < currentNode->getNumChildren(); i++)
{
TR::Node *child = currentNode->getChild(i);
//Any node that has side effects (like call and newarrya) cannot be evaluated in the middle of the tree.
if (movingTreeRefInfo->getFirstRefNodesList()->find(child))
{
//for calls and unresolve symbol that are not under check
if (child->exceptionsRaised() ||
(child->getOpCode().hasSymbolReference() && child->getSymbolReference()->isUnresolved()))
{
if (trace())
traceMsg(comp(),"cannot move %p beyond %p - cannot change evaluation point of %p\n ",movingNode,currentTreeRefInfo->getTreeTop()->getNode(),child);
return true;
}
else if(movingNode->getOpCode().isStore())
{
TR::SymbolReference *stSymRef = movingNode->getSymbolReference();
int32_t stSymRefNum = stSymRef->getReferenceNumber();
//TR::SymbolReference *stSymRef = movingNode->getSymbolReference();
//.........这里部分代码省略.........
示例8: if
TR_BitVector *
addVeryRefinedCallAliasSets(TR::ResolvedMethodSymbol * methodSymbol, TR_BitVector * aliases, List<void> * methodsPeeked)
{
TR::Compilation *comp = TR::comp();
void * methodId = methodSymbol->getResolvedMethod()->getPersistentIdentifier();
if (methodsPeeked->find(methodId))
{
// This can't be allocated into the alias region as it must be accessed across optimizations
TR_BitVector *heapAliases = new (comp->trHeapMemory()) TR_BitVector(comp->getSymRefCount(), comp->trMemory(), heapAlloc, growable);
*heapAliases |= *aliases;
return heapAliases;
}
// stop if the peek is getting very deep
//
if (methodsPeeked->getSize() >= PEEK_THRESHOLD)
return 0;
methodsPeeked->add(methodId);
dumpOptDetails(comp, "O^O REFINING ALIASES: Peeking into the IL to refine aliases \n");
if (!methodSymbol->getResolvedMethod()->genMethodILForPeeking(methodSymbol, comp, true))
return 0;
TR::SymbolReferenceTable * symRefTab = comp->getSymRefTab();
for (TR::TreeTop * tt = methodSymbol->getFirstTreeTop(); tt; tt = tt->getNextTreeTop())
{
TR::Node *node = tt->getNode();
if (node->getOpCode().isResolveCheck())
return 0;
if ((node->getOpCodeValue() == TR::treetop) ||
(node->getOpCodeValue() == TR::compressedRefs) ||
node->getOpCode().isCheck())
node = node->getFirstChild();
if (node->getOpCode().isStore())
{
TR::SymbolReference * symRefInCallee = node->getSymbolReference(), * symRefInCaller;
TR::Symbol * symInCallee = symRefInCallee->getSymbol();
TR::DataType type = symInCallee->getDataType();
if (symInCallee->isShadow())
{
if (symInCallee->isArrayShadowSymbol())
symRefInCaller = symRefTab->getSymRef(symRefTab->getArrayShadowIndex(type));
else if (symInCallee->isArrayletShadowSymbol())
symRefInCaller = symRefTab->getSymRef(symRefTab->getArrayletShadowIndex(type));
else
symRefInCaller = symRefTab->findShadowSymbol(symRefInCallee->getOwningMethod(comp), symRefInCallee->getCPIndex(), type);
if (symRefInCaller)
{
if (symRefInCaller->reallySharesSymbol(comp))
symRefInCaller->setSharedShadowAliases(aliases, symRefTab);
aliases->set(symRefInCaller->getReferenceNumber());
}
}
else if (symInCallee->isStatic())
{
symRefInCaller = symRefTab->findStaticSymbol(symRefInCallee->getOwningMethod(comp), symRefInCallee->getCPIndex(), type);
if (symRefInCaller)
{
if (symRefInCaller->reallySharesSymbol(comp))
symRefInCaller->setSharedStaticAliases(aliases, symRefTab);
else
aliases->set(symRefInCaller->getReferenceNumber());
}
}
}
else if (node->getOpCode().isCall())
{
if (node->getOpCode().isCallIndirect())
return 0;
TR::ResolvedMethodSymbol * calleeSymbol = node->getSymbol()->getResolvedMethodSymbol();
if (!calleeSymbol)
return 0;
TR_ResolvedMethod * calleeMethod = calleeSymbol->getResolvedMethod();
if (!calleeMethod->isCompilable(comp->trMemory()) || calleeMethod->isJNINative())
return 0;
if (!addVeryRefinedCallAliasSets(calleeSymbol, aliases, methodsPeeked))
return 0;
}
else if (node->getOpCodeValue() == TR::monent)
return 0;
}
// This can't be allocated into the alias region as it must be accessed across optimizations
TR_BitVector *heapAliases = new (comp->trHeapMemory()) TR_BitVector(comp->getSymRefCount(), comp->trMemory(), heapAlloc, growable);
*heapAliases |= *aliases;
return heapAliases;
}
示例9: if
void
TR_Debug::print(TR::FILE *pOutFile, TR::S390CallSnippet * snippet)
{
uint8_t * bufferPos = snippet->getSnippetLabel()->getCodeLocation();
TR::Node * callNode = snippet->getNode();
TR::SymbolReference * methodSymRef = snippet->getRealMethodSymbolReference();
if(!methodSymRef)
methodSymRef = callNode->getSymbolReference();
TR::MethodSymbol * methodSymbol = methodSymRef->getSymbol()->castToMethodSymbol();
TR::SymbolReference * glueRef;
int8_t padbytes = snippet->getPadBytes();
printSnippetLabel(pOutFile, snippet->getSnippetLabel(), bufferPos,
methodSymRef->isUnresolved() ? "Unresolved Call Snippet" : "Call Snippet");
bufferPos = printS390ArgumentsFlush(pOutFile, callNode, bufferPos, snippet->getSizeOfArguments());
if (methodSymRef->isUnresolved() || _comp->compileRelocatableCode())
{
if (methodSymbol->isSpecial())
{
glueRef = _cg->getSymRef(TR_S390interpreterUnresolvedSpecialGlue);
}
else if (methodSymbol->isStatic())
{
glueRef = _cg->getSymRef(TR_S390interpreterUnresolvedStaticGlue);
}
else
{
glueRef = _cg->getSymRef(TR_S390interpreterUnresolvedDirectVirtualGlue);
}
}
else
{
bool synchronised = methodSymbol->isSynchronised();
if ((methodSymbol->isVMInternalNative() || methodSymbol->isJITInternalNative()))
{
glueRef = _cg->getSymRef(TR_S390nativeStaticHelper);
}
else
{
switch (callNode->getDataType())
{
case TR::NoType:
if (synchronised)
{
glueRef = _cg->getSymRef(TR_S390interpreterSyncVoidStaticGlue);
}
else
{
glueRef = _cg->getSymRef(TR_S390interpreterVoidStaticGlue);
}
break;
case TR::Int8:
case TR::Int16:
case TR::Int32:
if (synchronised)
{
glueRef = _cg->getSymRef(TR_S390interpreterSyncIntStaticGlue);
}
else
{
glueRef = _cg->getSymRef(TR_S390interpreterIntStaticGlue);
}
break;
case TR::Address:
if (TR::Compiler->target.is64Bit())
{
if (synchronised)
{
glueRef = _cg->getSymRef(TR_S390interpreterSyncLongStaticGlue);
}
else
{
glueRef = _cg->getSymRef(TR_S390interpreterLongStaticGlue);
}
}
else
{
if (synchronised)
{
glueRef = _cg->getSymRef(TR_S390interpreterSyncIntStaticGlue);
}
else
{
glueRef = _cg->getSymRef(TR_S390interpreterIntStaticGlue);
}
}
break;
case TR::Int64:
if (synchronised)
{
glueRef = _cg->getSymRef(TR_S390interpreterSyncLongStaticGlue);
}
else
{
//.........这里部分代码省略.........
示例10: if
//.........这里部分代码省略.........
}
// load/store double on 64-bit PPC requires offset to be word aligned
// abort if this requirement is not met.
// TODO: also need to check if the first two children are aload nodes
bool cannot_use_load_store_long = false;
if (TR::Compiler->target.cpu.isPower())
if (dataType == TR::Int64 && TR::Compiler->target.is64Bit())
{
TR::Node * firstChild = node->getFirstChild();
if (firstChild->getNumChildren() == 2)
{
TR::Node *offsetChild = firstChild->getSecondChild();
TR_ASSERT(offsetChild->getOpCodeValue() != TR::iconst, "iconst shouldn't be used for 64-bit array indexing");
if (offsetChild->getOpCodeValue() == TR::lconst)
{
if ((offsetChild->getLongInt() & 0x3) != 0)
cannot_use_load_store_long = true;
}
}
TR::Node *secondChild = node->getSecondChild();
if (secondChild->getNumChildren() == 2)
{
TR::Node *offsetChild = secondChild->getSecondChild();
TR_ASSERT(offsetChild->getOpCodeValue() != TR::iconst, "iconst shouldn't be used for 64-bit array indexing");
if (offsetChild->getOpCodeValue() == TR::lconst)
{
if ((offsetChild->getLongInt() & 0x3) != 0)
cannot_use_load_store_long = true;
}
}
}
if (cannot_use_load_store_long) return node;
TR::SymbolReference *nodeRef;
targetRef = comp->getSymRefTab()->findOrCreateGenericIntShadowSymbolReference(0);
sourceRef = targetRef;
bool trace = comp->getOption(TR_TraceScalarizeSSOps);
if (trace)
traceMsg(comp,"scalarizeArrayCopy: node %p got targetRef (#%d) and sourceRef (#%d)\n",
node,targetRef?targetRef->getReferenceNumber():-1,sourceRef?sourceRef->getReferenceNumber():-1);
if (targetRef == NULL || sourceRef == NULL)
{
if (trace)
traceMsg(comp,"do not scalarizeArrayCopy node %p : targetRef is NULL (%s) or sourceRef is NULL (%s)\n",node,targetRef?"no":"yes",sourceRef?"no":"yes");
return node;
}
#ifdef J9_PROJECT_SPECIFIC
if (targetRef->getSymbol()->getDataType().isBCD() ||
sourceRef->getSymbol()->getDataType().isBCD())
{
return node;
}
#endif
if (performTransformation(comp, "%sScalarize arraycopy 0x%p\n", OPT_DETAILS, node))
{
TR::Node *store = TR::TransformUtil::scalarizeAddressParameter(comp, node->getSecondChild(), byteLen, dataType, targetRef, true);
TR::Node *load = TR::TransformUtil::scalarizeAddressParameter(comp, node->getFirstChild(), byteLen, dataType, sourceRef, false);
if (tt)
{
// Transforming
// treetop
// arrayCopy <-- node
// into
// *store
//
node->recursivelyDecReferenceCount();
tt->setNode(node);
}
else
{
for (int16_t c = node->getNumChildren() - 1; c >= 0; c--)
cg->recursivelyDecReferenceCount(node->getChild(c));
}
TR::Node::recreate(node, store->getOpCodeValue());
node->setSymbolReference(store->getSymbolReference());
if (store->getOpCode().isStoreIndirect())
{
node->setChild(0, store->getFirstChild());
node->setAndIncChild(1, load);
node->setNumChildren(2);
}
else
{
node->setAndIncChild(0, load);
node->setNumChildren(1);
}
didTransformArrayCopyNode = true;
}
return node;
}
示例11: if
TR_ExpressionsSimplification::LoopInfo*
TR_ExpressionsSimplification::findLoopInfo(TR_RegionStructure* region)
{
ListIterator<TR::CFGEdge> exitEdges(®ion->getExitEdges());
if (region->getExitEdges().getSize() != 1)
{
if (trace())
traceMsg(comp(), "Region with more than 1 exit edges can't be handled\n");
return 0;
}
TR_StructureSubGraphNode* exitNode = toStructureSubGraphNode(exitEdges.getFirst()->getFrom());
if (!exitNode->getStructure()->asBlock())
{
if (trace())
traceMsg(comp(), "The exit block can't be found\n");
return 0;
}
TR::Block *exitBlock = exitNode->getStructure()->asBlock()->getBlock();
TR::Node *lastTreeInExitBlock = exitBlock->getLastRealTreeTop()->getNode();
if (trace())
{
traceMsg(comp(), "The exit block is %d\n", exitBlock->getNumber());
traceMsg(comp(), "The branch node is %p\n", lastTreeInExitBlock);
}
if (!lastTreeInExitBlock->getOpCode().isBranch())
{
if (trace())
traceMsg(comp(), "The branch node couldn't be found\n");
return 0;
}
if (lastTreeInExitBlock->getNumChildren() < 2)
{
if (trace())
traceMsg(comp(), "The branch node has less than 2 children\n");
return 0;
}
TR::Node *firstChildOfLastTree = lastTreeInExitBlock->getFirstChild();
TR::Node *secondChildOfLastTree = lastTreeInExitBlock->getSecondChild();
if (!firstChildOfLastTree->getOpCode().hasSymbolReference())
{
if (trace())
traceMsg(comp(), "The branch node's first child node %p - its opcode does not have a symbol reference\n", firstChildOfLastTree);
return 0;
}
TR::SymbolReference *firstChildSymRef = firstChildOfLastTree->getSymbolReference();
if (trace())
traceMsg(comp(), "Symbol Reference: %p Symbol: %p\n", firstChildSymRef, firstChildSymRef->getSymbol());
// Locate the induction variable that matches with the exit node symbol
//
TR_InductionVariable *indVar = region->findMatchingIV(firstChildSymRef);
if (!indVar) return 0;
if (!indVar->getIncr()->asIntConst())
{
if (trace())
traceMsg(comp(), "Increment is not a constant\n");
return 0;
}
int32_t increment = indVar->getIncr()->getLowInt();
_visitCount = comp()->incVisitCount();
bool indVarWrittenAndUsedUnexpectedly = false;
if (firstChildOfLastTree->getReferenceCount() > 1)
{
TR::TreeTop *cursorTreeTopInExitBlock = exitBlock->getEntry();
TR::TreeTop *exitTreeTopInExitBlock = exitBlock->getExit();
bool loadSeen = false;
while (cursorTreeTopInExitBlock != exitTreeTopInExitBlock)
{
TR::Node *cursorNode = cursorTreeTopInExitBlock->getNode();
if (checkForLoad(cursorNode, firstChildOfLastTree))
loadSeen = true;
if (!cursorNode->getOpCode().isStore() &&
(cursorNode->getNumChildren() > 0))
cursorNode = cursorNode->getFirstChild();
if (cursorNode->getOpCode().isStore() &&
(cursorNode->getSymbolReference() == firstChildSymRef))
{
indVarWrittenAndUsedUnexpectedly = true;
if ((cursorNode->getFirstChild() == firstChildOfLastTree) ||
!loadSeen)
indVarWrittenAndUsedUnexpectedly = false;
else
//.........这里部分代码省略.........
示例12: isSafeToReplaceNode
//.........这里部分代码省略.........
return false;
bool mayBeVolatileReference = currentNode->mightHaveVolatileSymbolReference();
//if (mayBeVolatileReference)
// return false;
// Now scan forwards through the trees looking for the next use and checking
// to see if any symbols in the subtree are getting modified; if so it is not
// safe to replace the node at its next use.
//
comp->incVisitCount();
for (TR::TreeTop *treeTop = curTreeTop->getNextTreeTop(); treeTop; treeTop = treeTop->getNextTreeTop())
{
TR::Node *node = treeTop->getNode();
if(node->getOpCodeValue() == TR::treetop)
node = node->getFirstChild();
if (node->getOpCodeValue() == TR::BBStart &&
!node->getBlock()->isExtensionOfPreviousBlock())
return true;
if (cantMoveUnderBranch && (node->getOpCode().isBranch()
|| node->getOpCode().isJumpWithMultipleTargets()))
return false;
if (node->canGCandReturn() &&
seenInternalPointer)
return false;
int32_t tempHeight = 0;
int32_t maxHeight = 0;
bool canMoveIfVolatile = true;
if (containsNode(node, currentNode, visitCount, comp, &tempHeight, &maxHeight, canMoveIfVolatile))
{
// TEMPORARY
// Disable moving an unresolved reference down to the middle of a
// JNI call, until the resolve helper is fixed properly
//
if (isUnresolvedReference && node->getFirstChild()->getOpCode().isCall() &&
node->getFirstChild()->getSymbol()->castToMethodSymbol()->isJNI())
return false;
if (curTreeInfo)
{
OMR::TreeInfo *treeInfo = findOrCreateTreeInfo(treeTop, targetTrees, comp);
int32_t height = treeInfo->getHeight();
int32_t maxHeightUsed = maxHeight;
if (maxHeightUsed < curMaxHeight)
maxHeightUsed = curMaxHeight;
if (height < curTreeInfo->getHeight())
height = curTreeInfo->getHeight();
height++;
if ((height+maxHeightUsed) > MAX_ALLOWED_HEIGHT)
{
cannotBeEliminated = true;
return false;
}
treeInfo->setHeight(height);
}
return true;
}
if (mayBeVolatileReference && !canMoveIfVolatile)
return false;
if ((node->getOpCode().isBranch() &&
(node->getOpCodeValue() != TR::Goto)) ||
(node->getOpCode().isJumpWithMultipleTargets() && node->getOpCode().hasBranchChildren()))
*seenConditionalBranch = true;
if (node->getOpCodeValue() == TR::treetop ||
node->getOpCode().isNullCheck() ||
node->getOpCode().isResolveCheck() ||
node->getOpCodeValue() == TR::ArrayStoreCHK ||
node->getOpCode().isSpineCheck())
{
node = node->getFirstChild();
}
if (node->getOpCode().isStore())
{
// For a store, just the single symbol reference is killed.
// Resolution of the store symbol is handled by TR::ResolveCHK
//
if (symbolReferencesInNode.ValueAt(node->getSymbolReference()->getReferenceNumber()))
return false;
}
// Node Aliasing Changes
// Check if the definition modifies any symbol in the subtree
//
if (node->mayKill(true).containsAny(symbolReferencesInNode, comp))
return false;
}
return true;
}
示例13: setSummationReductionCandidates
void TR_ExpressionsSimplification::setSummationReductionCandidates(TR::Node *node, TR::TreeTop *tt)
{
// Must be a store node
//
if (node->getOpCodeValue() != TR::istore
/* || node->getOpCodeValue() != TR::astore */)
{
if (trace())
traceMsg(comp(), "Node %p: The opcode is not istore so not a summation reduction candidate\n",node);
return;
}
TR::Node *opNode = node->getFirstChild();
if (opNode->getOpCodeValue() == TR::iadd ||
opNode->getOpCodeValue() == TR::isub)
{
TR::Node *firstNode = opNode->getFirstChild();
TR::Node *secondNode = opNode->getSecondChild();
if (firstNode->getOpCode().hasSymbolReference() &&
node->getSymbolReference() == firstNode->getSymbolReference() &&
opNode->getReferenceCount() == 1 && firstNode->getReferenceCount() == 1)
{
// The second node must be loop invariant
//
if (!_currentRegion->isExprInvariant(secondNode))
{
if (trace())
{
traceMsg(comp(), "The node %p is not loop invariant\n",secondNode);
// This can be the arithmetic series case
// only when the node is an induction variable
if (secondNode->getNumChildren() == 1 && secondNode->getOpCode().hasSymbolReference())
{
TR_InductionVariable *indVar = _currentRegion->findMatchingIV(secondNode->getSymbolReference());
if (indVar)
{
//printf("Found Candidate of arithmetic series\n" );
}
}
}
return;
}
_candidateTTs->add(tt);
}
else if (secondNode->getOpCode().hasSymbolReference() &&
node->getSymbolReference() == secondNode->getSymbolReference() &&
opNode->getReferenceCount() == 1 && secondNode->getReferenceCount() == 1 &&
_currentRegion->isExprInvariant(firstNode))
{
_candidateTTs->add(tt);
}
}
else if (opNode->getOpCodeValue() == TR::ixor ||
opNode->getOpCodeValue() == TR::ineg)
{
if (opNode->getFirstChild()->getOpCode().hasSymbolReference() &&
node->getSymbolReference() == opNode->getFirstChild()->getSymbolReference() &&
opNode->getReferenceCount() == 1 && opNode->getFirstChild()->getReferenceCount() == 1 &&
(opNode->getOpCodeValue() == TR::ineg || _currentRegion->isExprInvariant(opNode->getSecondChild())))
_candidateTTs->add(tt);
else if (opNode->getOpCodeValue() == TR::ixor && opNode->getSecondChild()->getOpCode().hasSymbolReference() &&
node->getSymbolReference() == opNode->getSecondChild()->getSymbolReference() &&
opNode->getReferenceCount() == 1 && opNode->getSecondChild()->getReferenceCount() == 1 &&
_currentRegion->isExprInvariant(opNode->getFirstChild()))
_candidateTTs->add(tt);
}
}
示例14: hasOldExpressionOnRhs
// Checks for syntactic equivalence and returns the side-table index
// of the syntactically equivalent node if it found one; else it returns
// -1 signifying that this is the first time any node similar syntactically
// to this node has been seen. Adds the node to the hash table if seen for the
// first time.
//
//
int TR_LocalAnalysisInfo::hasOldExpressionOnRhs(TR::Node *node, bool recalcContainsCall, bool storeLhsContainsCall)
{
//
// Get the relevant portion of the subtree
// for this node; this is different for a null check
// as its null check reference is the only
// sub-expression that matters
//
TR::Node *relevantSubtree = NULL;
if (node->getOpCodeValue() == TR::NULLCHK)
relevantSubtree = node->getNullCheckReference();
else
relevantSubtree = node;
// containsCall checks whether the relevant node has some
// sub-expression that cannot be commoned, e.g. call or a new
//
bool nodeContainsCall;
if (!recalcContainsCall && (relevantSubtree == node))
{
// can use pre-calculated value of containsCall and storeLhsContainsCall, to avoid visitCount overflow
nodeContainsCall = node->containsCall();
}
else
{
storeLhsContainsCall = false;
nodeContainsCall = containsCall(relevantSubtree, storeLhsContainsCall);
}
if (nodeContainsCall)
{
//
// If the node is not a store, a call-like sub-expression is inadmissable;
// if the node is a store, a call-like sub-expression is allowed on the RHS
// of the store as this does not inhibit privatization in any way as
// the private temp store's RHS simply points at original RHS. But if a call-like
// sub-expression is present in the LHS of the store, that is inadmissable
//
if (!node->getOpCode().isStore() ||
storeLhsContainsCall)
return 0;
}
bool seenIndirectStore = false;
#ifdef J9_PROJECT_SPECIFIC
bool seenIndirectBCDStore = false;
#endif
bool seenWriteBarrier = false;
int32_t storeNumChildren = node->getNumChildren();
// If node is a null check, compare the
// null check reference only to establish syntactic equivalence
//
if (node->getOpCodeValue() == TR::NULLCHK)
/////if (node->getOpCode().isNullCheck())
{
int32_t k;
for (k=0;k<_numNullChecks;k++)
{
if (!(_nullCheckNodesAsArray[k] == NULL))
{
if (areSyntacticallyEquivalent(_nullCheckNodesAsArray[k]->getNullCheckReference(), node->getNullCheckReference()))
return _nullCheckNodesAsArray[k]->getLocalIndex();
}
}
_nullCheckNodesAsArray[_numNullChecks++] = node;
}
else
{
//
// If this node is a global store, then equivalence check is different.
// We try to give a store to field (or static) o.f the same index as
// a load of o.f. This is so that privatization happens for fields/statics.
// So the store's opcode value is changed temporarily to be a load before
// syntactic equivalence is checked; this enables matching stores/loads to
// same global symbol.
//
if (node->getOpCode().isStore() &&
!node->getSymbolReference()->getSymbol()->isAutoOrParm())
{
if (node->getOpCode().isWrtBar())
seenWriteBarrier = true;
#ifdef J9_PROJECT_SPECIFIC
seenIndirectBCDStore = node->getType().isBCD();
#endif
if (node->getOpCode().isStoreIndirect())
{
if (seenWriteBarrier)
{
TR::Node::recreate(node, _compilation->il.opCodeForIndirectArrayLoad(node->getDataType()));
}
//.........这里部分代码省略.........
示例15: if
//.........这里部分代码省略.........
// This loop counts all the nodes that are going to take part in PRE.
// This is a computation intensive loop as we check if the node that
// is syntactically equivalent to a given node has been seen before
// and if so we use the local index of the original node (that
// is syntactically equivalent to the given node). Could be improved
// in complexity with value numbering at some stage.
//
_visitCount = comp()->incVisitCount();
while (currentTree)
{
TR::Node *firstNodeInTree = currentTree->getNode();
TR::ILOpCode *opCode = &firstNodeInTree->getOpCode();
if (((firstNodeInTree->getOpCodeValue() == TR::treetop) ||
(comp()->useAnchors() && firstNodeInTree->getOpCode().isAnchor())) &&
(firstNodeInTree->getFirstChild()->getOpCode().isStore()))
{
firstNodeInTree->setLocalIndex(-1);
if (comp()->useAnchors() && firstNodeInTree->getOpCode().isAnchor())
firstNodeInTree->getSecondChild()->setLocalIndex(-1);
firstNodeInTree = firstNodeInTree->getFirstChild();
opCode = &firstNodeInTree->getOpCode();
}
// This call finds nodes with opcodes that are supported by PRE
// in this subtree; this accounts for all opcodes other than stores/checks
// which are handled later on below
//
bool firstNodeInTreeHasCallsInStoreLhs = false;
countSupportedNodes(firstNodeInTree, NULL, firstNodeInTreeHasCallsInStoreLhs);
if ((opCode->isStore() && !firstNodeInTree->getSymbolReference()->getSymbol()->isAutoOrParm()) ||
opCode->isCheck())
{
int32_t oldExpressionOnRhs = hasOldExpressionOnRhs(firstNodeInTree);
//
// Return value 0 denotes that the node contains some sub-expression
// that cannot participate in PRE; e.g. a call or a new
//
// Return value -1 denotes that the node can participate in PRE
// but did not match with any existing expression seen so far
//
// Any other return value (should be positive always) denotes that
// the node can participate in PRE and has been matched with a seen
// expression having local index == return value
//
if (oldExpressionOnRhs == -1)
{
if (trace())
{
traceMsg(comp(), "\nExpression #%d is : \n", _numNodes);
comp()->getDebug()->print(comp()->getOutFile(), firstNodeInTree, 6, true);
}
firstNodeInTree->setLocalIndex(_numNodes++);
}
else
firstNodeInTree->setLocalIndex(oldExpressionOnRhs);
if (opCode->isCheck() &&
(firstNodeInTree->getFirstChild()->getOpCode().isStore() &&
!firstNodeInTree->getFirstChild()->getSymbolReference()->getSymbol()->isAutoOrParm()))
{