-//===-- Lower/IntrinsicCall.h -- lowering of intrinsics ---------*- C++ -*-===//
+//===-- Builder/IntrinsicCall.h -- lowering of intrinsics -------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include <optional>
-namespace Fortran::lower {
+namespace fir {
class StatementContext;
mlir::Value genPow(fir::FirOpBuilder &, mlir::Location, mlir::Type resultType,
mlir::Value x, mlir::Value y);
-} // namespace Fortran::lower
+} // namespace fir
#endif // FORTRAN_LOWER_INTRINSICCALL_H
CustomIntrinsicCall.cpp
DumpEvaluateExpr.cpp
HostAssociations.cpp
- IntrinsicCall.cpp
IO.cpp
IterationSpace.cpp
LoweringOptions.cpp
#include "flang/Lower/ConvertExprToHLFIR.h"
#include "flang/Lower/ConvertVariable.h"
#include "flang/Lower/CustomIntrinsicCall.h"
-#include "flang/Lower/IntrinsicCall.h"
#include "flang/Lower/StatementContext.h"
#include "flang/Lower/SymbolMap.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/Character.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
#include "flang/Optimizer/Builder/MutableBox.h"
#include "flang/Optimizer/Builder/Runtime/Derived.h"
/// Lower calls to intrinsic procedures with actual arguments that have been
/// pre-lowered but have not yet been prepared according to the interface.
-static std::optional<hlfir::EntityWithAttributes> genIntrinsicRefCore(
- PreparedActualArguments &loweredActuals,
- const Fortran::evaluate::SpecificIntrinsic &intrinsic,
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering,
- CallContext &callContext) {
+static std::optional<hlfir::EntityWithAttributes>
+genIntrinsicRefCore(PreparedActualArguments &loweredActuals,
+ const Fortran::evaluate::SpecificIntrinsic &intrinsic,
+ const fir::IntrinsicArgumentLoweringRules *argLowering,
+ CallContext &callContext) {
llvm::SmallVector<fir::ExtendedValue> operands;
auto &stmtCtx = callContext.stmtCtx;
auto &converter = callContext.converter;
mlir::Location loc = callContext.loc;
for (auto arg : llvm::enumerate(loweredActuals)) {
if (!arg.value()) {
- operands.emplace_back(Fortran::lower::getAbsentIntrinsicArgument());
+ operands.emplace_back(fir::getAbsentIntrinsicArgument());
continue;
}
if (arg.value()->handleDynamicOptional())
continue;
}
// Ad-hoc argument lowering handling.
- Fortran::lower::ArgLoweringRule argRules =
- Fortran::lower::lowerIntrinsicArgumentAs(*argLowering, arg.index());
+ fir::ArgLoweringRule argRules =
+ fir::lowerIntrinsicArgumentAs(*argLowering, arg.index());
switch (argRules.lowerAs) {
- case Fortran::lower::LowerIntrinsicArgAs::Value:
+ case fir::LowerIntrinsicArgAs::Value:
operands.emplace_back(
Fortran::lower::convertToValue(loc, converter, actual, stmtCtx));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Addr:
+ case fir::LowerIntrinsicArgAs::Addr:
operands.emplace_back(
Fortran::lower::convertToAddress(loc, converter, actual, stmtCtx));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Box:
+ case fir::LowerIntrinsicArgAs::Box:
operands.emplace_back(
Fortran::lower::convertToBox(loc, converter, actual, stmtCtx));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Inquired:
+ case fir::LowerIntrinsicArgAs::Inquired:
// Place hlfir.expr in memory, and unbox fir.boxchar. Other entities
// are translated to fir::ExtendedValue without transformation (notably,
// pointers/allocatable are not dereferenced).
if (callContext.resultType)
scalarResultType = hlfir::getFortranElementType(*callContext.resultType);
// Let the intrinsic library lower the intrinsic procedure call.
- auto [resultExv, mustBeFreed] = Fortran::lower::genIntrinsicCall(
- callContext.getBuilder(), loc, intrinsic.name, scalarResultType,
- operands);
+ auto [resultExv, mustBeFreed] =
+ genIntrinsicCall(callContext.getBuilder(), loc, intrinsic.name,
+ scalarResultType, operands);
if (!fir::getBase(resultExv))
return std::nullopt;
hlfir::EntityWithAttributes resultEntity = extendedValueToHlfirEntity(
public:
ElementalIntrinsicCallBuilder(
const Fortran::evaluate::SpecificIntrinsic &intrinsic,
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering,
- bool isFunction)
+ const fir::IntrinsicArgumentLoweringRules *argLowering, bool isFunction)
: intrinsic{intrinsic}, argLowering{argLowering}, isFunction{isFunction} {
}
std::optional<hlfir::Entity>
private:
const Fortran::evaluate::SpecificIntrinsic &intrinsic;
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering;
+ const fir::IntrinsicArgumentLoweringRules *argLowering;
const bool isFunction;
};
} // namespace
TODO(loc, "special cases of intrinsic with optional arguments");
PreparedActualArguments loweredActuals;
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering =
- Fortran::lower::getIntrinsicArgumentLowering(intrinsic.name);
+ const fir::IntrinsicArgumentLoweringRules *argLowering =
+ fir::getIntrinsicArgumentLowering(intrinsic.name);
for (const auto &arg : llvm::enumerate(callContext.procRef.arguments())) {
auto *expr =
Fortran::evaluate::UnwrapExpr<Fortran::lower::SomeExpr>(arg.value());
callContext.stmtCtx);
std::optional<mlir::Value> isPresent;
if (argLowering) {
- Fortran::lower::ArgLoweringRule argRules =
- Fortran::lower::lowerIntrinsicArgumentAs(*argLowering, arg.index());
+ fir::ArgLoweringRule argRules =
+ fir::lowerIntrinsicArgumentAs(*argLowering, arg.index());
if (argRules.handleDynamicOptional)
isPresent =
genIsPresentIfArgMaybeAbsent(loc, loweredActual, *expr, callContext,
#include "flang/Lower/ConvertVariable.h"
#include "flang/Lower/CustomIntrinsicCall.h"
#include "flang/Lower/DumpEvaluateExpr.h"
-#include "flang/Lower/IntrinsicCall.h"
#include "flang/Lower/Mangler.h"
#include "flang/Lower/Runtime.h"
#include "flang/Lower/Support/Utils.h"
#include "flang/Optimizer/Builder/Character.h"
#include "flang/Optimizer/Builder/Complex.h"
#include "flang/Optimizer/Builder/Factory.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Optimizer/Builder/Runtime/Assign.h"
#include "flang/Optimizer/Builder/Runtime/Character.h"
#include "flang/Optimizer/Builder/Runtime/Derived.h"
converter.getFoldingContext().intrinsics().GetGenericIntrinsicName(
intrinsic->name);
mlir::SymbolRefAttr symbolRefAttr =
- Fortran::lower::getUnrestrictedIntrinsicSymbolRefAttr(
- builder, loc, genericName, signature);
+ fir::getUnrestrictedIntrinsicSymbolRefAttr(builder, loc, genericName,
+ signature);
mlir::Value funcPtr =
builder.create<fir::AddrOfOp>(loc, signature, symbolRefAttr);
return funcPtr;
mlir::Type ty = converter.genType(TC, KIND);
mlir::Value lhs = genunbox(op.left());
mlir::Value rhs = genunbox(op.right());
- return Fortran::lower::genPow(builder, getLoc(), ty, lhs, rhs);
+ return fir::genPow(builder, getLoc(), ty, lhs, rhs);
}
template <Fortran::common::TypeCategory TC, int KIND>
mlir::Type ty = converter.genType(TC, KIND);
mlir::Value lhs = genunbox(op.left());
mlir::Value rhs = genunbox(op.right());
- return Fortran::lower::genPow(builder, getLoc(), ty, lhs, rhs);
+ return fir::genPow(builder, getLoc(), ty, lhs, rhs);
}
template <int KIND>
mlir::Value rhs = genunbox(op.right());
switch (op.ordering) {
case Fortran::evaluate::Ordering::Greater:
- return Fortran::lower::genMax(builder, getLoc(),
- llvm::ArrayRef<mlir::Value>{lhs, rhs});
+ return fir::genMax(builder, getLoc(),
+ llvm::ArrayRef<mlir::Value>{lhs, rhs});
case Fortran::evaluate::Ordering::Less:
- return Fortran::lower::genMin(builder, getLoc(),
- llvm::ArrayRef<mlir::Value>{lhs, rhs});
+ return fir::genMin(builder, getLoc(),
+ llvm::ArrayRef<mlir::Value>{lhs, rhs});
case Fortran::evaluate::Ordering::Equal:
llvm_unreachable("Equal is not a valid ordering in this context");
}
operands.size(), stmtCtx);
}
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering =
- Fortran::lower::getIntrinsicArgumentLowering(name);
+ const fir::IntrinsicArgumentLoweringRules *argLowering =
+ fir::getIntrinsicArgumentLowering(name);
for (const auto &arg : llvm::enumerate(procRef.arguments())) {
auto *expr =
Fortran::evaluate::UnwrapExpr<Fortran::lower::SomeExpr>(arg.value());
if (!expr) {
// Absent optional.
- operands.emplace_back(Fortran::lower::getAbsentIntrinsicArgument());
+ operands.emplace_back(fir::getAbsentIntrinsicArgument());
continue;
}
if (!argLowering) {
continue;
}
// Ad-hoc argument lowering handling.
- Fortran::lower::ArgLoweringRule argRules =
- Fortran::lower::lowerIntrinsicArgumentAs(*argLowering, arg.index());
+ fir::ArgLoweringRule argRules =
+ fir::lowerIntrinsicArgumentAs(*argLowering, arg.index());
if (argRules.handleDynamicOptional &&
Fortran::evaluate::MayBePassedAsAbsentOptional(
*expr, converter.getFoldingContext())) {
ExtValue optional = lowerIntrinsicArgumentAsInquired(*expr);
mlir::Value isPresent = genActualIsPresentTest(builder, loc, optional);
switch (argRules.lowerAs) {
- case Fortran::lower::LowerIntrinsicArgAs::Value:
+ case fir::LowerIntrinsicArgAs::Value:
operands.emplace_back(
genOptionalValue(builder, loc, optional, isPresent));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Addr:
+ case fir::LowerIntrinsicArgAs::Addr:
operands.emplace_back(
genOptionalAddr(builder, loc, optional, isPresent));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Box:
+ case fir::LowerIntrinsicArgAs::Box:
operands.emplace_back(
genOptionalBox(builder, loc, optional, isPresent));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Inquired:
+ case fir::LowerIntrinsicArgAs::Inquired:
operands.emplace_back(optional);
continue;
}
llvm_unreachable("bad switch");
}
switch (argRules.lowerAs) {
- case Fortran::lower::LowerIntrinsicArgAs::Value:
+ case fir::LowerIntrinsicArgAs::Value:
operands.emplace_back(genval(*expr));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Addr:
+ case fir::LowerIntrinsicArgAs::Addr:
operands.emplace_back(gen(*expr));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Box:
+ case fir::LowerIntrinsicArgAs::Box:
operands.emplace_back(lowerIntrinsicArgumentAsBox(*expr));
continue;
- case Fortran::lower::LowerIntrinsicArgAs::Inquired:
+ case fir::LowerIntrinsicArgAs::Inquired:
operands.emplace_back(lowerIntrinsicArgumentAsInquired(*expr));
continue;
}
std::string name =
intrinsic ? intrinsic->name
: procRef.proc().GetSymbol()->GetUltimate().name().ToString();
- const Fortran::lower::IntrinsicArgumentLoweringRules *argLowering =
- Fortran::lower::getIntrinsicArgumentLowering(name);
+ const fir::IntrinsicArgumentLoweringRules *argLowering =
+ fir::getIntrinsicArgumentLowering(name);
mlir::Location loc = getLoc();
if (intrinsic && Fortran::lower::intrinsicRequiresCustomOptionalHandling(
procRef, *intrinsic, converter)) {
operands.emplace_back(genElementalArgument(*expr));
} else {
// Ad-hoc argument lowering handling.
- Fortran::lower::ArgLoweringRule argRules =
- Fortran::lower::lowerIntrinsicArgumentAs(*argLowering, arg.index());
+ fir::ArgLoweringRule argRules =
+ fir::lowerIntrinsicArgumentAs(*argLowering, arg.index());
if (argRules.handleDynamicOptional &&
Fortran::evaluate::MayBePassedAsAbsentOptional(
*expr, converter.getFoldingContext())) {
// Currently, there is not elemental intrinsic that requires lowering
// a potentially absent argument to something else than a value (apart
// from character MAX/MIN that are handled elsewhere.)
- if (argRules.lowerAs != Fortran::lower::LowerIntrinsicArgAs::Value)
+ if (argRules.lowerAs != fir::LowerIntrinsicArgAs::Value)
TODO(loc, "non trivial optional elemental intrinsic array "
"argument");
PushSemantics(ConstituentSemantics::RefTransparent);
continue;
}
switch (argRules.lowerAs) {
- case Fortran::lower::LowerIntrinsicArgAs::Value: {
+ case fir::LowerIntrinsicArgAs::Value: {
PushSemantics(ConstituentSemantics::RefTransparent);
operands.emplace_back(genElementalArgument(*expr));
} break;
- case Fortran::lower::LowerIntrinsicArgAs::Addr: {
+ case fir::LowerIntrinsicArgAs::Addr: {
// Note: assume does not have Fortran VALUE attribute semantics.
PushSemantics(ConstituentSemantics::RefOpaque);
operands.emplace_back(genElementalArgument(*expr));
} break;
- case Fortran::lower::LowerIntrinsicArgAs::Box: {
+ case fir::LowerIntrinsicArgAs::Box: {
PushSemantics(ConstituentSemantics::RefOpaque);
auto lambda = genElementalArgument(*expr);
operands.emplace_back([=](IterSpace iters) {
return builder.createBox(loc, lambda(iters));
});
} break;
- case Fortran::lower::LowerIntrinsicArgAs::Inquired:
+ case fir::LowerIntrinsicArgAs::Inquired:
TODO(loc, "intrinsic function with inquired argument");
break;
}
return [=](IterSpace iters) -> ExtValue {
mlir::Value lhs = fir::getBase(lf(iters));
mlir::Value rhs = fir::getBase(rf(iters));
- return Fortran::lower::genPow(builder, loc, ty, lhs, rhs);
+ return fir::genPow(builder, loc, ty, lhs, rhs);
};
}
template <Fortran::common::TypeCategory TC, int KIND>
return [=](IterSpace iters) -> ExtValue {
mlir::Value lhs = fir::getBase(lf(iters));
mlir::Value rhs = fir::getBase(rf(iters));
- return Fortran::lower::genMax(builder, loc,
- llvm::ArrayRef<mlir::Value>{lhs, rhs});
+ return fir::genMax(builder, loc, llvm::ArrayRef<mlir::Value>{lhs, rhs});
};
case Fortran::evaluate::Ordering::Less:
return [=](IterSpace iters) -> ExtValue {
mlir::Value lhs = fir::getBase(lf(iters));
mlir::Value rhs = fir::getBase(rf(iters));
- return Fortran::lower::genMin(builder, loc,
- llvm::ArrayRef<mlir::Value>{lhs, rhs});
+ return fir::genMin(builder, loc, llvm::ArrayRef<mlir::Value>{lhs, rhs});
};
case Fortran::evaluate::Ordering::Equal:
llvm_unreachable("Equal is not a valid ordering in this context");
return [=](IterSpace iters) {
mlir::Value lhs = fir::getBase(lf(iters));
mlir::Value rhs = fir::getBase(rf(iters));
- return Fortran::lower::genPow(builder, loc, ty, lhs, rhs);
+ return fir::genPow(builder, loc, ty, lhs, rhs);
};
}
template <int KIND>
#include "flang/Lower/ConvertConstant.h"
#include "flang/Lower/ConvertType.h"
#include "flang/Lower/ConvertVariable.h"
-#include "flang/Lower/IntrinsicCall.h"
#include "flang/Lower/StatementContext.h"
#include "flang/Lower/SymbolMap.h"
#include "flang/Optimizer/Builder/Complex.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Optimizer/Builder/MutableBox.h"
#include "flang/Optimizer/Builder/Runtime/Character.h"
#include "flang/Optimizer/Builder/Todo.h"
hlfir::Entity lhs, hlfir::Entity rhs) {
mlir::Type ty = Fortran::lower::getFIRType(builder.getContext(), TC, KIND,
/*params=*/std::nullopt);
- return hlfir::EntityWithAttributes{
- Fortran::lower::genPow(builder, loc, ty, lhs, rhs)};
+ return hlfir::EntityWithAttributes{fir::genPow(builder, loc, ty, lhs, rhs)};
}
};
hlfir::Entity lhs, hlfir::Entity rhs) {
mlir::Type ty = Fortran::lower::getFIRType(builder.getContext(), TC, KIND,
/*params=*/std::nullopt);
- return hlfir::EntityWithAttributes{
- Fortran::lower::genPow(builder, loc, ty, lhs, rhs)};
+ return hlfir::EntityWithAttributes{fir::genPow(builder, loc, ty, lhs, rhs)};
}
};
hlfir::Entity rhs) {
llvm::SmallVector<mlir::Value, 2> args{lhs, rhs};
fir::ExtendedValue res = op.ordering == Fortran::evaluate::Ordering::Greater
- ? Fortran::lower::genMax(builder, loc, args)
- : Fortran::lower::genMin(builder, loc, args);
+ ? fir::genMax(builder, loc, args)
+ : fir::genMin(builder, loc, args);
return hlfir::EntityWithAttributes{fir::getBase(res)};
}
};
#include "flang/Lower/ConvertConstant.h"
#include "flang/Lower/ConvertExpr.h"
#include "flang/Lower/ConvertExprToHLFIR.h"
-#include "flang/Lower/IntrinsicCall.h"
#include "flang/Lower/Mangler.h"
#include "flang/Lower/PFTBuilder.h"
#include "flang/Lower/StatementContext.h"
#include "flang/Optimizer/Builder/Character.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/HLFIRTools.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Optimizer/Builder/Runtime/Derived.h"
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/Dialect/FIRAttr.h"
#include "flang/Evaluate/expression.h"
#include "flang/Evaluate/fold.h"
#include "flang/Evaluate/tools.h"
-#include "flang/Lower/IntrinsicCall.h"
#include "flang/Lower/StatementContext.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Optimizer/Builder/Todo.h"
#include <optional>
llvm::ArrayRef<fir::ExtendedValue> args,
Fortran::lower::StatementContext &stmtCtx) {
auto [result, mustBeFreed] =
- Fortran::lower::genIntrinsicCall(builder, loc, name, resultType, args);
+ fir::genIntrinsicCall(builder, loc, name, resultType, args);
if (mustBeFreed) {
mlir::Value addr = fir::getBase(result);
if (auto *box = result.getBoxOf<fir::BoxValue>())
DoLoopHelper.cpp
FIRBuilder.cpp
HLFIRTools.cpp
+ IntrinsicCall.cpp
LowLevelIntrinsics.cpp
MutableBox.cpp
Runtime/Allocatable.cpp
//
//===----------------------------------------------------------------------===//
-#include "flang/Lower/IntrinsicCall.h"
+#include "flang/Optimizer/Builder/IntrinsicCall.h"
#include "flang/Common/static-multimap-view.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/Character.h"
// possible to implement it without some target dependent runtime.
};
-fir::ExtendedValue Fortran::lower::getAbsentIntrinsicArgument() {
+fir::ExtendedValue fir::getAbsentIntrinsicArgument() {
return fir::UnboxedValue{};
}
struct IntrinsicDummyArgument {
const char *name = nullptr;
- Fortran::lower::LowerIntrinsicArgAs lowerAs =
- Fortran::lower::LowerIntrinsicArgAs::Value;
+ fir::LowerIntrinsicArgAs lowerAs = fir::LowerIntrinsicArgAs::Value;
bool handleDynamicOptional = false;
};
/// This is shared by intrinsics and intrinsic module procedures.
-struct Fortran::lower::IntrinsicArgumentLoweringRules {
+struct fir::IntrinsicArgumentLoweringRules {
/// There is no more than 7 non repeated arguments in Fortran intrinsics.
IntrinsicDummyArgument args[7];
constexpr bool hasDefaultRules() const { return args[0].name == nullptr; }
const char *name;
IntrinsicLibrary::Generator generator;
// The following may be omitted in the table below.
- Fortran::lower::IntrinsicArgumentLoweringRules argLoweringRules = {};
+ fir::IntrinsicArgumentLoweringRules argLoweringRules = {};
bool isElemental = true;
/// Code heavy intrinsic can be outlined to make FIR
/// more readable.
bool outline = false;
};
-constexpr auto asValue = Fortran::lower::LowerIntrinsicArgAs::Value;
-constexpr auto asAddr = Fortran::lower::LowerIntrinsicArgAs::Addr;
-constexpr auto asBox = Fortran::lower::LowerIntrinsicArgAs::Box;
-constexpr auto asInquired = Fortran::lower::LowerIntrinsicArgAs::Inquired;
+constexpr auto asValue = fir::LowerIntrinsicArgAs::Value;
+constexpr auto asAddr = fir::LowerIntrinsicArgAs::Addr;
+constexpr auto asBox = fir::LowerIntrinsicArgAs::Box;
+constexpr auto asInquired = fir::LowerIntrinsicArgAs::Inquired;
using I = IntrinsicLibrary;
/// Flag to indicate that an intrinsic argument has to be handled as
// procedure.
//===----------------------------------------------------------------------===//
-const Fortran::lower::IntrinsicArgumentLoweringRules *
-Fortran::lower::getIntrinsicArgumentLowering(llvm::StringRef specificName) {
+const fir::IntrinsicArgumentLoweringRules *
+fir::getIntrinsicArgumentLowering(llvm::StringRef specificName) {
llvm::StringRef name = genericName(specificName);
if (const IntrinsicHandler *handler = findIntrinsicHandler(name))
if (!handler->argLoweringRules.hasDefaultRules())
/// Return how argument \p argName should be lowered given the rules for the
/// intrinsic function.
-Fortran::lower::ArgLoweringRule Fortran::lower::lowerIntrinsicArgumentAs(
- const IntrinsicArgumentLoweringRules &rules, unsigned position) {
+fir::ArgLoweringRule
+fir::lowerIntrinsicArgumentAs(const IntrinsicArgumentLoweringRules &rules,
+ unsigned position) {
assert(position < sizeof(rules.args) / (sizeof(decltype(*rules.args))) &&
"invalid argument");
return {rules.args[position].lowerAs,
//===----------------------------------------------------------------------===//
std::pair<fir::ExtendedValue, bool>
-Fortran::lower::genIntrinsicCall(fir::FirOpBuilder &builder, mlir::Location loc,
- llvm::StringRef name,
- std::optional<mlir::Type> resultType,
- llvm::ArrayRef<fir::ExtendedValue> args) {
+fir::genIntrinsicCall(fir::FirOpBuilder &builder, mlir::Location loc,
+ llvm::StringRef name,
+ std::optional<mlir::Type> resultType,
+ llvm::ArrayRef<fir::ExtendedValue> args) {
return IntrinsicLibrary{builder, loc}.genIntrinsicCall(name, resultType,
args);
}
-mlir::Value Fortran::lower::genMax(fir::FirOpBuilder &builder,
- mlir::Location loc,
- llvm::ArrayRef<mlir::Value> args) {
+mlir::Value fir::genMax(fir::FirOpBuilder &builder, mlir::Location loc,
+ llvm::ArrayRef<mlir::Value> args) {
assert(args.size() > 0 && "max requires at least one argument");
return IntrinsicLibrary{builder, loc}
.genExtremum<Extremum::Max, ExtremumBehavior::MinMaxss>(args[0].getType(),
args);
}
-mlir::Value Fortran::lower::genMin(fir::FirOpBuilder &builder,
- mlir::Location loc,
- llvm::ArrayRef<mlir::Value> args) {
+mlir::Value fir::genMin(fir::FirOpBuilder &builder, mlir::Location loc,
+ llvm::ArrayRef<mlir::Value> args) {
assert(args.size() > 0 && "min requires at least one argument");
return IntrinsicLibrary{builder, loc}
.genExtremum<Extremum::Min, ExtremumBehavior::MinMaxss>(args[0].getType(),
args);
}
-mlir::Value Fortran::lower::genPow(fir::FirOpBuilder &builder,
- mlir::Location loc, mlir::Type type,
- mlir::Value x, mlir::Value y) {
+mlir::Value fir::genPow(fir::FirOpBuilder &builder, mlir::Location loc,
+ mlir::Type type, mlir::Value x, mlir::Value y) {
// TODO: since there is no libm version of pow with integer exponent,
// we have to provide an alternative implementation for
// "precise/strict" FP mode.
return IntrinsicLibrary{builder, loc}.genRuntimeCall("pow", type, {x, y});
}
-mlir::SymbolRefAttr Fortran::lower::getUnrestrictedIntrinsicSymbolRefAttr(
+mlir::SymbolRefAttr fir::getUnrestrictedIntrinsicSymbolRefAttr(
fir::FirOpBuilder &builder, mlir::Location loc, llvm::StringRef name,
mlir::FunctionType signature) {
return IntrinsicLibrary{builder, loc}.getUnrestrictedIntrinsicSymbolRefAttr(