本文整理汇总了C++中astinterface::AstNodeList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ AstNodeList::push_back方法的具体用法?C++ AstNodeList::push_back怎么用?C++ AstNodeList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astinterface::AstNodeList
的用法示例。
在下文中一共展示了AstNodeList::push_back方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
AstNodePtr LoopTransformInterface::
CreateDynamicFusionConfig( const AstNodePtr& groupNum, AstInterface::AstNodeList& args, int &id)
{ assert(fa != 0);
std::string name = "DynamicFusionConfig";
++configIndex;
args.push_back( fa->CreateConstInt(configIndex).get_ptr() );
args.push_back( fa->CreateConstInt( args.size() ).get_ptr() );
std::string funname = "DynamicFusionConfig";
AstNodePtr invoc = fa->CreateFunctionCall( funname, args.begin(), args.end());
return fa->CreateAssignment ( groupNum, invoc) ;
}
示例2: if
AstNodePtr SymbolicFunction :: CodeGen( AstInterface &_fa) const
{
AstInterface::AstNodeList l;
for (const_iterator i = args.begin(); i != args.end(); ++i) {
SymbolicVal cur = *i;
AstNodePtr curast = cur.CodeGen(_fa);
l.push_back(curast);
}
if (t == AstInterface::OP_NONE) {
return _fa.CreateFunctionCall( op, l);
}
else if (t == AstInterface::OP_ARRAY_ACCESS) {
AstNodePtr arr = l.front();
l.pop_front();
return _fa.CreateArrayAccess(arr, l);
}
else if (t == AstInterface::OP_ASSIGN && l.size() == 2) {
return _fa.CreateAssignment(l.front(), l.back());
}
else if (l.size() == 2)
return _fa.CreateBinaryOP( t, l.front(), l.back());
else {
assert(l.size() == 1);
return _fa.CreateUnaryOP( t, l.front());
}
}
示例3: CreateDynamicFusionEnd
AstNodePtr LoopTransformInterface::CreateDynamicFusionEnd( int id)
{ assert(fa != 0);
AstInterface::AstNodeList args;
args.push_back( fa->CreateConstInt(id).get_ptr());
std::string funname = "DynamicFusionEnd";
return fa->CreateFunctionCall(funname, args.begin(), args.end());
}
示例4: CodeGen
AstNodePtr SymbolicSelect:: CodeGen( AstInterface &fa ) const
{
int size = 0;
AstInterface::AstNodeList list;
for (OpdIterator iter = GetOpdIterator(); !iter.ReachEnd(); iter.Advance()) {
AstNodePtr p = Term2Val(iter.Current()).CodeGen(fa);
list.push_back(p);
++size;
}
assert( size > 1);
std::string func = (opt< 0)? "min" : "max";
return fa.CreateFunctionCall(func, list);
}
示例5: GetDefaultBlockSize
static SymbolicVal GetDefaultBlockSize(const CompSlice* slice)
{
AstInterface& fa = LoopTransformInterface::getAstInterface();
LoopTransformOptions* opt = LoopTransformOptions::GetInstance();
if (!opt->DoDynamicTuning()) {
return opt->GetDefaultBlockSize();
}
else {
int dt = opt->GetDynamicTuningIndex();
AstInterface::AstNodeList l;
l.push_back(fa.CreateConstInt(dt));
CompSlice::ConstLoopIterator iter = slice->GetConstLoopIterator();
LoopTreeNode *loop = iter.Current();
SymbolicBound b = loop->GetLoopInfo()->GetBound();
SymbolicVal size = b.ub - b.lb + 1;
l.push_back(fa.CreateConstInt(1));
l.push_back(size.CodeGen(fa));
AstNodePtr init = fa.CreateFunctionCall("getTuningValue", l);
return SymbolicVar(fa.NewVar(fa.GetType("int"), "",true,AST_NULL, init),AST_NULL);
}
}
示例6: assert
AstNodePtr LoopTransformInterface::
CreateArrayAccess(const std::string& arrname,
const std::vector<SymbolicVal>& arrindex)
{
assert(fa != 0);
AstInterface::AstNodeList indexlist;
for (std::vector<SymbolicVal>::const_iterator indexp = arrindex.begin();
indexp != arrindex.end(); ++indexp) {
AstNodePtr cur = (*indexp).CodeGen(*fa);
if (cur == AST_NULL) {
std::cerr << "Empty AST from Symbolic Val: " << (*indexp).toString() << "\n";
assert(0);
}
indexlist.push_back(cur);
}
AstNodePtr res = CreateArrayAccess(fa->CreateVarRef(arrname),indexlist);
return res;
}
示例7: SymbolicVar
LoopTreeNode* DynamicSlicing::
Transform( LoopTreeDepComp& c, const CompSlice *_slice, LoopTreeNode *root)
{
AstInterface& fa = LoopTransformInterface::getAstInterface();
const DynamicCompSlice* slice = static_cast<const DynamicCompSlice*>(_slice);
int num = slice->QuerySliceGroupNumber();
LoopTreeNode *nr = root;
if (num > 1) {
std::string groupVar = fa.NewVar(fa.GetType("int")), groupVarN = groupVar + "N";
fa.NewVar( fa.GetType("int"), groupVarN);
LoopTreeCreate *tc = c.GetLoopTreeCreate();
nr = tc->CreateLoopNode( SymbolicVar(groupVar, AST_NULL), 1, SymbolicVar(groupVarN, AST_NULL), 1);
LoopTreeTransform().InsertLoop( nr, root, -1);
AstInterface::AstNodeList args;
char buf[11];
for (int i = 1; i <= num; ++i) {
sprintf(buf, "%1d", i);
std::string name = groupVar + buf;
fa.NewVar(fa.GetType("int"), name);
args.push_back( fa.CreateVarRef( name) );
}
int id;
AstNodePtr config = LoopTransformInterface::CreateDynamicFusionConfig( fa.CreateVarRef(groupVarN), args, id);
LoopTreeNode *configNode = tc->CreateStmtNode(config);
configNode->Link( nr, LoopTreeNode::AsPrevSibling);
AstNodePtr configEnd = LoopTransformInterface::CreateDynamicFusionEnd( id);
LoopTreeNode *endNode = tc->CreateStmtNode(configEnd);
endNode->Link( nr, LoopTreeNode::AsNextSibling);
for (CompSlice::ConstStmtIterator p = slice->GetConstStmtIterator();
!p.ReachEnd(); ++p) {
LoopTreeNode* stmt = p.Current();
sprintf(buf, "%1d", slice->QuerySliceStmtGroupIndex(stmt));
LoopTreeEmbedStmt()( nr, stmt, SymbolicVar(groupVar + buf, AST_NULL) );
}
DependenceHoisting::Transform(c, slice, root);
}
else
nr = DependenceHoisting::Transform(c, slice, root);
return nr;
}
示例8: CreateDynamicFusionEnd
AstNodePtr LoopTransformInterface::CreateDynamicFusionEnd( int id)
{ assert(fa != 0);
AstInterface::AstNodeList args;
args.push_back( fa->CreateConstInt(id));
return fa->CreateFunctionCall("DynamicFusionEnd", args);
}