Skip to content

Commit c86aa90

Browse files
committed
Rename to flang_rt.runtime, flang_rt.quadmath, flang_rt.cuda
1 parent c172e09 commit c86aa90

File tree

229 files changed

+727
-685
lines changed

Some content is hidden

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

229 files changed

+727
-685
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C,
13211321
/// Add Fortran runtime libs
13221322
void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13231323
llvm::opt::ArgStringList &CmdArgs) {
1324-
// Link flang_rt
1324+
// Link flang_rt.runtime
13251325
// These are handled earlier on Windows by telling the frontend driver to
13261326
// add the correct libraries to link against as dependents in the object
13271327
// file.
@@ -1337,7 +1337,7 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13371337
if (AsNeeded)
13381338
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13391339
}
1340-
CmdArgs.push_back("-lflang_rt");
1340+
CmdArgs.push_back("-lflang_rt.runtime");
13411341
addArchSpecificRPath(TC, Args, CmdArgs);
13421342
}
13431343

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,26 +367,26 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
367367
case options::OPT__SLASH_MT:
368368
CmdArgs.push_back("-D_MT");
369369
CmdArgs.push_back("--dependent-lib=libcmt");
370-
CmdArgs.push_back("--dependent-lib=flang_rt.static.lib");
370+
CmdArgs.push_back("--dependent-lib=flang_rt.runtime.static.lib");
371371
break;
372372
case options::OPT__SLASH_MTd:
373373
CmdArgs.push_back("-D_MT");
374374
CmdArgs.push_back("-D_DEBUG");
375375
CmdArgs.push_back("--dependent-lib=libcmtd");
376-
CmdArgs.push_back("--dependent-lib=flang_rt.static_dbg.lib");
376+
CmdArgs.push_back("--dependent-lib=flang_rt.runtime.static_dbg.lib");
377377
break;
378378
case options::OPT__SLASH_MD:
379379
CmdArgs.push_back("-D_MT");
380380
CmdArgs.push_back("-D_DLL");
381381
CmdArgs.push_back("--dependent-lib=msvcrt");
382-
CmdArgs.push_back("--dependent-lib=flang_rt.dynamic.lib");
382+
CmdArgs.push_back("--dependent-lib=flang_rt.runtime.dynamic.lib");
383383
break;
384384
case options::OPT__SLASH_MDd:
385385
CmdArgs.push_back("-D_MT");
386386
CmdArgs.push_back("-D_DEBUG");
387387
CmdArgs.push_back("-D_DLL");
388388
CmdArgs.push_back("--dependent-lib=msvcrtd");
389-
CmdArgs.push_back("--dependent-lib=flang_rt.dynamic_dbg.lib");
389+
CmdArgs.push_back("--dependent-lib=flang_rt.runtime.dynamic_dbg.lib");
390390
break;
391391
}
392392
}

flang-rt/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ else ()
168168
endif ()
169169

170170

171-
option(FLANG_RT_ENABLE_CUF "Compile CUDA Fortran runtime sources" OFF)
172-
if (FLANG_RT_ENABLE_CUF)
171+
option(FLANG_RT_INCLUDE_CUF "Build the CUDA Fortran runtime (libflang_rt.cuda.a)" OFF)
172+
if (FLANG_RT_INCLUDE_CUF)
173173
find_package(CUDAToolkit REQUIRED)
174174
endif()
175175

@@ -240,6 +240,10 @@ add_custom_target(flang-rt)
240240

241241
add_subdirectory(lib)
242242

243+
if (LLVM_INCLUDE_EXAMPLES)
244+
add_subdirectory(examples)
245+
endif ()
246+
243247
if (FLANG_RT_INCLUDE_TESTS)
244248
add_subdirectory(unittests)
245249
add_subdirectory(test)

flang-rt/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ CMake itself provide.
151151
GPU accelerators using OpenMP offloading. Only Clang is supported for
152152
`CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`.
153153

