1 //===-- Stop.h - generate stop runtime API calls ----------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "flang/Optimizer/Builder/Runtime/Stop.h" 10 #include "flang/Optimizer/Builder/FIRBuilder.h" 11 #include "flang/Optimizer/Builder/Runtime/RTBuilder.h" 12 #include "flang/Runtime/stop.h" 13 14 using namespace Fortran::runtime; 15 16 void fir::runtime::genExit(fir::FirOpBuilder &builder, mlir::Location loc, 17 mlir::Value status) { 18 auto exitFunc = fir::runtime::getRuntimeFunc<mkRTKey(Exit)>(loc, builder); 19 llvm::SmallVector<mlir::Value> args = 20 fir::runtime::createArguments(builder, loc, exitFunc.getType(), status); 21 builder.create<fir::CallOp>(loc, exitFunc, args); 22 } 23