本文整理汇总了C++中AstNode::user4方法的典型用法代码示例。如果您正苦于以下问题:C++ AstNode::user4方法的具体用法?C++ AstNode::user4怎么用?C++ AstNode::user4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstNode
的用法示例。
在下文中一共展示了AstNode::user4方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reorderBlock
void reorderBlock(AstNode* nodep) {
// Reorder statements in the completed graph
// Map the rank numbers into nodes they associate with
typedef std::multimap<uint32_t,AstNode*> RankNodeMap;
RankNodeMap rankMap;
int currOrder = 0; // Existing sequence number of assignment
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
rankMap.insert(make_pair(vvertexp->rank(), nextp));
nextp->user4(++currOrder); // Record current ordering
}
// Is the current ordering OK?
bool leaveAlone=true;
int newOrder = 0; // New sequence number of assignment
for (RankNodeMap::const_iterator it = rankMap.begin();
it != rankMap.end(); ++it) {
AstNode* nextp = it->second;
if (++newOrder != nextp->user4()) leaveAlone=false;
}
if (leaveAlone) {
UINFO(6," No changes\n");
} else {
AstNRelinker replaceHandle; // Where to add the list
AstNode* newListp = NULL;
for (RankNodeMap::const_iterator it = rankMap.begin(); it != rankMap.end(); ++it) {
AstNode* nextp = it->second;
UINFO(6, " New order: "<<nextp<<endl);
if (nextp == nodep) nodep->unlinkFrBack(&replaceHandle);
else nextp->unlinkFrBack();
if (newListp) newListp = newListp->addNext(nextp);
else newListp = nextp;
}
replaceHandle.relink(newListp);
} // leaveAlone
}
示例2: reorderBlock
void reorderBlock(AstNode* nodep) {
// Reorder statements in the completed graph
AstAlways* splitAlwaysp = nodep->backp()->castAlways();
// Map the rank numbers into nodes they associate with
typedef multimap<uint32_t,AstNode*> RankNodeMap;
typedef map<uint32_t,RankNodeMap> ColorRankMap;
ColorRankMap colorRankMap;
uint32_t firstColor = 0; bool multiColors = false;
int currOrder = 0; // Existing sequence number of assignment
for (AstNode* nextp=nodep; nextp; nextp=nextp->nextp()) {
SplitLogicVertex* vvertexp = (SplitLogicVertex*)nextp->user3p();
if (!splitAlwaysp) vvertexp->splitColor(1); // All blocks remain as-is
RankNodeMap& rankMap = colorRankMap[vvertexp->splitColor()];
rankMap.insert(make_pair(vvertexp->rank(), nextp));
if (firstColor && firstColor != vvertexp->splitColor()) multiColors = true;
firstColor = vvertexp->splitColor();
nextp->user4(++currOrder); // Record current ordering
}
// If there was only one color, we don't need multiple always blocks
if (!multiColors) splitAlwaysp = NULL;
// Is the current ordering OK?
bool leaveAlone=true;
if (splitAlwaysp) leaveAlone=false;
int newOrder = 0; // New sequence number of assignment
for (ColorRankMap::iterator colorIt = colorRankMap.begin(); colorIt != colorRankMap.end(); ++colorIt) {
RankNodeMap& rankMap = colorIt->second;
for (RankNodeMap::iterator it = rankMap.begin(); it != rankMap.end(); ++it) {
AstNode* nextp = it->second;
if (++newOrder != nextp->user4()) leaveAlone=false;
}
}
if (leaveAlone) {
UINFO(6," No changes\n");
} else {
AstNRelinker replaceHandle; // Where to add the list
AstNode* addAfterp = splitAlwaysp;
for (ColorRankMap::iterator colorIt = colorRankMap.begin(); colorIt != colorRankMap.end(); ++colorIt) {
uint32_t color = colorIt->first;
RankNodeMap& rankMap = colorIt->second;
AstNode* newListp = NULL;
for (RankNodeMap::iterator it = rankMap.begin(); it != rankMap.end(); ++it) {
AstNode* nextp = it->second;
UINFO(6, " Color="<<color<<" New order: "<<nextp<<endl);
if (nextp == nodep && !splitAlwaysp) nodep->unlinkFrBack(&replaceHandle);
else nextp->unlinkFrBack();
newListp = newListp->addNext(nextp);
}
if (splitAlwaysp) {
++m_statSplits;
AstAlways* alwaysp = new AstAlways(newListp->fileline(), VAlwaysKwd::ALWAYS, NULL, NULL);
addAfterp->addNextHere(alwaysp); addAfterp=alwaysp;
alwaysp->addStmtp(newListp);
} else {
// Just reordering
replaceHandle.relink(newListp);
}
}
if (splitAlwaysp) {
pushDeletep(splitAlwaysp->unlinkFrBack());
}
} // leaveAlone
}