Lines Matching defs:context
98 FoldingContext &context, Scalar<TA>... args) -> Scalar<TR> {
102 (*hostWrapper)(context, std::move(genericArgs)))
136 Expr<T> FoldOperation(FoldingContext &context, Designator<T> &&designator) {
137 return Folder<T>{context}.Folding(std::move(designator));
142 FoldingContext &context, ImpliedDoIndex &&);
435 FoldingContext &context, ActualArguments &arguments,
439 Folder<A>{context, hasOptionalArgument}.Folding(arguments.at(I))...};
449 FoldingContext &context, ActualArguments &args, bool hasOptionalArgument) {
451 context, args, hasOptionalArgument, std::index_sequence_for<A...>{});
456 FoldingContext &context, ActualArguments &args, bool hasOptionalArgument,
459 GetConstantArguments<A...>(context, args, hasOptionalArgument)}) {
469 FoldingContext &context, ActualArguments &args, bool hasOptionalArgument) {
471 context, args, hasOptionalArgument, std::index_sequence_for<A...>{});
486 Expr<TR> FoldElementalIntrinsicHelper(FoldingContext &context,
491 context, funcRef.arguments(), hasOptionalArgument)}) {
508 context.messages().Say(
520 context.messages().Say(
532 func(context, std::get<I>(*args)->At(argIndex[I])...));
560 Expr<TR> FoldElementalIntrinsic(FoldingContext &context,
563 return FoldElementalIntrinsicHelper<ScalarFunc, TR, TA...>(context,
568 Expr<TR> FoldElementalIntrinsic(FoldingContext &context,
571 return FoldElementalIntrinsicHelper<ScalarFuncWithContext, TR, TA...>(context,
1107 FoldingContext &context, FunctionRef<T> &&funcRef, Ordering order) {
1115 Folder<T> folder{context};
1128 if (!context.moduleFileName()) {
1134 *argExpr = Fold(context, std::move(*argExpr));
1139 context, Extremum<T>{order, std::move(*result), Expr<T>{*tExpr}});
1159 FoldingContext &context, FunctionRef<T> &&funcRef) {
1191 return Fold(context, ConvertToType<T>(AsCategoryExpr(std::move(maxRef))));
1205 FoldingContext &context, FunctionRef<Type<TypeCategory::Integer, KIND>> &&);
1208 FoldingContext &context,
1212 FoldingContext &context, FunctionRef<Type<TypeCategory::Real, KIND>> &&);
1215 FoldingContext &context, FunctionRef<Type<TypeCategory::Complex, KIND>> &&);
1218 FoldingContext &context, FunctionRef<Type<TypeCategory::Logical, KIND>> &&);
1221 Expr<T> FoldOperation(FoldingContext &context, FunctionRef<T> &&funcRef) {
1229 *expr = Fold(context, std::move(*expr));
1236 return Folder<T>{context}.CSHIFT(std::move(funcRef));
1238 return Folder<T>{context}.EOSHIFT(std::move(funcRef));
1240 return Folder<T>{context}.MERGE(std::move(funcRef));
1242 return Folder<T>{context}.PACK(std::move(funcRef));
1244 return Folder<T>{context}.RESHAPE(std::move(funcRef));
1246 return Folder<T>{context}.SPREAD(std::move(funcRef));
1248 return Folder<T>{context}.TRANSFER(std::move(funcRef));
1250 return Folder<T>{context}.TRANSPOSE(std::move(funcRef));
1252 return Folder<T>{context}.UNPACK(std::move(funcRef));
1256 return FoldIntrinsicFunction(context, std::move(funcRef));
1365 Expr<T> FoldOperation(FoldingContext &context, ArrayConstructor<T> &&array) {
1366 return ArrayConstructorFolder<T>{context}.FoldArray(std::move(array));
1429 FoldingContext &context, ArrayConstructor<T> &&values, const Shape &shape) {
1430 if (auto constShape{AsConstantExtents(context, shape)};
1432 Expr<T> result{Fold(context, Expr<T>{std::move(values)})};
1438 if (auto elements{GetShape(context, result)}) {
1439 if (auto constElements{AsConstantExtents(context, *elements)}) {
1462 std::optional<Expr<RESULT>> MapOperation(FoldingContext &context,
1474 result.Push(Fold(context, f(Expr<OPERAND>{std::move(scalar)})));
1482 result.Push(Fold(context, f(std::move(scalar))));
1490 return FromArrayConstructor(context, std::move(result), shape);
1506 bool ShapesMatch(FoldingContext &context,
1517 std::optional<Shape> leftShape{GetShape(context, leftExpr)};
1518 std::optional<Shape> rightShape{GetShape(context, rightExpr)};
1529 auto MapOperation(FoldingContext &context,
1542 if (!ShapesMatch(context, leftArrConst, rightArrConst)) {
1550 result.Push(Fold(context,
1562 if (!ShapesMatch(context, leftArrConst, rightArrConst)) {
1571 Fold(context, f(std::move(leftScalar), std::move(rightScalar))));
1575 return FromArrayConstructor(context, std::move(result), shape);
1580 auto MapOperation(FoldingContext &context,
1590 Fold(context, f(std::move(leftScalar), Expr<RIGHT>{rightScalar})));
1592 return FromArrayConstructor(context, std::move(result), shape);
1597 auto MapOperation(FoldingContext &context,
1610 result.Push(Fold(context,
1621 Fold(context, f(Expr<LEFT>{leftScalar}, std::move(rightScalar))));
1624 return FromArrayConstructor(context, std::move(result), shape);
1641 auto ApplyElementwise(FoldingContext &context,
1646 expr = Fold(context, std::move(expr));
1648 if (std::optional<Shape> shape{GetShape(context, expr)}) {
1650 return MapOperation(context, std::move(f), *shape,
1660 FoldingContext &context, Operation<DERIVED, RESULT, OPERAND> &operation)
1662 return ApplyElementwise(context, operation,
1670 auto ApplyElementwise(FoldingContext &context,
1681 leftExpr = Fold(context, std::move(leftExpr));
1682 rightExpr = Fold(context, std::move(rightExpr));
1684 if (std::optional<Shape> leftShape{GetShape(context, leftExpr)}) {
1687 if (std::optional<Shape> rightShape{GetShape(context, rightExpr)}) {
1689 if (CheckConformance(context.messages(), *leftShape, *rightShape,
1692 return MapOperation(context, std::move(f), *leftShape,
1698 return MapOperation(context, std::move(f), *leftShape,
1702 } else if (IsExpandableScalar(rightExpr, context, *leftShape)) {
1703 return MapOperation(context, std::move(f), *leftShape,
1709 if (std::optional<Shape> rightShape{GetShape(context, rightExpr)}) {
1710 if (IsExpandableScalar(leftExpr, context, *rightShape)) {
1712 return MapOperation(context, std::move(f), *rightShape,
1723 FoldingContext &context, Operation<DERIVED, RESULT, LEFT, RIGHT> &operation)
1725 return ApplyElementwise(context, operation,
1754 FoldingContext &context, Convert<TO, FROMCAT> &&convert) {
1755 if (auto array{ApplyElementwise(context, convert)}) {
1759 FoldingContext &context;
1761 } msvcWorkaround{context, convert};
1771 FoldingContext &ctx{msvcWorkaround.context};
1776 msvcWorkaround.context.languageFeatures().ShouldWarn(
1787 msvcWorkaround.context.languageFeatures().ShouldWarn(
1797 if (msvcWorkaround.context.languageFeatures().ShouldWarn(
1897 Expr<T> FoldOperation(FoldingContext &context, Parentheses<T> &&x) {
1899 operand = Fold(context, std::move(operand));
1912 Expr<T> FoldOperation(FoldingContext &context, Negate<T> &&x) {
1913 if (auto array{ApplyElementwise(context, x)}) {
1920 return FoldOperation(context, Parentheses<T>{std::move(nn->left())});
1928 context.languageFeatures().ShouldWarn(
1930 context.messages().Say(common::UsageWarning::FoldingException,
1964 Expr<T> FoldOperation(FoldingContext &context, Add<T> &&x) {
1965 if (auto array{ApplyElementwise(context, x)}) {
1972 context.languageFeatures().ShouldWarn(
1974 context.messages().Say(common::UsageWarning::FoldingException,
1983 folded->second, context.targetCharacteristics().roundingMode())};
1984 RealFlagWarnings(context, sum.flags, "addition");
1985 if (context.targetCharacteristics().areSubnormalsFlushedToZero()) {
1995 Expr<T> FoldOperation(FoldingContext &context, Subtract<T> &&x) {
1996 if (auto array{ApplyElementwise(context, x)}) {
2003 context.languageFeatures().ShouldWarn(
2005 context.messages().Say(common::UsageWarning::FoldingException,
2014 folded->second, context.targetCharacteristics().roundingMode())};
2015 RealFlagWarnings(context, difference.flags, "subtraction");
2016 if (context.targetCharacteristics().areSubnormalsFlushedToZero()) {
2026 Expr<T> FoldOperation(FoldingContext &context, Multiply<T> &&x) {
2027 if (auto array{ApplyElementwise(context, x)}) {
2034 context.languageFeatures().ShouldWarn(
2036 context.messages().Say(common::UsageWarning::FoldingException,
2045 folded->second, context.targetCharacteristics().roundingMode())};
2046 RealFlagWarnings(context, product.flags, "multiplication");
2047 if (context.targetCharacteristics().areSubnormalsFlushedToZero()) {
2062 return FoldOperation(context, Parentheses<T>{std::move(x.right())});
2067 return FoldOperation(context, Negate<T>{std::move(x.right())});
2075 Expr<T> FoldOperation(FoldingContext &context, Divide<T> &&x) {
2076 if (auto array{ApplyElementwise(context, x)}) {
2083 if (context.languageFeatures().ShouldWarn(
2085 context.messages().Say(common::UsageWarning::FoldingException,
2091 context.languageFeatures().ShouldWarn(
2093 context.messages().Say(common::UsageWarning::FoldingException,
2100 if (context.languageFeatures().ShouldWarn(
2102 context.messages().Say(common::UsageWarning::FoldingException,
2110 folded->second, context.targetCharacteristics().roundingMode())};
2116 if (folded->second.IsZero() && context.moduleFileName().has_value()) {
2125 RealFlagWarnings(context, quotient.flags, "division");
2127 if (context.targetCharacteristics().areSubnormalsFlushedToZero()) {
2137 Expr<T> FoldOperation(FoldingContext &context, Power<T> &&x) {
2138 if (auto array{ApplyElementwise(context, x)}) {
2144 if (context.languageFeatures().ShouldWarn(
2147 context.messages().Say(common::UsageWarning::FoldingException,
2150 context.messages().Say(common::UsageWarning::FoldingException,
2153 context.messages().Say(common::UsageWarning::FoldingException,
2161 Constant<T>{(*callable)(context, folded->first, folded->second)}};
2162 } else if (context.languageFeatures().ShouldWarn(
2164 context.messages().Say(common::UsageWarning::FoldingFailure,
2174 Expr<T> FoldOperation(FoldingContext &context, RealToIntPower<T> &&x) {
2175 if (auto array{ApplyElementwise(context, x)}) {
2182 RealFlagWarnings(context, power.flags, "power with INTEGER exponent");
2183 if (context.targetCharacteristics().areSubnormalsFlushedToZero()) {
2195 Expr<T> FoldOperation(FoldingContext &context, Extremum<T> &&x) {
2196 if (auto array{ApplyElementwise(context, x,
2237 FoldingContext &context, Expr<SomeType> &&expr) {
2252 context.languageFeatures().ShouldWarn(
2254 context.messages().Say(common::UsageWarning::FoldingValueChecks,
2258 result = Fold(context, ConvertToType<Result>(std::move(x)));
2270 FoldingContext &context, ComplexComponent<KIND> &&x) {
2273 if (auto array{ApplyElementwise(context, x,
2293 Expr<T> ExpressionBase<T>::Rewrite(FoldingContext &context, Expr<T> &&expr) {
2297 return FoldOperation(context, std::move(x));
2299 return FoldOperation(context, std::move(x));
2304 return Expr<T>{Fold(context, std::move(x))};