154-
* `FLANG_RT_ENABLE_CUF` (bool, default: `OFF`)
154+
* `FLANG_RT_INCLUDE_CUF` (bool, default: `OFF`)
155155

156-
Compiles the `libCufRuntime_cuda_<CUDA-version>.a/.so` library. This is
156+
Compiles the `libflang_rt.cuda_<CUDA-version>.a/.so` library. This is
157157
independent of `FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA` and only
158158
requires a
159159
[CUDA Toolkit installation](https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html)

flang-rt/examples/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#===-- examples/CMakeLists.txt ---------------------------------------------===#
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+
add_subdirectory(ExternalHelloWorld)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#===-- examples/ExternalHelloWorld/CMakeLists.txt --------------------------===#
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+
# This test is not run by default as it requires input.
10+
add_llvm_example(external-hello-world
11+
external-hello.cpp
12+
)
13+
14+
target_link_libraries(external-hello-world
15+
PRIVATE
16+
flang_rt.runtime
17+
)

flang/examples/ExternalHelloWorld/external-hello.cpp renamed to flang-rt/examples/ExternalHelloWorld/external-hello.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//===-- examples/ExternalHelloWorld/external-hello.cpp ----------*- 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+
19
#include "flang/Runtime/io-api.h"
210
#include "flang/Runtime/main.h"
311
#include "flang/Runtime/stop.h"

flang-rt/include/flang-rt/CUDA/allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/CUDA/allocator.h -----------------------*- C++ -*-===//
1+
//===-- include/flang-rt/cuda/allocator.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-rt/include/flang-rt/allocator-registry.h renamed to flang-rt/include/flang-rt/runtime/allocator-registry.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- include/flang-rt/allocator-registry.h -------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/allocator-registry.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.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FLANG_RT_ALLOCATOR_REGISTRY_H_
10-
#define FLANG_RT_ALLOCATOR_REGISTRY_H_
9+
#ifndef FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_
10+
#define FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_
1111

1212
#include "flang/Common/api-attrs.h"
1313
#include "flang/Runtime/allocator-registry-consts.h"
@@ -55,4 +55,4 @@ RT_OFFLOAD_VAR_GROUP_END
5555

5656
} // namespace Fortran::runtime
5757

58-
#endif // FLANG_RT_ALLOCATOR_REGISTRY_H_
58+
#endif // FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_

flang-rt/include/flang-rt/array-constructor.h renamed to flang-rt/include/flang-rt/runtime/array-constructor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/array-constructor.h --------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/array-constructor.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
// External APIs to create temporary storage for array constructors when their
1010
// final extents or length parameters cannot be pre-computed.
1111

12-
#ifndef FLANG_RT_ARRAY_CONSTRUCTOR_H_
13-
#define FLANG_RT_ARRAY_CONSTRUCTOR_H_
12+
#ifndef FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_
13+
#define FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_
1414

1515
#include "descriptor.h"
1616
#include "flang/Runtime/array-constructor-consts.h"
@@ -54,4 +54,4 @@ static_assert(alignof(Fortran::runtime::ArrayConstructorVector) <=
5454
"MaxArrayConstructorVectorAlignInBytes");
5555

5656
} // namespace Fortran::runtime
57-
#endif // FLANG_RT_ARRAY_CONSTRUCTOR_H_
57+
#endif // FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_

flang-rt/include/flang-rt/assign-impl.h renamed to flang-rt/include/flang-rt/runtime/assign-impl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- include/flang-rt/assign-impl.h --------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/assign-impl.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.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FLANG_RT_ASSIGN_IMPL_H_
10-
#define FLANG_RT_ASSIGN_IMPL_H_
9+
#ifndef FLANG_RT_RUNTIME_ASSIGN_IMPL_H_
10+
#define FLANG_RT_RUNTIME_ASSIGN_IMPL_H_
1111

1212
#include "flang/Runtime/freestanding-tools.h"
1313

