[AArch64,ELF] Restrict MOVZ/MOVK to non-PIC large code model (#70178)
[llvm-project.git] / flang / runtime / extensions.cpp
blobb8e9b6eae13205988bdd2f380ee3b07776c72e66
1 //===-- runtime/extensions.cpp --------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 // These C-coded entry points with Fortran-mangled names implement legacy
10 // extensions that will eventually be implemented in Fortran.
12 #include "flang/Runtime/extensions.h"
13 #include "flang/Runtime/command.h"
14 #include "flang/Runtime/descriptor.h"
15 #include "flang/Runtime/io-api.h"
17 extern "C" {
19 namespace Fortran::runtime {
20 namespace io {
21 // SUBROUTINE FLUSH(N)
22 // FLUSH N
23 // END
24 void FORTRAN_PROCEDURE_NAME(flush)(const int &unit) {
25 Cookie cookie{IONAME(BeginFlush)(unit, __FILE__, __LINE__)};
26 IONAME(EndIoStatement)(cookie);
28 } // namespace io
30 // RESULT = IARGC()
31 std::int32_t FORTRAN_PROCEDURE_NAME(iargc)() { return RTNAME(ArgumentCount)(); }
33 // CALL GETARG(N, ARG)
34 void FORTRAN_PROCEDURE_NAME(getarg)(
35 std::int32_t &n, std::int8_t *arg, std::int64_t length) {
36 Descriptor value{*Descriptor::Create(1, length, arg, 0)};
37 (void)RTNAME(GetCommandArgument)(
38 n, &value, nullptr, nullptr, __FILE__, __LINE__);
40 } // namespace Fortran::runtime
41 } // extern "C"