Skip to content

Commit 0c61733

Browse files
authored
Merge pull request #1017 from flang-compiler/jpr-fix-circular-deps
[NFC fix] merge FIRRuntime in FIRBuilder to break circular deps
2 parents 38afb0f + f9261b1 commit 0c61733

30 files changed

+57
-77
lines changed

flang/docs/tutorials/addingIntrinsics.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ The categories are:
167167
See `include/flang/Support/BoxValue.h` for more details.
168168

169169
If the intrinsic has a runtime implementation, the actual binding should be done in another helper function called
170-
`gen{Runtime function name}`. For instance character runtime bindings are implemented in `lib/Optimizer/Runtime/Character.cpp`
170+
`gen{Runtime function name}`. For instance character runtime bindings are implemented in `lib/Optimizer/Builder/Runtime/Character.cpp`
171171
See `genTrim` for an example of such runtime binding helper.
172-
Non character related runtime binding should be added to `lib/Optimizer/Runtime/Xxx.cpp`
172+
Non character related runtime binding should be added to `lib/Optimizer/Builder/Runtime/Xxx.cpp`
173173
(for runtime API declared in `runtime/xxx.cpp`).
174174

175175
Note: Numerical elemental intrinsics that have libm/libnvmath implementations are automatically mapped and
@@ -313,7 +313,7 @@ It also creates a descriptor for the argument with `builder.createBox()`. Note t
313313
differently because we expect the first one to be modified, but not the second one. This difference preserves SSA
314314
semantics in the IR (An SSA value cannot change).
315315

316-
The actual runtime call is generated by `Fortran::lower::genTrim` defined in `lib/Optimizer/Runtime/Character.cpp`
316+
The actual runtime call is generated by `Fortran::lower::genTrim` defined in `lib/Optimizer/Builder/Runtime/Character.cpp`
317317
After the runtime call, the result descriptor is read to build the resulting `fir::CharBoxValue`
318318
with the result address and length. Since the result address was allocated, it is added to a clean-up list so that
319319
it can be deallocated after the statement.

flang/include/flang/Optimizer/Runtime/Assign.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Assign.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_ASSIGN_H
10-
#define FORTRAN_OPTIMIZER_RUNTIME_ASSIGN_H
9+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ASSIGN_H
10+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ASSIGN_H
1111

1212
namespace mlir {
1313
class Value;
@@ -29,4 +29,4 @@ void genAssign(fir::FirOpBuilder &builder, mlir::Location loc,
2929
mlir::Value destBox, mlir::Value sourceBox);
3030

3131
} // namespace fir::runtime
32-
#endif // FORTRAN_OPTIMIZER_RUNTIME_ASSIGN_H
32+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_ASSIGN_H

flang/include/flang/Optimizer/Runtime/Character.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Character.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_CHARACTER_H
10-
#define FORTRAN_OPTIMIZER_RUNTIME_CHARACTER_H
9+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_CHARACTER_H
10+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_CHARACTER_H
1111

1212
#include "mlir/Dialect/StandardOps/IR/Ops.h"
1313

@@ -131,4 +131,4 @@ mlir::Value genVerify(fir::FirOpBuilder &builder, mlir::Location loc, int kind,
131131

132132
} // namespace fir::runtime
133133

134-
#endif // FORTRAN_OPTIMIZER_RUNTIME_CHARACTER_H
134+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_CHARACTER_H

flang/include/flang/Optimizer/Runtime/Derived.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Derived.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_DERIVED_H
10-
#define FORTRAN_OPTIMIZER_RUNTIME_DERIVED_H
9+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_DERIVED_H
10+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_DERIVED_H
1111

1212
namespace mlir {
1313
class Value;
@@ -36,4 +36,4 @@ void genDerivedTypeAssign(fir::FirOpBuilder &builder, mlir::Location loc,
3636
mlir::Value destinationBox, mlir::Value sourceBox);
3737

3838
} // namespace fir::runtime
39-
#endif // FORTRAN_OPTIMIZER_RUNTIME_DERIVED_H
39+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_DERIVED_H

