本文整理汇总了C++中astinterface::AstNodeList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ AstNodeList::size方法的具体用法?C++ AstNodeList::size怎么用?C++ AstNodeList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astinterface::AstNodeList
的用法示例。
在下文中一共展示了AstNodeList::size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
示例2: assert
AstNodePtr ArrayInterface::
impl_access_array_elem (CPPAstInterface& fa, const AstNodePtr& array,
const AstInterface::AstNodeList& ivarAst)
{
SymbolicFunctionDeclarationGroup elem;
ArrayOptDescriptor desc;
if (get_array_opt(fa, array, desc))
{
elem = desc.get_elem();
}
else
{
ArrayDefineDescriptor desc1;
if (!ArrayAnnotation::get_inst()->known_array( fa, array, &desc1))
assert(false);
elem = desc1.get_elem();
}
elem.replace_var("this", SymbolicAstWrap(array));
elem.replace_var( "dimension", ivarAst.size());
AstNodePtr r;
if (! elem.get_val(fa, ivarAst, r))
assert(false);
return r;
}
示例3: cursel
CopyArrayConfig
ComputeCopyConfig( const DepCompAstRefAnal& stmtorder,
const DepCompCopyArrayCollect::CopyArrayUnit& unit,
const DepCompAstRefGraphNode* initcut)
{
assert (unit.refs.size() > 0);
AstInterface& ai = LoopTransformInterface::getAstInterface();
const DepCompAstRef& initInfo = initcut->GetInfo();
AstNodePtr lhs;
bool is_init = ai.IsAssignment(initInfo.stmt->GetOrigStmt(), &lhs)
&& (lhs == initcut->GetInfo().orig);
AstNodeType inittype;
if (ai.IsExpression(initInfo.orig, &inittype)==AST_NULL)
assert(false);
bool has_write = false;
AstNodePtr arr;
std::string arrname, elemtypename;
ai.GetTypeInfo(inittype, 0, &elemtypename); //QY: strip out ref info &
AstNodeType elemtype = ai.GetType(elemtypename);
AstInterface::AstNodeList initIndex;
if (!LoopTransformInterface::IsArrayAccess(initInfo.orig, &arr, &initIndex) || !ai.IsVarRef(arr,0,&arrname))
assert(false);
SelectArray cursel(elemtype, arrname, initIndex.size());
cursel.select(initInfo.stmt, unit.root, initIndex);
for (DepCompCopyArrayCollect::CopyArrayUnit::NodeSet::const_iterator p = unit.refs.begin();
!p.ReachEnd(); ++p) {
const DepCompAstRefGraphNode* curref = *p;
const DepCompAstRef& curinfo = curref->GetInfo();
if (stmtorder.is_mod_ref(curinfo.orig))
has_write = true;
AstInterface::AstNodeList curIndex;
if (!LoopTransformInterface::IsArrayAccess(curinfo.orig, 0, &curIndex))
assert(false);
if (cursel.select(curinfo.stmt, unit.root, curIndex))
is_init = false;
}
cursel.set_bufsize(ai);
LoopTreeNode* shift = 0;
if (unit.carrybyroot)
shift = unit.root;
int copyopt = 0;
if (!is_init)
copyopt |= INIT_COPY;
if (has_write)
copyopt |= SAVE_COPY;
CopyArrayOpt opt = (CopyArrayOpt)copyopt;
CopyArrayConfig curconfig(ai, cursel, opt, shift);
return curconfig;
}
示例4: assert
AstNodePtr LoopTransformInterface::
CreateDynamicFusionConfig( const AstNodePtr& groupNum, AstInterface::AstNodeList& args, int &id)
{ assert(fa != 0);
std::string name = "DynamicFusionConfig";
++configIndex;
args.push_front( fa->CreateConstInt( args.size() ) );
args.push_front( fa->CreateConstInt(configIndex) );
AstNodePtr invoc = fa->CreateFunctionCall( "DynamicFusionConfig", args);
return fa->CreateAssignment ( groupNum, invoc) ;
}
示例5: 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) ;
}
示例6: curarg
ReplaceParams::
ReplaceParams ( const ParamDescriptor& decl, AstInterface::AstNodeList& args,
Map2Object<AstInterface*,AstNodePtr,AstNodePtr>* codegen)
{
assert(decl.size() == args.size());
int index = 0;
for (AstInterface::AstNodeList::iterator p1 = args.begin();
p1 != args.end(); ++p1, ++index) {
AstNodePtr curAst = *p1;
string curpar = decl[index];
SymbolicAstWrap curarg(curAst, codegen);
parmap[curpar] = curarg;
}
}
示例7:
AstNodePtr ArrayUseAccessFunction::
CreateArrayAccess( AstInterface& fa, const AstNodePtr& arr,
AstInterface::AstNodeList& index)
{
if (prev != 0)
return prev->CreateArrayAccess(fa, arr, index);
if (index.size() > 1) {
AstInterface::AstNodeList tmp = index;
tmp.push_front(arr);
return fa.CreateFunctionCall(funcname, tmp);
}
else
return fa.CreateArrayAccess(arr, index);
}
示例8: SymbolicAstWrap
AstNodePtr ArrayInterface::
impl_reshape_array( CPPAstInterface& fa,
const AstNodePtr& array,
AstInterface::AstNodeList& ivarAst)
{
ArrayDefineDescriptor desc;
if (!ArrayAnnotation::get_inst()->known_array( fa, array, &desc))
return AST_NULL;
SymbolicFunctionDeclarationGroup reshape = desc.get_reshape();
reshape.replace_var( "this", SymbolicAstWrap(array));
reshape.replace_var( "dimension", ivarAst.size());
AstNodePtr r;
if (!reshape.get_val( fa, ivarAst, r)) {
std::cerr << "Error: cannot extract value from reshape spec: \n";
reshape.write(std::cerr);
std::cerr << std::endl;
assert(false);
}
return r;
}