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


C++ AType::isScalar方法代码示例

本文整理汇总了C++中AType::isScalar方法的典型用法代码示例。如果您正苦于以下问题:C++ AType::isScalar方法的具体用法?C++ AType::isScalar怎么用?C++ AType::isScalar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AType的用法示例。


在下文中一共展示了AType::isScalar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: genericRelational

void TypeAnalysis::genericRelational(CallInst * ci) {
    AType * lhs = state.get(ci->getOperand(0));
    AType * rhs = state.get(ci->getOperand(1));
    if (lhs->isScalar() and rhs->isScalar()) {
        state.update(ci,
                new AType(AType::Kind::R,
                    AType::Kind::DV,
                    AType::Kind::D));
    } else {
        state.update(ci, new AType(AType::Kind::R, AType::Kind::DV));
    }
}
开发者ID:rift-lecture,项目名称:rift,代码行数:12,代码来源:type_analysis.cpp

示例2: genericGetElement

void TypeAnalysis::genericGetElement(CallInst * ci) {
    AType * from = state.get(ci->getOperand(0));
    AType * index = state.get(ci->getOperand(1));
    if (from->isDouble()) {
        if (index->isScalar()) {
            state.update(ci,
                    new AType(AType::Kind::R,
                        AType::Kind::DV,
                        AType::Kind::D));
        } else {
            state.update(ci, new AType(AType::Kind::R, AType::Kind::DV));
        }
    } else if (from->isCharacter()) {
        state.update(ci, new AType(AType::Kind::R, AType::Kind::CV));
    } else {
        state.update(ci, new AType(AType::Kind::T));
    }
}
开发者ID:rift-lecture,项目名称:rift,代码行数:18,代码来源:type_analysis.cpp

示例3: Environment

 /** Checks that a dot operator result type is correctly set to be double scalar by the type analysis. */
 void project4() {
     char const * source = "function(a, b) { a %*% b }";
     try {
         Environment * env = new Environment(nullptr);
         RVal * actual = eval(env, source);
         llvm::Function * f = actual->f->bitcode;
         // run type analysis on the function
         //auto pm = llvm::legacy::FunctionPassManager(f->getParent());
         TypeAnalysis ta;
         ta.runOnFunction(*f);
         // check the type of the genericDot intrinsic call
         for (auto & b : *f) {
             for (auto & i : b) {
                 if (llvm::CallInst * ci = llvm::dyn_cast<llvm::CallInst>(&i)) {
                     llvm::StringRef s = ci->getCalledFunction()->getName();
                     if (s == "genericDot") {
                         AType * t = ta.state.get(ci);
                         if (t->kind != AType::Kind::R or not t->isScalar())
                             throw "Generic dot does not have correct type";
                         if (ta.state.getLocation(t) != ci)
                             throw "Location attached to the generic dot type is invalid";
                         t = t->payload;
                         if (ta.state.getLocation(t) != nullptr)
                             throw "Generic dot payload cannot have location";
                         t = t->payload;
                         if (ta.state.getLocation(t) != nullptr)
                             throw "Generic dot payload cannot have location";
                         return;
                     }
                 }
             }
         }
         throw "Generic dot not found";
     } catch (char const * e) {
         cout << "ERROR at line " << __LINE__ << " : " << e << endl;
         cout << source << endl << endl;
     } catch (...) {
         cout << "ERROR at line " << __LINE__ << " : " << endl;
         cout << source << endl << endl;
     }
 }
开发者ID:evandar,项目名称:project,代码行数:42,代码来源:tests.cpp


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