flang/include/flang/Optimizer/Runtime/Numeric.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Numeric.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_NUMERIC_H
10-
#define FORTRAN_OPTIMIZER_RUNTIME_NUMERIC_H
9+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_NUMERIC_H
10+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_NUMERIC_H
1111

1212
#include "mlir/Dialect/StandardOps/IR/Ops.h"
1313

@@ -47,4 +47,4 @@ mlir::Value genSpacing(fir::FirOpBuilder &builder, mlir::Location loc,
4747
mlir::Value x);
4848

4949
} // namespace fir::runtime
50-
#endif // FORTRAN_OPTIMIZER_RUNTIME_NUMERIC_H
50+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_NUMERIC_H

flang/include/flang/Optimizer/Runtime/RTBuilder.h renamed to flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
///
1515
//===----------------------------------------------------------------------===//
1616

17-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_RTBUILDER_H
18-
#define FORTRAN_OPTIMIZER_RUNTIME_RTBUILDER_H
17+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RTBUILDER_H
18+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RTBUILDER_H
1919

2020
#include "flang/Common/Fortran.h"
2121
#include "flang/Optimizer/Builder/FIRBuilder.h"
@@ -390,4 +390,4 @@ createArguments(fir::FirOpBuilder &builder, mlir::Location loc,
390390

391391
} // namespace fir::runtime
392392

393-
#endif // FORTRAN_OPTIMIZER_RUNTIME_RTBUILDER_H
393+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RTBUILDER_H

flang/include/flang/Optimizer/Runtime/Reduction.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Reduction.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_REDUCTION_H
10-
#define FORTRAN_OPTIMIZER_RUNTIME_REDUCTION_H
9+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_REDUCTION_H
10+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_REDUCTION_H
1111

1212
#include "mlir/Dialect/StandardOps/IR/Ops.h"
1313

@@ -145,4 +145,4 @@ void genSumDim(fir::FirOpBuilder &builder, mlir::Location loc,
145145

146146
} // namespace fir::runtime
147147

148-
#endif // FORTRAN_OPTIMIZER_RUNTIME_REDUCTION_H
148+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_REDUCTION_H

flang/include/flang/Optimizer/Runtime/Transformational.h renamed to flang/include/flang/Optimizer/Builder/Runtime/Transformational.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#ifndef FORTRAN_OPTIMIZER_RUNTIME_TRANSFORMATIONAL_H
11-
#define FORTRAN_OPTIMIZER_RUNTIME_TRANSFORMATIONAL_H
10+
#ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_TRANSFORMATIONAL_H
11+
#define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_TRANSFORMATIONAL_H
1212

1313
#include "mlir/Dialect/StandardOps/IR/Ops.h"
1414

@@ -52,4 +52,4 @@ void genUnpack(fir::FirOpBuilder &builder, mlir::Location loc,
5252

5353
} // namespace fir::runtime
5454

55-
#endif // FORTRAN_OPTIMIZER_RUNTIME_TRANSFORMATIONAL_H
55+
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_TRANSFORMATIONAL_H

flang/lib/Lower/Allocatable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "flang/Optimizer/Builder/FIRBuilder.h"
2323
#include "flang/Optimizer/Dialect/FIROps.h"
2424
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
25-
#include "flang/Optimizer/Runtime/RTBuilder.h"
25+
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
2626
#include "flang/Optimizer/Support/FatalError.h"
2727
#include "flang/Parser/parse-tree.h"
2828
#include "flang/Semantics/tools.h"

flang/lib/Lower/Bridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "flang/Optimizer/Dialect/FIRAttr.h"
3636
#include "flang/Optimizer/Dialect/FIRDialect.h"
3737
#include "flang/Optimizer/Dialect/FIROps.h"
38-
#include "flang/Optimizer/Runtime/Character.h"
38+
#include "flang/Optimizer/Builder/Runtime/Character.h"
3939
#include "flang/Optimizer/Support/FIRContext.h"
4040
#include "flang/Optimizer/Support/FatalError.h"
4141
#include "flang/Optimizer/Support/InternalNames.h"

0 commit comments

Comments
 (0)