@@ -28,4 +28,4 @@ RT_API_ATTRS void DoFromSourceAssign(Descriptor &, const Descriptor &,
2828
#endif
2929

3030
} // namespace Fortran::runtime
31-
#endif // FLANG_RT_ASSIGN_IMPL_H_
31+
#endif // FLANG_RT_RUNTIME_ASSIGN_IMPL_H_

flang-rt/include/flang-rt/buffer.h renamed to flang-rt/include/flang-rt/runtime/buffer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/buffer.h -------------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/buffer.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.
@@ -8,8 +8,8 @@
88

99
// External file buffering
1010

11-
#ifndef FLANG_RT_BUFFER_H_
12-
#define FLANG_RT_BUFFER_H_
11+
#ifndef FLANG_RT_RUNTIME_BUFFER_H_
12+
#define FLANG_RT_RUNTIME_BUFFER_H_
1313

1414
#include "io-error.h"
1515
#include "memory.h"
@@ -221,4 +221,4 @@ template <typename STORE, std::size_t minBuffer = 65536> class FileFrame {
221221
bool dirty_{false};
222222
};
223223
} // namespace Fortran::runtime::io
224-
#endif // FLANG_RT_BUFFER_H_
224+
#endif // FLANG_RT_RUNTIME_BUFFER_H_

flang-rt/include/flang-rt/connection.h renamed to flang-rt/include/flang-rt/runtime/connection.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/connection.h ---------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/connection.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.
@@ -8,8 +8,8 @@
88

99
// Fortran I/O connection state (abstracted over internal & external units)
1010

11-
#ifndef FLANG_RT_CONNECTION_H_
12-
#define FLANG_RT_CONNECTION_H_
11+
#ifndef FLANG_RT_RUNTIME_CONNECTION_H_
12+
#define FLANG_RT_RUNTIME_CONNECTION_H_
1313

1414
#include "format.h"
1515
#include "flang/Common/optional.h"
@@ -124,4 +124,4 @@ class SavedPosition {
124124
};
125125

126126
} // namespace Fortran::runtime::io
127-
#endif // FLANG_RT_CONNECTION_H_
127+
#endif // FLANG_RT_RUNTIME_CONNECTION_H_

flang-rt/include/flang-rt/derived.h renamed to flang-rt/include/flang-rt/runtime/derived.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/derived.h ------------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/derived.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.
@@ -8,8 +8,8 @@
88

99
// Internal runtime utilities for derived type operations.
1010

11-
#ifndef FLANG_RT_DERIVED_H_
12-
#define FLANG_RT_DERIVED_H_
11+
#ifndef FLANG_RT_RUNTIME_DERIVED_H_
12+
#define FLANG_RT_RUNTIME_DERIVED_H_
1313

1414
#include "flang/Common/api-attrs.h"
1515

@@ -48,4 +48,4 @@ RT_API_ATTRS void Destroy(const Descriptor &, bool finalize,
4848
RT_API_ATTRS bool HasDynamicComponent(const Descriptor &);
4949

5050
} // namespace Fortran::runtime
51-
#endif // FLANG_RT_DERIVED_H_
51+
#endif // FLANG_RT_RUNTIME_DERIVED_H_

flang-rt/include/flang-rt/descriptor.h renamed to flang-rt/include/flang-rt/runtime/descriptor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- include/flang-rt/descriptor.h ---------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/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.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FLANG_RT_DESCRIPTOR_H_
10-
#define FLANG_RT_DESCRIPTOR_H_
9+
#ifndef FLANG_RT_RUNTIME_DESCRIPTOR_H_
10+
#define FLANG_RT_RUNTIME_DESCRIPTOR_H_
1111

1212
// Defines data structures used during execution of a Fortran program
1313
// to implement nontrivial dummy arguments, pointers, allocatables,
@@ -482,4 +482,4 @@ class alignas(Descriptor) StaticDescriptor {
482482
};
483483

484484
} // namespace Fortran::runtime
485-
#endif // FLANG_RT_DESCRIPTOR_H_
485+
#endif // FLANG_RT_RUNTIME_DESCRIPTOR_H_

