Skip to content

Commit dd931dc

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime_FortranSupport' into users/meinersbur/flang_runtime_move-files
2 parents ae7cc78 + 69f7bd6 commit dd931dc

File tree

34 files changed

+103
-192
lines changed

34 files changed

+103
-192
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C,
13171317
/// Add Fortran runtime libs
13181318
void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13191319
llvm::opt::ArgStringList &CmdArgs) {
1320-
// Link FortranRuntime and FortranDecimal
1320+
// Link FortranRuntime
13211321
// These are handled earlier on Windows by telling the frontend driver to
13221322
// add the correct libraries to link against as dependents in the object
13231323
// file.
@@ -1334,7 +1334,6 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13341334
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13351335
}
13361336
CmdArgs.push_back("-lFortranRuntime");
1337-
CmdArgs.push_back("-lFortranDecimal");
13381337
addArchSpecificRPath(TC, Args, CmdArgs);
13391338
}
13401339

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,29 +357,25 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
357357
CmdArgs.push_back("-D_MT");
358358
CmdArgs.push_back("--dependent-lib=libcmt");
359359
CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
360-
CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
361360
break;
362361
case options::OPT__SLASH_MTd:
363362
CmdArgs.push_back("-D_MT");
364363
CmdArgs.push_back("-D_DEBUG");
365364
CmdArgs.push_back("--dependent-lib=libcmtd");
366365
CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
367-
CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
368366
break;
369367
case options::OPT__SLASH_MD:
370368
CmdArgs.push_back("-D_MT");
371369
CmdArgs.push_back("-D_DLL");
372370
CmdArgs.push_back("--dependent-lib=msvcrt");
373371
CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
374-
CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
375372
break;
376373
case options::OPT__SLASH_MDd:
377374
CmdArgs.push_back("-D_MT");
378375
CmdArgs.push_back("-D_DEBUG");
379376
CmdArgs.push_back("-D_DLL");
380377
CmdArgs.push_back("--dependent-lib=msvcrtd");
381378
CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
382-
CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
383379
break;
384380
}
385381
}

flang-rt/include/flang-rt/descriptor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
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 "flang-rt/memory.h"
22-
#include "flang-rt/type-code.h"
2321
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
2422
#include "flang/Runtime/descriptor-consts.h"
23+
#include "flang/Runtime/memory.h"
24+
#include "flang/Runtime/type-code.h"
2525
#include <algorithm>
2626
#include <cassert>
2727
#include <cinttypes>

flang-rt/lib/flang_rt/CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
113113
add_subdirectory(../FortranFloat128Math Float128Math)
114114

115115
set(sources
116+
${FLANG_SOURCE_DIR}/lib/Common/binary-to-decimal.cpp
117+
${FLANG_SOURCE_DIR}/lib/Common/decimal-to-binary.cpp
116118
ISO_Fortran_binding.cpp
117119
allocator-registry.cpp
118120
allocatable.cpp
@@ -272,39 +274,27 @@ endif()
272274
if (NOT DEFINED MSVC)
273275
add_flang_library(FortranRuntime
274276
${sources}
275-
LINK_LIBS
276-
FortranDecimal
277277

278278
INSTALL_WITH_TOOLCHAIN
279279
)
280280
else()
281281
add_flang_library(FortranRuntime
282282
${sources}
283-
LINK_LIBS
284-
FortranDecimal
285283
)
286284
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
287285
add_flang_library(FortranRuntime.static ${sources}
288-
LINK_LIBS
289-
FortranDecimal.static
290286
INSTALL_WITH_TOOLCHAIN)
291287
set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
292288
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
293289
add_flang_library(FortranRuntime.dynamic ${sources}
294-
LINK_LIBS
295-
FortranDecimal.dynamic
296290
INSTALL_WITH_TOOLCHAIN)
297291
set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
298292
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
299293
add_flang_library(FortranRuntime.static_dbg ${sources}
300-
LINK_LIBS
301-
FortranDecimal.static_dbg
302294
INSTALL_WITH_TOOLCHAIN)
303295
set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
304296
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
305297
add_flang_library(FortranRuntime.dynamic_dbg ${sources}
306-
LINK_LIBS
307-
FortranDecimal.dynamic_dbg
308298
INSTALL_WITH_TOOLCHAIN)
309299
set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
310300
add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic

flang-rt/test/Runtime/no-cpp-dep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ a C compiler.
66
REQUIRES: c-compiler
77
88
RUN: %if system-aix %{ export OBJECT_MODE=64 %}
9-
RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm \
9+
RUN: %cc -std=c99 %s -I%include %libruntime -lm \
1010
RUN: %if system-aix %{-lpthread %}
1111
RUN: rm a.out
1212
*/

flang/docs/FlangDriver.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,18 @@ like this:
175175

176176
```
177177
$ flang -v -o example example.o
178-
"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" "-lFortranDecimal" [...]
178+
"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...]
179179
```
180180

181181
The automatically added libraries are:
182182

183183
* `FortranRuntime`: Provides most of the Flang runtime library.
184-
* `FortranDecimal`: Provides operations for decimal numbers.
185184

186185
If the code is C/C++ based and invokes Fortran routines, one can either use Clang
187186
or Flang as the linker driver. If Clang is used, it will automatically all
188187
required runtime libraries needed by C++ (e.g., for STL) to the linker invocation.
189188
In this case, one has to explicitly provide the Fortran runtime libraries
190-
`FortranRuntime` and/or `FortranDecimal`. An alternative is to use Flang to link.
189+
`FortranRuntime`. An alternative is to use Flang to link.
191190
In this case, it may be required to explicitly supply C++ runtime libraries.
192191

193192
On Darwin, the logical root where the system libraries are located (sysroot)

flang/include/flang/Common/ISO_Fortran_binding_wrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/* clang-format off */
2424
#include <stddef.h>
25-
#include "flang/Common/api-attrs.h"
25+
#include "flang/Common/api-attrs.h"
2626
#ifdef __cplusplus
2727
namespace Fortran {
2828
namespace ISO {

flang/include/flang/Common/fast-int-set.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#ifndef FORTRAN_COMMON_FAST_INT_SET_H_
2525
#define FORTRAN_COMMON_FAST_INT_SET_H_
2626

27-
#include <optional>
27+
#include "optional.h"
2828

2929
namespace Fortran::common {
3030

@@ -83,9 +83,9 @@ template <int N> class FastIntSet {
8383
}
8484
}
8585

86-
std::optional<int> PopValue() {
86+
optional<int> PopValue() {
8787
if (IsEmpty()) {
88-
return std::nullopt;
88+
return nullopt;
8989
} else {
9090
return value_[--size_];
9191
}

flang/include/flang/Parser/message.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include "char-block.h"
1616
#include "char-set.h"
1717
#include "provenance.h"
18-
#include "flang/Support/Fortran-features.h"
1918
#include "flang/Common/idioms.h"
2019
#include "flang/Common/restorer.h"
20+
#include "flang/Support/Fortran-features.h"
2121
#include "flang/Support/reference-counted.h"
2222
#include <cstddef>
2323
#include <cstring>

flang/lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_subdirectory(Common)
2+
add_subdirectory(Support)
23
add_subdirectory(Evaluate)
3-
add_subdirectory(Decimal)
44
add_subdirectory(Lower)
55
add_subdirectory(Parser)
66
add_subdirectory(Semantics)

0 commit comments

Comments
 (0)