Skip to content

Commit ae0e5a5

Browse files
committed
Revert "[flang] Support lowering of intrinsic GET_COMMAND"
This reverts commit 86ea67e.
1 parent 94bb511 commit ae0e5a5

File tree

4 files changed

+0
-193
lines changed

4 files changed

+0
-193
lines changed

flang/include/flang/Optimizer/Builder/Runtime/Command.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ namespace fir::runtime {
2323
/// Generate call to COMMAND_ARGUMENT_COUNT intrinsic runtime routine.
2424
mlir::Value genCommandArgumentCount(fir::FirOpBuilder &, mlir::Location);
2525

26-
/// Generate a call to the GetCommand runtime function which implements the
27-
/// GET_COMMAND intrinsic.
28-
/// \p command, \p length and \p errmsg must be fir.box that can be absent (but
29-
/// not null mlir values). The status value is returned.
30-
mlir::Value genGetCommand(fir::FirOpBuilder &, mlir::Location,
31-
mlir::Value command, mlir::Value length,
32-
mlir::Value errmsg);
33-
3426
/// Generate a call to the GetCommandArgument runtime function which implements
3527
/// the GET_COMMAND_ARGUMENT intrinsic.
3628
/// \p value, \p length and \p errmsg must be fir.box that can be absent (but

flang/lib/Lower/IntrinsicCall.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ struct IntrinsicLibrary {
505505
mlir::Value genFloor(mlir::Type, llvm::ArrayRef<mlir::Value>);
506506
mlir::Value genFraction(mlir::Type resultType,
507507
mlir::ArrayRef<mlir::Value> args);
508-
void genGetCommand(mlir::ArrayRef<fir::ExtendedValue> args);
509508
void genGetCommandArgument(mlir::ArrayRef<fir::ExtendedValue> args);
510509
void genGetEnvironmentVariable(llvm::ArrayRef<fir::ExtendedValue>);
511510
fir::ExtendedValue genIall(mlir::Type, llvm::ArrayRef<fir::ExtendedValue>);
@@ -803,13 +802,6 @@ static constexpr IntrinsicHandler handlers[]{
803802
{"exponent", &I::genExponent},
804803
{"floor", &I::genFloor},
805804
{"fraction", &I::genFraction},
806-
{"get_command",
807-
&I::genGetCommand,
808-
{{{"command", asBox, handleDynamicOptional},
809-
{"length", asBox, handleDynamicOptional},
810-
{"status", asAddr, handleDynamicOptional},
811-
{"errmsg", asBox, handleDynamicOptional}}},
812-
/*isElemental=*/false},
813805
{"get_command_argument",
814806
&I::genGetCommandArgument,
815807
{{{"number", asValue},
@@ -3196,44 +3188,6 @@ mlir::Value IntrinsicLibrary::genFraction(mlir::Type resultType,
31963188
fir::runtime::genFraction(builder, loc, fir::getBase(args[0])));
31973189
}
31983190

3199-
// GET_COMMAND
3200-
void IntrinsicLibrary::genGetCommand(llvm::ArrayRef<fir::ExtendedValue> args) {
3201-
assert(args.size() == 4);
3202-
const fir::ExtendedValue &command = args[0];
3203-
const fir::ExtendedValue &length = args[1];
3204-
const fir::ExtendedValue &status = args[2];
3205-
const fir::ExtendedValue &errmsg = args[3];
3206-
3207-
// If none of the optional parameters are present, do nothing.
3208-
if (!isStaticallyPresent(command) && !isStaticallyPresent(length) &&
3209-
!isStaticallyPresent(status) && !isStaticallyPresent(errmsg))
3210-
return;
3211-
3212-
mlir::Type boxNoneTy = fir::BoxType::get(builder.getNoneType());
3213-
mlir::Value commandBox =
3214-
isStaticallyPresent(command)
3215-
? fir::getBase(command)
3216-
: builder.create<fir::AbsentOp>(loc, boxNoneTy).getResult();
3217-
mlir::Value lenBox =
3218-
isStaticallyPresent(length)
3219-
? fir::getBase(length)
3220-
: builder.create<fir::AbsentOp>(loc, boxNoneTy).getResult();
3221-
mlir::Value errBox =
3222-
isStaticallyPresent(errmsg)
3223-
? fir::getBase(errmsg)
3224-
: builder.create<fir::AbsentOp>(loc, boxNoneTy).getResult();
3225-
mlir::Value stat =
3226-
fir::runtime::genGetCommand(builder, loc, commandBox, lenBox, errBox);
3227-
if (isStaticallyPresent(status)) {
3228-
mlir::Value statAddr = fir::getBase(status);
3229-
mlir::Value statIsPresentAtRuntime =
3230-
builder.genIsNotNullAddr(loc, statAddr);
3231-
builder.genIfThen(loc, statIsPresentAtRuntime)
3232-
.genThen([&]() { builder.createStoreWithConvert(loc, stat, statAddr); })
3233-
.end();
3234-
}
3235-
}
3236-
32373191
// GET_COMMAND_ARGUMENT
32383192
void IntrinsicLibrary::genGetCommandArgument(
32393193
llvm::ArrayRef<fir::ExtendedValue> args) {

flang/lib/Optimizer/Builder/Runtime/Command.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ mlir::Value fir::runtime::genCommandArgumentCount(fir::FirOpBuilder &builder,
3232
return builder.create<fir::CallOp>(loc, argumentCountFunc).getResult(0);
3333
}
3434

35-
mlir::Value fir::runtime::genGetCommand(fir::FirOpBuilder &builder,
36-
mlir::Location loc, mlir::Value command,
37-
mlir::Value length,
38-
mlir::Value errmsg) {
39-
auto runtimeFunc =
40-
fir::runtime::getRuntimeFunc<mkRTKey(GetCommand)>(loc, builder);
41-
mlir::FunctionType runtimeFuncTy = runtimeFunc.getFunctionType();
42-
mlir::Value sourceFile = fir::factory::locationToFilename(builder, loc);
43-
mlir::Value sourceLine =
44-
fir::factory::locationToLineNo(builder, loc, runtimeFuncTy.getInput(4));
45-
llvm::SmallVector<mlir::Value> args =
46-
fir::runtime::createArguments(builder, loc, runtimeFuncTy, command,
47-
length, errmsg, sourceFile, sourceLine);
48-
return builder.create<fir::CallOp>(loc, runtimeFunc, args).getResult(0);
49-
}
50-
5135
mlir::Value fir::runtime::genGetCommandArgument(
5236
fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value number,
5337
mlir::Value value, mlir::Value length, mlir::Value errmsg) {

flang/test/Lower/Intrinsics/get_command.f90

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)