flang-rt/include/flang-rt/emit-encoded.h renamed to flang-rt/include/flang-rt/runtime/emit-encoded.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/emit-encoded.h -------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/emit-encoded.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.
@@ -8,8 +8,8 @@
88

99
// Templates for emitting CHARACTER values with conversion
1010

11-
#ifndef FLANG_RT_EMIT_ENCODED_H_
12-
#define FLANG_RT_EMIT_ENCODED_H_
11+
#ifndef FLANG_RT_RUNTIME_EMIT_ENCODED_H_
12+
#define FLANG_RT_RUNTIME_EMIT_ENCODED_H_
1313

1414
#include "connection.h"
1515
#include "environment.h"
@@ -114,4 +114,4 @@ RT_API_ATTRS bool EmitRepeated(CONTEXT &to, char ch, std::size_t n) {
114114
}
115115

116116
} // namespace Fortran::runtime::io
117-
#endif // FLANG_RT_EMIT_ENCODED_H_
117+
#endif // FLANG_RT_RUNTIME_EMIT_ENCODED_H_

flang-rt/include/flang-rt/environment.h renamed to flang-rt/include/flang-rt/runtime/environment.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- include/flang-rt/environment.h --------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/environment.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.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FLANG_RT_ENVIRONMENT_H_
10-
#define FLANG_RT_ENVIRONMENT_H_
9+
#ifndef FLANG_RT_RUNTIME_ENVIRONMENT_H_
10+
#define FLANG_RT_RUNTIME_ENVIRONMENT_H_
1111

1212
#include "flang/Common/optional.h"
1313
#include "flang/Decimal/decimal.h"
@@ -67,4 +67,4 @@ RT_OFFLOAD_VAR_GROUP_END
6767

6868
} // namespace Fortran::runtime
6969

70-
#endif // FLANG_RT_ENVIRONMENT_H_
70+
#endif // FLANG_RT_RUNTIME_ENVIRONMENT_H_

flang-rt/include/flang-rt/file.h renamed to flang-rt/include/flang-rt/runtime/file.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/file.h ---------------------------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/file.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.
@@ -8,8 +8,8 @@
88

99
// Raw system I/O wrappers
1010

11-
#ifndef FLANG_RT_FILE_H_
12-
#define FLANG_RT_FILE_H_
11+
#ifndef FLANG_RT_RUNTIME_FILE_H_
12+
#define FLANG_RT_RUNTIME_FILE_H_
1313

1414
#include "io-error.h"
1515
#include "memory.h"
@@ -113,4 +113,4 @@ RT_API_ATTRS bool MayWrite(const char *path);
113113
RT_API_ATTRS bool MayReadAndWrite(const char *path);
114114
RT_API_ATTRS std::int64_t SizeInBytes(const char *path);
115115
} // namespace Fortran::runtime::io
116-
#endif // FLANG_RT_FILE_H_
116+
#endif // FLANG_RT_RUNTIME_FILE_H_

flang-rt/include/flang-rt/format-implementation.h renamed to flang-rt/include/flang-rt/runtime/format-implementation.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- include/flang-rt/format-implementation.h ----------------*- C++ -*-===//
1+
//===-- include/flang-rt/runtime/format-implementation.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.
@@ -8,8 +8,8 @@
88

99
// Implements out-of-line member functions of template class FormatControl
1010

11-
#ifndef FLANG_RT_FORMAT_IMPLEMENTATION_H_
12-
#define FLANG_RT_FORMAT_IMPLEMENTATION_H_
11+
#ifndef FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_
12+
#define FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_
1313

1414
#include "emit-encoded.h"
1515
#include "format.h"
@@ -601,4 +601,4 @@ RT_API_ATTRS void FormatControl<CONTEXT>::Finish(Context &context) {
601601
}
602602
}
603603
} // namespace Fortran::runtime::io
604-
#endif // FLANG_RT_FORMAT_IMPLEMENTATION_H_
604+
#endif // FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_

0 commit comments

Comments
 (0)