本文整理汇总了C++中Operation::Type方法的典型用法代码示例。如果您正苦于以下问题:C++ Operation::Type方法的具体用法?C++ Operation::Type怎么用?C++ Operation::Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation::Type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// Flowgraph::Rewrite
//
// The sources of the values in this expression (may have) changed. Traverse
// the graph and rewrite any nodes that depend on changed source values. Idea
// for future improvement: define some placeholder node whose meaning can be
// defined upstream by some kind of definition node, then have the PostOrderDFS
// perform the substitution during traversal. This would free us from the need
// to traverse the graph twice and to reallocate the intermediary nodes - this
// could be a big memory win given that we will likely need to recreate the
// majority of the loop body. Note that we fill out the map as we go, so we
// don't re-traverse any shared subexpressions.
//
Node *Flowgraph::Rewrite( Node *exp, Pool &pool, NodeMap &reMap )
{
NodeMap::const_iterator iter = reMap.find(exp);
if (iter != reMap.end()) {
exp = iter->second;
}
else if (exp->IsAnOperation()) {
Operation *op = exp->AsOperation();
Node *left = Rewrite( op->Left(), pool, reMap );
Node *right = Rewrite( op->Right(), pool, reMap );
Node *newExp = pool.Operation( op->Type(), left, right );
if (exp->IsInductionVar() && !op->IsInductionVar()) {
newExp = pool.Inductor( newExp );
}
reMap[exp] = newExp;
exp = newExp;
}
return exp;
}
示例2: CreateJITFunction
JITFunction*
GenerateBaseFunction(Pipeline *pipeline, Thread *thread) {
JITFunction *jf = CreateJITFunction(thread, pipeline);
Operation *operation = pipeline->operation;
jf->size = 0;
jf->function = NULL;
jf->jit = NULL;
switch(operation->Type()) {
case OPTYPE_nullop:
jf->base = (base_function) ((NullaryOperation*)operation)->operation->gencode.base;
break;
case OPTYPE_unop:
jf->base = (base_function) ((UnaryOperation*)operation)->operation->gencode.base;
break;
case OPTYPE_binop:
jf->base = (base_function) ((BinaryOperation*)operation)->operation->gencode.base;
break;
default:
return NULL;
}
return jf;
}