void removeCandidateFromRegion(T_Region region, int candidate, T_Cell grid[][GRID_SIZE]) { int line,column; // supprimer le candidat de la region courante for (line = region.headLine; line<region.headLine+3; line++) for (column = region.headColumn ; column <region.headColumn+3; column++ ) { removeCandidate(candidate, &grid[line][column]); } }
void removeFromOtherColum (int candidate, T_Cell cell, T_Cell grid[][GRID_SIZE]) { int line; T_Region thisRegion = initializeRegion(cell.region); for (line = 0 ; line < GRID_SIZE ; line++ ) { if (grid[line][cell.column].region != thisRegion.number) removeCandidate(candidate,&grid[line][cell.column]); } }
void removeFromOtherLine (int candidate, T_Cell cell, T_Cell grid[][GRID_SIZE]) { int column; T_Region thisRegion = initializeRegion(cell.region); for (column = 0 ; column < GRID_SIZE ; column++ ) { if (grid[cell.line][column].region != thisRegion.number) removeCandidate(candidate,&grid[cell.line][column]); } }
void TR_ExpressionsSimplification::removeCandidate(TR::Node *node, TR::TreeTop* tt) { if (node->getVisitCount() == _visitCount) return; node->setVisitCount(_visitCount); if (trace()) traceMsg(comp(), "Looking at Node [%p]\n", node); ListIterator<TR::TreeTop> candidateTTs(_candidateTTs); for (TR::TreeTop *candidateTT = candidateTTs.getFirst(); candidateTT; candidateTT = candidateTTs.getNext()) { if (tt != candidateTT && node->getOpCode().hasSymbolReference() && candidateTT->getNode()->mayKill(true).contains(node->getSymbolReference(), comp())) { if (trace()) traceMsg(comp(), "Removing candidate %p which has aliases in the loop\n", candidateTT->getNode()); _candidateTTs->remove(candidateTT); continue; } } bool hasSupportedChildren = true; // Process the children as well // for (int32_t i = 0; i < node->getNumChildren(); i++) { removeCandidate(node->getChild(i), tt); // candidates child expressions must be invariant and supported. Here we determine if they are supported. if (!_supportedExpressions->get(node->getChild(i)->getGlobalIndex())) { hasSupportedChildren = false; } } if (hasSupportedChildren && isSupportedNodeForExpressionSimplification(node)) { _supportedExpressions->set(node->getGlobalIndex()); } else { if (trace()) traceMsg(comp(), " Node %p is unsupported expression because %s\n", node, !hasSupportedChildren ? "it has unsupported children" : "it is itself unsupported"); } }
void TR_ExpressionsSimplification::invalidateCandidates() { _visitCount = comp()->incVisitCount(); if (trace()) { traceMsg(comp(), "Checking which candidates may be invalidated\n"); ListIterator<TR::TreeTop> treeTops(_candidateTTs); for (TR::TreeTop *treeTop = treeTops.getFirst(); treeTop; treeTop = treeTops.getNext()) { traceMsg(comp(), " Candidate treetop: %p node: %p\n", treeTop, treeTop->getNode()); } } TR_ScratchList<TR::Block> blocksInLoop(trMemory()); _currentRegion->getBlocks(&blocksInLoop); ListIterator<TR::Block> blocks(&blocksInLoop); for (TR::Block *currentBlock = blocks.getFirst(); currentBlock; currentBlock = blocks.getNext()) { TR::TreeTop *tt = currentBlock->getEntry(); TR::TreeTop *exitTreeTop = currentBlock->getExit(); while (tt != exitTreeTop) { TR::Node *currentNode = tt->getNode(); if (trace()) traceMsg(comp(), "Looking at treeTop [%p]\n", currentNode); removeCandidate(currentNode, tt); tt = tt->getNextTreeTop(); } } removeUnsupportedCandidates(); }
void removeCandidateFromColumn(int column, int candidate, T_Cell grid[][GRID_SIZE]) { int line; for (line = 0 ; line <GRID_SIZE ; line++ ) { // supprimer le candidat de la colonne courante removeCandidate(candidate, &grid[line][column]); } }
void removeCandidateFromLine(int line, int candidate, T_Cell grid[][GRID_SIZE]) { int column; for (column = 0 ; column <GRID_SIZE ; column++ ) { // supprimer le candidate de la ligne courante removeCandidate(candidate, &grid[line][column]); } }