1 //===-- Assign.cpp -- generate assignment runtime API calls ---------------===// 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/Assign.h" 10 #include "flang/Optimizer/Builder/FIRBuilder.h" 11 #include "flang/Optimizer/Builder/Runtime/RTBuilder.h" 12 #include "flang/Runtime/assign.h" 13 14 using namespace Fortran::runtime; 15 16 void fir::runtime::genAssign(fir::FirOpBuilder &builder, mlir::Location loc, 17 mlir::Value destBox, mlir::Value sourceBox) { 18 auto func = fir::runtime::getRuntimeFunc<mkRTKey(Assign)>(loc, builder); 19 auto fTy = func.getFunctionType(); 20 auto sourceFile = fir::factory::locationToFilename(builder, loc); 21 auto sourceLine = 22 fir::factory::locationToLineNo(builder, loc, fTy.getInput(3)); 23 auto args = fir::runtime::createArguments(builder, loc, fTy, destBox, 24 sourceBox, sourceFile, sourceLine); 25 builder.create<fir::CallOp>(loc, func, args); 26 } 27