Skip to content

Commit 443c77a

Browse files
klauslerpsteinfeld
authored andcommitted
[flang] Move runtime API headers to flang/include/flang/Runtime
This commit cherry-picks the change that Peter made in llvm-project and makes additional changes to account for the differences between fir-dev and llvm-project. Here's the original message from Peter's change in Phabricator in llvm-project: Move the closure of the subset of flang/runtime/*.h header files that are referenced by source files outside flang/runtime (apart from unit tests) into a new directory (flang/include/flang/Runtime) so that relative include paths into ../runtime need not be used. flang/runtime/pgmath.h.inc is moved to flang/include/flang/Evaluate; it's not used by the runtime. Differential Revision: https://reviews.llvm.org/D109107
1 parent 8fe40e0 commit 443c77a

File tree

111 files changed

+224
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+224
-230
lines changed

flang/docs/tutorials/addingIntrinsics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ void fir::runtime::genTrim(fir::FirOpBuilder &builder,
342342
The key point is `getRuntimeFunc<mkRTKey(Trim)>(loc, builder)` that builds the FIR signature for the runtime
343343
function automatically. The name passed to `mkRTKey` must be the same as the one inside `RTNAME` when declaring
344344
the function in the runtime headers. The runtime header must be included in the current file to use `getRuntimeFunc<>`
345-
(note the `#include "../../runtime/character.h"` at the top of the file). So at least the runtime API must be designed before adding
345+
(note the `#include "flang/Runtime/character.h"` at the top of the file). So at least the runtime API must be designed before adding
346346
the support in lowering.
347347
348348
Then, the source file name and line number are lowered from the current location so that they can be passed to the runtime.

flang/runtime/pgmath.h.inc renamed to flang/include/flang/Evaluate/pgmath.h.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/pgmath.h.inc -------------------------------===//
1+
//===-- include/flang/Evaluate/pgmath.h.inc -------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

flang/runtime/allocatable.h renamed to flang/include/flang/Runtime/allocatable.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/allocatable.h -----------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/allocatable.h ---------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,8 +11,8 @@
1111
#ifndef FORTRAN_RUNTIME_ALLOCATABLE_H_
1212
#define FORTRAN_RUNTIME_ALLOCATABLE_H_
1313

14-
#include "descriptor.h"
15-
#include "entry-names.h"
14+
#include "flang/Runtime/descriptor.h"
15+
#include "flang/Runtime/entry-names.h"
1616

1717
namespace Fortran::runtime {
1818

flang/runtime/assign.h renamed to flang/include/flang/Runtime/assign.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/assign.h --------------------------------------------------===//
1+
//===-- include/flang/Runtime/assign.h --------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -20,10 +20,10 @@
2020
// need not be handled here in the runtime; ditto for type conversions on
2121
// intrinsic assignments.
2222

23-
#ifndef FLANG_RUNTIME_ASSIGN_H_
24-
#define FLANG_RUNTIME_ASSIGN_H_
23+
#ifndef FORTRAN_RUNTIME_ASSIGN_H_
24+
#define FORTRAN_RUNTIME_ASSIGN_H_
2525

26-
#include "entry-names.h"
26+
#include "flang/Runtime/entry-names.h"
2727

2828
namespace Fortran::runtime {
2929
class Descriptor;
@@ -42,4 +42,4 @@ void RTNAME(Assign)(Descriptor &to, const Descriptor &from,
4242
const char *sourceFile = nullptr, int sourceLine = 0);
4343
} // extern "C"
4444
} // namespace Fortran::runtime
45-
#endif // FLANG_RUNTIME_ASSIGN_H_
45+
#endif // FORTRAN_RUNTIME_ASSIGN_H_

flang/runtime/c-or-cpp.h renamed to flang/include/flang/Runtime/c-or-cpp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/c-or-cpp.h --------------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/c-or-cpp.h ------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

flang/runtime/character.h renamed to flang/include/flang/Runtime/character.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/character.h -------------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/character.h -----------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,7 +11,7 @@
1111

1212
#ifndef FORTRAN_RUNTIME_CHARACTER_H_
1313
#define FORTRAN_RUNTIME_CHARACTER_H_
14-
#include "entry-names.h"
14+
#include "flang/Runtime/entry-names.h"
1515
#include <cstddef>
1616

1717
namespace Fortran::runtime {

flang/runtime/command.h renamed to flang/include/flang/Runtime/command.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/command.h ---------------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/command.h -------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,8 +9,8 @@
99
#ifndef FORTRAN_RUNTIME_COMMAND_H_
1010
#define FORTRAN_RUNTIME_COMMAND_H_
1111

12-
#include "cpp-type.h"
13-
#include "entry-names.h"
12+
#include "flang/Runtime/cpp-type.h"
13+
#include "flang/Runtime/entry-names.h"
1414

1515
namespace Fortran::runtime {
1616
class Descriptor;

flang/runtime/cpp-type.h renamed to flang/include/flang/Runtime/cpp-type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/cpp-type.h --------------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/cpp-type.h ------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.

flang/runtime/derived-api.h renamed to flang/include/flang/Runtime/derived-api.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/derived-api.h ---------------------------------------------===//
1+
//===-- include/flang/Runtime/derived-api.h ---------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -12,10 +12,10 @@
1212
// local variables. Whole allocatable assignment should use AllocatableAssign()
1313
// instead of this Assign().
1414

15-
#ifndef FLANG_RUNTIME_DERIVED_API_H_
16-
#define FLANG_RUNTIME_DERIVED_API_H_
15+
#ifndef FORTRAN_RUNTIME_DERIVED_API_H_
16+
#define FORTRAN_RUNTIME_DERIVED_API_H_
1717

18-
#include "entry-names.h"
18+
#include "flang/Runtime/entry-names.h"
1919

2020
namespace Fortran::runtime {
2121
class Descriptor;
@@ -40,4 +40,4 @@ void RTNAME(Assign)(const Descriptor &, const Descriptor &,
4040

4141
} // extern "C"
4242
} // namespace Fortran::runtime
43-
#endif // FLANG_RUNTIME_DERIVED_API_H_
43+
#endif // FORTRAN_RUNTIME_DERIVED_API_H_

flang/runtime/descriptor.h renamed to flang/include/flang/Runtime/descriptor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- runtime/descriptor.h ------------------------------------*- C++ -*-===//
1+
//===-- include/flang/Runtime/descriptor.h ----------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -18,9 +18,9 @@
1818
// User C code is welcome to depend on that ISO_Fortran_binding.h file,
1919
// but should never reference this internal header.
2020

21-
#include "memory.h"
22-
#include "type-code.h"
2321
#include "flang/ISO_Fortran_binding.h"
22+
#include "flang/Runtime/memory.h"
23+
#include "flang/Runtime/type-code.h"
2424
#include <cassert>
2525
#include <cinttypes>
2626
#include <cstddef>

0 commit comments

Comments
 (0)