[flang] [clang] [clang-tools-extra] [llvm] [flang] add SYSTEM runtime and lowering intrinsics support (PR #74309)

Tom Eccles via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 07:53:02 PST 2024


================
@@ -5934,6 +5938,40 @@ IntrinsicLibrary::genSum(mlir::Type resultType,
                       resultType, args);
 }
 
+// SYSTEM
+void IntrinsicLibrary::genSystem(llvm::ArrayRef<fir::ExtendedValue> args) {
+  assert(args.size() == 2);
+  mlir::Value command = fir::getBase(args[0]);
+  const fir::ExtendedValue &exitstat = args[1];
+
+  if (!command)
+    fir::emitFatalError(loc, "expected COMMAND parameter");
+
+  mlir::Type boxNoneTy = fir::BoxType::get(builder.getNoneType());
+
+  mlir::Value waitBool = builder.createBool(loc, true);
+  mlir::Value exitstatBox =
+      isStaticallyPresent(exitstat)
+          ? fir::getBase(exitstat)
+          : builder.create<fir::AbsentOp>(loc, boxNoneTy).getResult();
----------------
tblah wrote:

Ahh I see. My mistake missreading this. Thanks for explaining.

I was worried about the store, to this descriptor but that uses CheckAndStoreToIntDescriptor, which does check if the descriptor is present at runtime.

LGTM

https://github.com/llvm/llvm-project/pull/74309


More information about the cfe-commits mailing list