本文整理汇总了C++中ExpressionPtr::getNodeManager方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpressionPtr::getNodeManager方法的具体用法?C++ ExpressionPtr::getNodeManager怎么用?C++ ExpressionPtr::getNodeManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionPtr
的用法示例。
在下文中一共展示了ExpressionPtr::getNodeManager方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildPtrSubscript
ExpressionPtr buildPtrSubscript(const ExpressionPtr& ptrExpr, const ExpressionPtr& subscriptExpr) {
assert_pred1(isPointer, ptrExpr) << "Trying to build a ptr subscript from non-ptr.";
assert_pred1(ptrExpr->getNodeManager().getLangBasic().isInt, subscriptExpr->getType()) << "Trying to build a ptr subscript with non-integral subscript.";
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrSubscript(), ptrExpr, subscriptExpr);
}
示例2: buildPtrOfFunction
ExpressionPtr buildPtrOfFunction(const ExpressionPtr& funExpr) {
assert_true(funExpr->getType().isa<FunctionTypePtr>()) << "Trying to build a ptr of a non-function type:\n" << dumpColor(funExpr)
<< "\nType: " << dumpColor(funExpr->getType());
IRBuilder builder(funExpr->getNodeManager());
auto& pExt = funExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrOfFunction(), funExpr);
}
示例3: buildPtrToIntegral
ExpressionPtr buildPtrToIntegral(const ExpressionPtr& ptrExpr, const TypePtr& intType) {
assert_pred1(isPointer, ptrExpr) << "Trying to build a ref from non-ptr.";
assert_pred1(ptrExpr->getNodeManager().getLangBasic().isInt, intType) << "Trying to build non-integral from ptr.";
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrToIntegral(), ptrExpr, builder.getTypeLiteral(intType));
}
示例4: buildPtrFromArray
ExpressionPtr buildPtrFromArray(const ExpressionPtr& arrExpr) {
assert_pred1(isReference, arrExpr) << "Trying to buildPtrFromArray from non-ref.";
assert_pred1(isArray, core::analysis::getReferencedType(arrExpr->getType())) << "Trying to buildPtrFromArray from non-array.";
IRBuilder builder(arrExpr->getNodeManager());
auto& pExt = arrExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrFromArray(), arrExpr);
}
示例5: buildPtrReinterpret
ExpressionPtr buildPtrReinterpret(const ExpressionPtr& ptrExpr, const TypePtr& newElementType) {
assert_pred1(core::lang::isPointer, ptrExpr) << "Trying to build a ptr reinterpret from non-ptr.";
PointerType srcTy(ptrExpr->getType());
// early exit if there is nothing to do
if(srcTy.getElementType() == newElementType) return ptrExpr;
// otherwise, build reinterpret
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrReinterpret(), ptrExpr, builder.getTypeLiteral(newElementType));
}
示例6: buildPtrCast
ExpressionPtr buildPtrCast(const ExpressionPtr& ptrExpr, bool newConst, bool newVolatile) {
assert_pred1(core::lang::isPointer, ptrExpr) << "Trying to build a ptr cast from non-ptr.";
PointerType srcTy(ptrExpr->getType());
// early exit if there is nothing to do
if(srcTy.isConst() == newConst && srcTy.isVolatile() == newVolatile) return ptrExpr;
// otherwise, build cast
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
auto& bmExt = ptrExpr->getNodeManager().getLangExtension<BooleanMarkerExtension>();
return builder.callExpr(pExt.getPtrCast(), ptrExpr, bmExt.getMarkerTypeLiteral(newConst), bmExt.getMarkerTypeLiteral(newVolatile));
}
示例7: buildPtrOperation
ExpressionPtr buildPtrOperation(BasicGenerator::Operator op, const ExpressionPtr& ptrExpr) {
assert_true(isReference(ptrExpr) && isPointer(core::analysis::getReferencedType(ptrExpr->getType())))
<< "Trying to build a unary pointer operation with non-ref<ptr>.";
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
switch(op) {
case BasicGenerator::Operator::PostInc: return builder.callExpr(pExt.getPtrPostInc(), ptrExpr);
case BasicGenerator::Operator::PostDec: return builder.callExpr(pExt.getPtrPostDec(), ptrExpr);
case BasicGenerator::Operator::PreInc: return builder.callExpr(pExt.getPtrPreInc(), ptrExpr);
case BasicGenerator::Operator::PreDec: return builder.callExpr(pExt.getPtrPreDec(), ptrExpr);
default: break;
}
assert_fail() << "Unsupported unary pointer operation " << op;
return ExpressionPtr();
}
示例8: updateStruct
/*
* Changes the type of the field of a struct
*/
void updateStruct(const ExpressionPtr& structure, TypePtr& type, const ExpressionPtr& identifier) {
NodeManager& mgr = structure->getNodeManager();
IRBuilder builder(mgr);
TypePtr baseType = structure->getType();
RefTypePtr refTy = baseType.isa<RefTypePtr>();
StructTypePtr kst = refTy ? refTy->getElementType().as<StructTypePtr>() : structure->getType().as<StructTypePtr>();
std::string name = identifier->toString();
NamedTypePtr oldType = kst->getNamedTypeEntryOf(name);
NamedTypePtr newType = builder.namedType(name, refTy ? builder.refType(type) : type);
TypePtr newStructType = transform::replaceAll(mgr, baseType, oldType, newType).as<TypePtr>();
type = newStructType;
}
示例9: getCreateBuffer
ExpressionPtr getCreateBuffer(const TypePtr& type, const ExpressionPtr& size, const bool copyPtr,
const ExpressionPtr& hostPtr, const ExpressionPtr& errcode_ret) {
NodeManager& mgr = size->getNodeManager();
IRBuilder builder(mgr);
Ocl2Inspire o2i;
ExpressionPtr fun = o2i.getClCreateBuffer(copyPtr, core::types::isNullPtrExpression(errcode_ret), builder);
vector<ExpressionPtr> args;
args.push_back(builder.getTypeLiteral(type));
args.push_back(size);
if(copyPtr) args.push_back(hostPtr);
args.push_back(errcode_ret);
return builder.callExpr(builder.refType(builder.arrayType(type)), fun, args);
}
示例10: buildPtrDeref
ExpressionPtr buildPtrDeref(const ExpressionPtr& ptrExpr) {
assert_pred1(isPointer, ptrExpr) << "Trying to build ptr_deref from non-ptr type.";
IRBuilder builder(ptrExpr->getNodeManager());
auto& pExt = ptrExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrDeref(), ptrExpr);
}
示例11: buildPtrFromRef
ExpressionPtr buildPtrFromRef(const ExpressionPtr& refExpr) {
assert_pred1(isReference, refExpr) << "Trying to build ptr from non-ref.";
IRBuilder builder(refExpr->getNodeManager());
auto& pExt = refExpr->getNodeManager().getLangExtension<PointerExtension>();
return builder.callExpr(pExt.getPtrFromRef(), refExpr);
}