Skip to content

Commit 1e59e61

Browse files
committed
use FORTRAN_PROCEDURE_NAME
1 parent 6e6c1a5 commit 1e59e61

File tree

9 files changed

+8
-26
lines changed

9 files changed

+8
-26
lines changed

flang/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ if (FLANG_STANDALONE_BUILD)
9090
# We need a pre-built/installed version of LLVM.
9191
find_package(LLVM REQUIRED HINTS "${LLVM_DIR_ABSOLUTE}")
9292

93-
# function checks
94-
find_package(Backtrace)
95-
set(HAVE_BACKTRACE ${Backtrace_FOUND})
96-
set(BACKTRACE_HEADER ${Backtrace_HEADER})
97-
9893
# Users might specify a path to CLANG_DIR that's:
9994
# * a full path, or
10095
# * a path relative to the path of this script.

flang/include/flang/Optimizer/Builder/IntrinsicCall.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ struct IntrinsicLibrary {
196196
fir::ExtendedValue genAssociated(mlir::Type,
197197
llvm::ArrayRef<fir::ExtendedValue>);
198198
mlir::Value genAtand(mlir::Type, llvm::ArrayRef<mlir::Value>);
199-
void genBacktrace(llvm::ArrayRef<fir::ExtendedValue>);
200199
fir::ExtendedValue genBesselJn(mlir::Type,
201200
llvm::ArrayRef<fir::ExtendedValue>);
202201
fir::ExtendedValue genBesselYn(mlir::Type,

flang/include/flang/Optimizer/Builder/Runtime/Stop.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ void genExit(fir::FirOpBuilder &, mlir::Location, mlir::Value status);
3030
/// Generate call to ABORT intrinsic runtime routine.
3131
void genAbort(fir::FirOpBuilder &, mlir::Location);
3232

33-
/// Generate call to BACKTRACE intrinsic runtime routine.
34-
void genBacktrace(fir::FirOpBuilder &builder, mlir::Location loc);
35-
3633
/// Generate call to crash the program with an error message when detecting
3734
/// an invalid situation at runtime.
3835
void genReportFatalUserError(fir::FirOpBuilder &, mlir::Location,

flang/include/flang/Runtime/stop.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "flang/Runtime/c-or-cpp.h"
1313
#include "flang/Runtime/entry-names.h"
14+
#include "flang/Runtime/extensions.h"
1415
#include <stdlib.h>
1516

1617
FORTRAN_EXTERN_C_BEGIN
@@ -29,7 +30,7 @@ NORETURN void RTNAME(ProgramEndStatement)(NO_ARGUMENTS);
2930
// Extensions
3031
NORETURN void RTNAME(Exit)(int status DEFAULT_VALUE(EXIT_SUCCESS));
3132
NORETURN void RTNAME(Abort)(NO_ARGUMENTS);
32-
void RTNAME(Backtrace)(NO_ARGUMENTS);
33+
void FORTRAN_PROCEDURE_NAME(backtrace)(NO_ARGUMENTS);
3334

3435
// Crash with an error message when the program dynamically violates a Fortran
3536
// constraint.

flang/lib/Evaluate/intrinsics.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,6 @@ static const IntrinsicInterface intrinsicSubroutine[]{
13361336
{"stat", AnyInt, Rank::scalar, Optionality::optional,
13371337
common::Intent::Out}},
13381338
{}, Rank::elemental, IntrinsicClass::atomicSubroutine},
1339-
{"backtrace", {}, {}, Rank::elemental, IntrinsicClass::impureSubroutine},
13401339
{"co_broadcast",
13411340
{{"a", AnyData, Rank::anyOrAssumedRank, Optionality::required,
13421341
common::Intent::InOut},

flang/lib/Optimizer/Builder/IntrinsicCall.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static constexpr IntrinsicHandler handlers[]{
150150
{"atan2pi", &I::genAtanpi},
151151
{"atand", &I::genAtand},
152152
{"atanpi", &I::genAtanpi},
153-
{"backtrace", &I::genBacktrace},
154153
{"bessel_jn",
155154
&I::genBesselJn,
156155
{{{"n1", asValue}, {"n2", asValue}, {"x", asValue}}},
@@ -2683,12 +2682,6 @@ IntrinsicLibrary::genBesselJn(mlir::Type resultType,
26832682
}
26842683
}
26852684

2686-
// Backtrace
2687-
void IntrinsicLibrary::genBacktrace(llvm::ArrayRef<fir::ExtendedValue> args) {
2688-
assert(args.size() == 0);
2689-
fir::runtime::genBacktrace(builder, loc);
2690-
}
2691-
26922685
// BESSEL_YN
26932686
fir::ExtendedValue
26942687
IntrinsicLibrary::genBesselYn(mlir::Type resultType,

flang/lib/Optimizer/Builder/Runtime/Stop.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ void fir::runtime::genAbort(fir::FirOpBuilder &builder, mlir::Location loc) {
2828
builder.create<fir::CallOp>(loc, abortFunc, std::nullopt);
2929
}
3030

31-
void fir::runtime::genBacktrace(fir::FirOpBuilder &builder,
32-
mlir::Location loc) {
33-
mlir::func::FuncOp backtraceFunc =
34-
fir::runtime::getRuntimeFunc<mkRTKey(Backtrace)>(loc, builder);
35-
builder.create<fir::CallOp>(loc, backtraceFunc, std::nullopt);
36-
}
37-
3831
void fir::runtime::genReportFatalUserError(fir::FirOpBuilder &builder,
3932
mlir::Location loc,
4033
llvm::StringRef message) {

flang/runtime/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
5959
)
6060
endif()
6161

62+
# function checks
63+
find_package(Backtrace)
64+
set(HAVE_BACKTRACE ${Backtrace_FOUND})
65+
set(BACKTRACE_HEADER ${Backtrace_HEADER})
66+
6267
include(CheckCXXSymbolExists)
6368
include(CheckCXXSourceCompiles)
6469
check_cxx_symbol_exists(strerror_r string.h HAVE_STRERROR_R)

flang/runtime/stop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static void PrintBacktrace() {
185185
std::abort();
186186
}
187187

188-
void RTNAME(Backtrace)() { PrintBacktrace(); }
188+
void FORTRAN_PROCEDURE_NAME(backtrace)() { PrintBacktrace(); }
189189

190190
[[noreturn]] void RTNAME(ReportFatalUserError)(
191191
const char *message, const char *source, int line) {

0 commit comments

Comments
 (0)