本文整理汇总了C++中SgStatement::unsetOutputInCodeGeneration方法的典型用法代码示例。如果您正苦于以下问题:C++ SgStatement::unsetOutputInCodeGeneration方法的具体用法?C++ SgStatement::unsetOutputInCodeGeneration怎么用?C++ SgStatement::unsetOutputInCodeGeneration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgStatement
的用法示例。
在下文中一共展示了SgStatement::unsetOutputInCodeGeneration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitSgFunctionDeclaration
//.........这里部分代码省略.........
if (!isSgDeclarationStatement(*SI)) {
break;
}
}
if (SI == stmts.end()) {
return;
}
SP = SI;
std::vector<SgBasicBlock *> newBlocks;
SgBasicBlock *newbb = SageBuilder::buildBasicBlock();
newBlocks.push_back(newbb);
stateToName[1] = "__START";
bool prevIsLabel = false;
for (; SI != stmts.end(); ++SI) {
SgStatement *stmt = *SI;
SgLabelStatement *labstmt = isSgLabelStatement(stmt);
if (labstmt) {
if (!prevIsLabel) {
newbb = SageBuilder::buildBasicBlock();
newBlocks.push_back(newbb);
}
int snum = newBlocks.size();
labelToState[labstmt] = snum;
stateToName[snum] += "__" + labstmt->get_label().getString();
prevIsLabel = true;
#if 1
// TODO: these labels can carry preproc infos-- but the unparser
// doesn't output them if the label is not actually output.
AttachedPreprocessingInfoType *comments =
labstmt->getAttachedPreprocessingInfo();
if (comments && comments->size() > 0) {
std::cerr << "DEVWARN: losing Preprocinfo on label" << std::endl;
SageInterface::dumpPreprocInfo(labstmt);
}
#endif
stmt->unsetOutputInCodeGeneration();
SageInterface::appendStatement(stmt, newbb);
} else {
prevIsLabel = false;
SageInterface::appendStatement(stmt, newbb);
}
}
stmts.erase(SP, stmts.end());
// Add module name to each state name and create enum decl.
SgEnumDeclaration *enumDecl = SageBuilder::buildEnumDeclaration("states",
fdef);
for (int i = 1; i <= newBlocks.size(); i++) {
stateToName[i] = modName + stateToName[i];
boost::to_upper(stateToName[i]);
SgName nm(stateToName[i]);
SgInitializedName *enumerator = SageBuilder::buildInitializedName(nm,
SageBuilder::buildIntType(),
SageBuilder::buildAssignInitializer(SageBuilder::buildIntVal(i)));
enumerator->set_scope(funcBody);
enumDecl->append_enumerator(enumerator);
// Add the instruction to the htd info.
htd->appendInst(nm.getString());
}
SageInterface::prependStatement(enumDecl, funcBody);
if (!debugHooks) {
enumDecl->unsetOutputInCodeGeneration();
}
SgGlobal *GS = SageInterface::getGlobalScope(FD);
SgVariableDeclaration *declHtValid =
HtDeclMgr::buildHtlVarDecl("PR_htValid", GS);
SgVariableDeclaration *declHtInst =
HtDeclMgr::buildHtlVarDecl("PR_htInst", GS);
SgFunctionDeclaration *declHtContinue =
HtDeclMgr::buildHtlFuncDecl("HtContinue", GS);
SgFunctionDeclaration *declHtAssert =
HtDeclMgr::buildHtlFuncDecl("HtAssert", GS);
//
// Create the finite state machine switch statement "switch (PR_htInst)",
// and insert guard "if (PR_htValid)".
//
SgBasicBlock *newSwitchBody = SageBuilder::buildBasicBlock();
SgExpression *htInstExpr = SageBuilder::buildVarRefExp(declHtInst);
SgSwitchStatement *newSwitch =
SageBuilder::buildSwitchStatement(htInstExpr, newSwitchBody);
SgExpression *htValidExpr = SageBuilder::buildVarRefExp(declHtValid);
SgIfStmt *newIfStmt = SageBuilder::buildIfStmt(htValidExpr,
SageBuilder::buildBasicBlock(newSwitch), 0);
SageInterface::appendStatement(newIfStmt, funcBody);
int casenum = 1;
foreach (SgBasicBlock *newCaseBody, newBlocks) {
SgExpression *caseExpr =
SageBuilder::buildEnumVal_nfi(casenum, enumDecl, stateToName[casenum]);
SgCaseOptionStmt *newCase =
SageBuilder::buildCaseOptionStmt(caseExpr, newCaseBody);
SageInterface::appendStatement(newCase, newSwitchBody);
casenum++;
}