当前位置: 首页>>代码示例>>C++>>正文


C++ Operation::Type方法代码示例

本文整理汇总了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;
}
开发者ID:marssaxman,项目名称:radian,代码行数:31,代码来源:node.cpp

示例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;
}
开发者ID:Mytherin,项目名称:numpyllvm,代码行数:23,代码来源:compiler.cpp


注:本文中的Operation::Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。