FLANG
FIRBuilder.h
1//===-- FirBuilder.h -- FIR operation builder -------------------*- 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//
9// Builder routines for constructing the FIR dialect of MLIR. As FIR is a
10// dialect of MLIR, it makes extensive use of MLIR interfaces and MLIR's coding
11// style (https://mlir.llvm.org/getting_started/DeveloperGuide/) is used in this
12// module.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H
17#define FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H
18
19#include "flang/Optimizer/Dialect/FIROps.h"
20#include "flang/Optimizer/Dialect/FIROpsSupport.h"
21#include "flang/Optimizer/Dialect/FIRType.h"
22#include "flang/Optimizer/Dialect/Support/FIRContext.h"
23#include "flang/Optimizer/Dialect/Support/KindMapping.h"
25#include "mlir/IR/Builders.h"
26#include "mlir/IR/BuiltinOps.h"
27#include "llvm/ADT/DenseMap.h"
28#include <optional>
29#include <utility>
30
31namespace mlir {
32class DataLayout;
33class SymbolTable;
34}
35
36namespace fir {
38class ExtendedValue;
39class MutableBoxValue;
40class BoxValue;
41
43inline mlir::Type getIntPtrType(mlir::OpBuilder &builder) {
44 // TODO: Delay the need of such type until codegen or find a way to use
45 // llvm::DataLayout::getPointerSizeInBits here.
46 return builder.getI64Type();
47}
48
49//===----------------------------------------------------------------------===//
50// FirOpBuilder
51//===----------------------------------------------------------------------===//
52
55class FirOpBuilder : public mlir::OpBuilder, public mlir::OpBuilder::Listener {
56public:
57 explicit FirOpBuilder(mlir::Operation *op, fir::KindMapping kindMap,
58 mlir::SymbolTable *symbolTable = nullptr)
59 : OpBuilder{op, /*listener=*/this}, kindMap{std::move(kindMap)},
60 symbolTable{symbolTable} {
61 auto fmi = mlir::dyn_cast<mlir::arith::ArithFastMathInterface>(*op);
62 if (fmi) {
63 // Set the builder with FastMathFlags attached to the operation.
64 setFastMathFlags(fmi.getFastMathFlagsAttr().getValue());
65 }
66 }
67 explicit FirOpBuilder(mlir::OpBuilder &builder, fir::KindMapping kindMap,
68 mlir::SymbolTable *symbolTable = nullptr)
69 : OpBuilder(builder), OpBuilder::Listener(), kindMap{std::move(kindMap)},
70 symbolTable{symbolTable} {
71 setListener(this);
72 }
73 explicit FirOpBuilder(mlir::OpBuilder &builder, mlir::ModuleOp mod)
74 : OpBuilder(builder), OpBuilder::Listener(),
75 kindMap{getKindMapping(mod)} {
76 setListener(this);
77 }
78 explicit FirOpBuilder(mlir::OpBuilder &builder, fir::KindMapping kindMap,
79 mlir::Operation *op)
80 : OpBuilder(builder), OpBuilder::Listener(), kindMap{std::move(kindMap)} {
81 setListener(this);
82 auto fmi = mlir::dyn_cast<mlir::arith::ArithFastMathInterface>(*op);
83 if (fmi) {
84 // Set the builder with FastMathFlags attached to the operation.
85 setFastMathFlags(fmi.getFastMathFlagsAttr().getValue());
86 }
87 }
88 FirOpBuilder(mlir::OpBuilder &builder, mlir::Operation *op)
89 : FirOpBuilder(builder, fir::getKindMapping(op), op) {}
90
91 // The listener self-reference has to be updated in case of copy-construction.
92 FirOpBuilder(const FirOpBuilder &other)
93 : OpBuilder(other), OpBuilder::Listener(), kindMap{other.kindMap},
94 fastMathFlags{other.fastMathFlags},
95 integerOverflowFlags{other.integerOverflowFlags},
96 symbolTable{other.symbolTable} {
97 setListener(this);
98 }
99
100 FirOpBuilder(FirOpBuilder &&other)
101 : OpBuilder(other), OpBuilder::Listener(),
102 kindMap{std::move(other.kindMap)}, fastMathFlags{other.fastMathFlags},
103 integerOverflowFlags{other.integerOverflowFlags},
104 symbolTable{other.symbolTable} {
105 setListener(this);
106 }
107
109 mlir::Region &getRegion() { return *getBlock()->getParent(); }
110
112 mlir::ModuleOp getModule() {
113 return getRegion().getParentOfType<mlir::ModuleOp>();
114 }
115
117 mlir::func::FuncOp getFunction() {
118 return getRegion().getParentOfType<mlir::func::FuncOp>();
119 }
120
122 const fir::KindMapping &getKindMap() { return kindMap; }
123
125 mlir::SymbolTable *getMLIRSymbolTable() { return symbolTable; }
126
128 [[maybe_unused]] mlir::IntegerType getDefaultIntegerType() {
129 return getIntegerType(
130 getKindMap().getIntegerBitsize(getKindMap().defaultIntegerKind()));
131 }
132
139 mlir::Value convertWithSemantics(mlir::Location loc, mlir::Type toTy,
140 mlir::Value val,
141 bool allowCharacterConversion = false,
142 bool allowRebox = false);
143
145 mlir::Block *getEntryBlock() { return &getFunction().front(); }
146
150 mlir::Block *getAllocaBlock();
151
153 mlir::Type getRefType(mlir::Type eleTy, bool isVolatile = false);
154
156 mlir::Type getVarLenSeqTy(mlir::Type eleTy, unsigned rank = 1);
157
159 mlir::Type getCharacterLengthType() { return getIndexType(); }
160
163 mlir::Type getIntPtrType() { return fir::getIntPtrType(*this); }
164
166 mlir::SymbolRefAttr getSymbolRefAttr(llvm::StringRef str) {
167 return mlir::SymbolRefAttr::get(getContext(), str);
168 }
169
171 mlir::Type getRealType(int kind);
172
173 fir::BoxProcType getBoxProcType(mlir::FunctionType funcTy) {
174 return fir::BoxProcType::get(getContext(), funcTy);
175 }
176
179 mlir::Value createNullConstant(mlir::Location loc, mlir::Type ptrType = {});
180
184 mlir::Value createIntegerConstant(mlir::Location loc, mlir::Type integerType,
185 std::int64_t i);
186
189 mlir::Value createAllOnesInteger(mlir::Location loc, mlir::Type integerType);
190
193 mlir::Value createMinusOneInteger(mlir::Location loc,
194 mlir::Type integerType) {
195 return createAllOnesInteger(loc, integerType);
196 }
197
199 mlir::Value createRealConstant(mlir::Location loc, mlir::Type realType,
200 llvm::APFloat::integerPart val);
201
203 mlir::Value createRealConstant(mlir::Location loc, mlir::Type realType,
204 const llvm::APFloat &val);
205
207 mlir::Value createRealZeroConstant(mlir::Location loc, mlir::Type realType) {
208 return createRealConstant(loc, realType, 0u);
209 }
210
213 mlir::Value allocateLocal(mlir::Location loc, mlir::Type ty,
214 llvm::StringRef uniqName, llvm::StringRef name,
215 bool pinned, llvm::ArrayRef<mlir::Value> shape,
217 bool asTarget = false);
218 mlir::Value allocateLocal(mlir::Location loc, mlir::Type ty,
219 llvm::StringRef uniqName, llvm::StringRef name,
222 bool asTarget = false);
223
226 mlir::ArrayAttr create2DI64ArrayAttr(
227 llvm::SmallVectorImpl<llvm::SmallVector<int64_t>> &intData);
228
232 mlir::Value createTemporaryAlloc(
233 mlir::Location loc, mlir::Type type, llvm::StringRef name,
234 mlir::ValueRange lenParams = {}, mlir::ValueRange shape = {},
235 llvm::ArrayRef<mlir::NamedAttribute> attrs = {},
236 std::optional<Fortran::common::CUDADataAttr> cudaAttr = std::nullopt);
237
241 mlir::Value createTemporary(
242 mlir::Location loc, mlir::Type type, llvm::StringRef name = {},
243 mlir::ValueRange shape = {}, mlir::ValueRange lenParams = {},
244 llvm::ArrayRef<mlir::NamedAttribute> attrs = {},
245 std::optional<Fortran::common::CUDADataAttr> cudaAttr = std::nullopt);
246
248 mlir::Value createTemporary(mlir::Location loc, mlir::Type type,
249 mlir::ValueRange shape) {
250 return createTemporary(loc, type, llvm::StringRef{}, shape);
251 }
252
253 mlir::Value createTemporary(mlir::Location loc, mlir::Type type,
255 return createTemporary(loc, type, llvm::StringRef{}, {}, {}, attrs);
256 }
257
258 mlir::Value createTemporary(mlir::Location loc, mlir::Type type,
259 llvm::StringRef name,
260 llvm::ArrayRef<mlir::NamedAttribute> attrs) {
261 return createTemporary(loc, type, name, {}, {}, attrs);
262 }
263
265 mlir::Value
266 createHeapTemporary(mlir::Location loc, mlir::Type type,
267 llvm::StringRef name = {}, mlir::ValueRange shape = {},
268 mlir::ValueRange lenParams = {},
269 llvm::ArrayRef<mlir::NamedAttribute> attrs = {});
270
275 static mlir::Value genTempDeclareOp(fir::FirOpBuilder &builder,
276 mlir::Location loc, mlir::Value memref,
277 llvm::StringRef name, mlir::Value shape,
278 llvm::ArrayRef<mlir::Value> typeParams,
279 fir::FortranVariableFlagsAttr attrs);
280
297 std::pair<mlir::Value, bool> createAndDeclareTemp(
298 mlir::Location loc, mlir::Type baseType, mlir::Value shape,
299 llvm::ArrayRef<mlir::Value> extents,
300 llvm::ArrayRef<mlir::Value> typeParams,
301 const std::function<decltype(genTempDeclareOp)> &genDeclare,
302 mlir::Value polymorphicMold, bool useStack, llvm::StringRef tmpName);
304 std::pair<mlir::Value, bool>
305 createArrayTemp(mlir::Location loc, fir::SequenceType arrayType,
306 mlir::Value shape, llvm::ArrayRef<mlir::Value> extents,
308 const std::function<decltype(genTempDeclareOp)> &genDeclare,
309 mlir::Value polymorphicMold, bool useStack = false,
310 llvm::StringRef tmpName = ".tmp.array") {
311 return createAndDeclareTemp(loc, arrayType, shape, extents, typeParams,
312 genDeclare, polymorphicMold, useStack, tmpName);
313 }
314
318 mlir::Value genStackSave(mlir::Location loc);
319
322 void genStackRestore(mlir::Location loc, mlir::Value stackPointer);
323
325 fir::GlobalOp createGlobal(mlir::Location loc, mlir::Type type,
326 llvm::StringRef name,
327 mlir::StringAttr linkage = {},
328 mlir::Attribute value = {}, bool isConst = false,
329 bool isTarget = false,
330 cuf::DataAttributeAttr dataAttr = {});
331
332 fir::GlobalOp createGlobal(mlir::Location loc, mlir::Type type,
333 llvm::StringRef name, bool isConst, bool isTarget,
334 std::function<void(FirOpBuilder &)> bodyBuilder,
335 mlir::StringAttr linkage = {},
336 cuf::DataAttributeAttr dataAttr = {});
337
339 fir::GlobalOp createGlobalConstant(mlir::Location loc, mlir::Type type,
340 llvm::StringRef name,
341 mlir::StringAttr linkage = {},
342 mlir::Attribute value = {}) {
343 return createGlobal(loc, type, name, linkage, value, /*isConst=*/true,
344 /*isTarget=*/false);
345 }
346
347 fir::GlobalOp
348 createGlobalConstant(mlir::Location loc, mlir::Type type,
349 llvm::StringRef name,
350 std::function<void(FirOpBuilder &)> bodyBuilder,
351 mlir::StringAttr linkage = {}) {
352 return createGlobal(loc, type, name, /*isConst=*/true, /*isTarget=*/false,
353 bodyBuilder, linkage);
354 }
355
357 fir::StringLitOp createStringLitOp(mlir::Location loc,
358 llvm::StringRef string);
359
360 std::pair<fir::TypeInfoOp, mlir::OpBuilder::InsertPoint>
361 createTypeInfoOp(mlir::Location loc, fir::RecordType recordType,
362 fir::RecordType parentType);
363
364 //===--------------------------------------------------------------------===//
365 // Linkage helpers (inline). The default linkage is external.
366 //===--------------------------------------------------------------------===//
367
368 static mlir::StringAttr createCommonLinkage(mlir::MLIRContext *context) {
369 return mlir::StringAttr::get(context, "common");
370 }
371 mlir::StringAttr createCommonLinkage() {
372 return createCommonLinkage(getContext());
373 }
374
375 mlir::StringAttr createInternalLinkage() { return getStringAttr("internal"); }
376
377 mlir::StringAttr createLinkOnceLinkage() { return getStringAttr("linkonce"); }
378
379 mlir::StringAttr createLinkOnceODRLinkage() {
380 return getStringAttr("linkonce_odr");
381 }
382
383 mlir::StringAttr createWeakLinkage() { return getStringAttr("weak"); }
384
387 mlir::func::FuncOp getNamedFunction(llvm::StringRef name) {
389 }
390 static mlir::func::FuncOp
391 getNamedFunction(mlir::ModuleOp module, const mlir::SymbolTable *symbolTable,
392 llvm::StringRef name);
393
396 mlir::func::FuncOp getNamedFunction(mlir::SymbolRefAttr symbol) {
397 return getNamedFunction(getModule(), getMLIRSymbolTable(), symbol);
398 }
399 static mlir::func::FuncOp
400 getNamedFunction(mlir::ModuleOp module, const mlir::SymbolTable *symbolTable,
401 mlir::SymbolRefAttr symbol);
402
403 fir::GlobalOp getNamedGlobal(llvm::StringRef name) {
404 return getNamedGlobal(getModule(), getMLIRSymbolTable(), name);
405 }
406
407 static fir::GlobalOp getNamedGlobal(mlir::ModuleOp module,
408 const mlir::SymbolTable *symbolTable,
409 llvm::StringRef name);
410
412 mlir::Value createConvert(mlir::Location loc, mlir::Type toTy,
413 mlir::Value val);
414
417 mlir::Value createConvertWithVolatileCast(mlir::Location loc, mlir::Type toTy,
418 mlir::Value val);
419
421 mlir::Value createVolatileCast(mlir::Location loc, bool isVolatile,
422 mlir::Value value);
423
426 void createStoreWithConvert(mlir::Location loc, mlir::Value val,
427 mlir::Value addr);
428
431 mlir::Value loadIfRef(mlir::Location loc, mlir::Value val);
432
435 mlir::func::FuncOp createFunction(mlir::Location loc, llvm::StringRef name,
436 mlir::FunctionType ty) {
437 return createFunction(loc, getModule(), name, ty, getMLIRSymbolTable());
438 }
439
440 static mlir::func::FuncOp createFunction(mlir::Location loc,
441 mlir::ModuleOp module,
442 llvm::StringRef name,
443 mlir::FunctionType ty,
444 mlir::SymbolTable *);
445
450 mlir::func::FuncOp createRuntimeFunction(mlir::Location loc,
451 llvm::StringRef name,
452 mlir::FunctionType ty,
453 bool isIO = false);
454
456 mlir::Value convertToIndexType(mlir::Location loc, mlir::Value val) {
457 return createConvert(loc, getIndexType(), val);
458 }
459
461 mlir::Value genShape(mlir::Location loc, const fir::AbstractArrayBox &arr);
462 mlir::Value genShape(mlir::Location loc, llvm::ArrayRef<mlir::Value> shift,
464 mlir::Value genShape(mlir::Location loc, llvm::ArrayRef<mlir::Value> exts);
465 mlir::Value genShift(mlir::Location loc, llvm::ArrayRef<mlir::Value> shift);
466
469 mlir::Value createShape(mlir::Location loc, const fir::ExtendedValue &exv);
470
473 mlir::Value createSlice(mlir::Location loc, const fir::ExtendedValue &exv,
474 mlir::ValueRange triples, mlir::ValueRange path);
475
482 mlir::Value createBox(mlir::Location loc, const fir::ExtendedValue &exv,
483 bool isPolymorphic = false, bool isAssumedType = false);
484
485 mlir::Value createBox(mlir::Location loc, mlir::Type boxType,
486 mlir::Value addr, mlir::Value shape, mlir::Value slice,
487 llvm::ArrayRef<mlir::Value> lengths, mlir::Value tdesc);
488
490 mlir::Value createBool(mlir::Location loc, bool b) {
491 return createIntegerConstant(loc, getIntegerType(1), b ? 1 : 0);
492 }
493
494 //===--------------------------------------------------------------------===//
495 // If-Then-Else generation helper
496 //===--------------------------------------------------------------------===//
497
502 class IfBuilder {
503 public:
504 IfBuilder(fir::IfOp ifOp, FirOpBuilder &builder)
505 : ifOp{ifOp}, builder{builder} {}
506 template <typename CC>
507 IfBuilder &genThen(CC func) {
508 builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
509 func();
510 return *this;
511 }
512 template <typename CC>
513 IfBuilder &genElse(CC func) {
514 assert(!ifOp.getElseRegion().empty() && "must have else region");
515 builder.setInsertionPointToStart(&ifOp.getElseRegion().front());
516 func();
517 return *this;
518 }
519 void end() { builder.setInsertionPointAfter(ifOp); }
520
522 mlir::Operation::result_range getResults() {
523 end();
524 return ifOp.getResults();
525 }
526
527 fir::IfOp &getIfOp() { return ifOp; };
528
529 private:
530 fir::IfOp ifOp;
531 FirOpBuilder &builder;
532 };
533
536 IfBuilder genIfOp(mlir::Location loc, mlir::TypeRange results,
537 mlir::Value cdt, bool withElseRegion) {
538 auto op = fir::IfOp::create(*this, loc, results, cdt, withElseRegion);
539 return IfBuilder(op, *this);
540 }
541
544 IfBuilder genIfThen(mlir::Location loc, mlir::Value cdt) {
545 auto op = fir::IfOp::create(*this, loc, mlir::TypeRange(), cdt, false);
546 return IfBuilder(op, *this);
547 }
548
551 IfBuilder genIfThenElse(mlir::Location loc, mlir::Value cdt) {
552 auto op = fir::IfOp::create(*this, loc, mlir::TypeRange(), cdt, true);
553 return IfBuilder(op, *this);
554 }
555
556 mlir::Value genNot(mlir::Location loc, mlir::Value boolean) {
557 return mlir::arith::CmpIOp::create(*this, loc,
558 mlir::arith::CmpIPredicate::eq, boolean,
559 createBool(loc, false));
560 }
561
563 mlir::Value genIsNotNullAddr(mlir::Location loc, mlir::Value addr);
564
566 mlir::Value genIsNullAddr(mlir::Location loc, mlir::Value addr);
567
570 mlir::Value genExtentFromTriplet(mlir::Location loc, mlir::Value lb,
571 mlir::Value ub, mlir::Value step,
572 mlir::Type type);
573
576 mlir::Value genAbsentOp(mlir::Location loc, mlir::Type argTy);
577
581 void setFastMathFlags(mlir::arith::FastMathFlags flags) {
582 fastMathFlags = flags;
583 }
584
588
590 mlir::arith::FastMathFlags getFastMathFlags() const { return fastMathFlags; }
591
597 mlir::arith::FastMathFlags flags = getFastMathFlags();
598 if (flags == mlir::arith::FastMathFlags::none)
599 return {};
600
601 std::string fmfString{mlir::arith::stringifyFastMathFlags(flags)};
602 std::replace(fmfString.begin(), fmfString.end(), ',', '_');
603 return fmfString;
604 }
605
609 void setIntegerOverflowFlags(mlir::arith::IntegerOverflowFlags flags) {
610 integerOverflowFlags = flags;
611 }
612
614 mlir::arith::IntegerOverflowFlags getIntegerOverflowFlags() const {
615 return integerOverflowFlags;
616 }
617
621 complexDivisionToRuntimeFlag = flag;
622 }
623
626 return complexDivisionToRuntimeFlag;
627 }
628
630 LLVM_DUMP_METHOD void dumpFunc();
631
633 void notifyOperationInserted(mlir::Operation *op,
634 mlir::OpBuilder::InsertPoint previous) override {
635 // We only care about newly created operations.
636 if (previous.isSet())
637 return;
638 setCommonAttributes(op);
639 }
640
642 mlir::DataLayout &getDataLayout();
643
646 template <typename OpTy>
647 mlir::Value createUnsigned(mlir::Location loc, mlir::Type resultType,
648 mlir::Value left, mlir::Value right) {
649 if (!resultType.isIntOrFloat())
650 return OpTy::create(*this, loc, resultType, left, right);
651 mlir::Type signlessType = mlir::IntegerType::get(
652 getContext(), resultType.getIntOrFloatBitWidth(),
653 mlir::IntegerType::SignednessSemantics::Signless);
654 mlir::Type opResType = resultType;
655 if (left.getType().isUnsignedInteger()) {
656 left = createConvert(loc, signlessType, left);
657 opResType = signlessType;
658 }
659 if (right.getType().isUnsignedInteger()) {
660 right = createConvert(loc, signlessType, right);
661 opResType = signlessType;
662 }
663 mlir::Value result = OpTy::create(*this, loc, opResType, left, right);
664 if (resultType.isUnsignedInteger())
665 result = createConvert(loc, resultType, result);
666 return result;
667 }
668
670 mlir::Value genPtrCompare(mlir::Location loc,
671 mlir::arith::CmpIPredicate predicate,
672 mlir::Value ptr1, mlir::Value ptr2) {
673 ptr1 = createConvert(loc, getIndexType(), ptr1);
674 ptr2 = createConvert(loc, getIndexType(), ptr2);
675 return mlir::arith::CmpIOp::create(*this, loc, predicate, ptr1, ptr2);
676 }
677
678private:
681 void setCommonAttributes(mlir::Operation *op) const;
682
683 KindMapping kindMap;
684
687 mlir::arith::FastMathFlags fastMathFlags{};
688
691 mlir::arith::IntegerOverflowFlags integerOverflowFlags{};
692
695 bool complexDivisionToRuntimeFlag = true;
696
699 mlir::SymbolTable *symbolTable = nullptr;
700
704 std::unique_ptr<mlir::DataLayout> dataLayout = nullptr;
705};
706
707} // namespace fir
708
709namespace fir::factory {
710
711//===----------------------------------------------------------------------===//
712// ExtendedValue inquiry helpers
713//===----------------------------------------------------------------------===//
714
719mlir::Value readCharLen(fir::FirOpBuilder &builder, mlir::Location loc,
720 const fir::ExtendedValue &box);
721
723mlir::Value readExtent(fir::FirOpBuilder &builder, mlir::Location loc,
724 const fir::ExtendedValue &box, unsigned dim);
725
729mlir::Value readLowerBound(fir::FirOpBuilder &builder, mlir::Location loc,
730 const fir::ExtendedValue &box, unsigned dim,
731 mlir::Value defaultValue);
732
734llvm::SmallVector<mlir::Value> readExtents(fir::FirOpBuilder &builder,
735 mlir::Location loc,
736 const fir::BoxValue &box);
737
743fir::ExtendedValue readBoxValue(fir::FirOpBuilder &builder, mlir::Location loc,
744 const fir::BoxValue &box);
745
748llvm::SmallVector<mlir::Value>
749getNonDefaultLowerBounds(fir::FirOpBuilder &builder, mlir::Location loc,
750 const fir::ExtendedValue &exv);
751
755llvm::SmallVector<mlir::Value>
756getNonDeferredLenParams(const fir::ExtendedValue &exv);
757
758//===----------------------------------------------------------------------===//
759// String literal helper helpers
760//===----------------------------------------------------------------------===//
761
764fir::ExtendedValue createStringLiteral(fir::FirOpBuilder &, mlir::Location,
765 llvm::StringRef string);
766
769std::string uniqueCGIdent(llvm::StringRef prefix, llvm::StringRef name);
770
773llvm::SmallVector<mlir::Value> createExtents(fir::FirOpBuilder &builder,
774 mlir::Location loc,
775 fir::SequenceType seqTy);
776
777//===--------------------------------------------------------------------===//
778// Location helpers
779//===--------------------------------------------------------------------===//
780
782mlir::Value locationToFilename(fir::FirOpBuilder &, mlir::Location);
784mlir::Value locationToLineNo(fir::FirOpBuilder &, mlir::Location, mlir::Type);
785
786//===--------------------------------------------------------------------===//
787// ExtendedValue helpers
788//===--------------------------------------------------------------------===//
789
792fir::ExtendedValue componentToExtendedValue(fir::FirOpBuilder &builder,
793 mlir::Location loc,
794 mlir::Value component);
795
802fir::ExtendedValue arrayElementToExtendedValue(fir::FirOpBuilder &builder,
803 mlir::Location loc,
804 const fir::ExtendedValue &array,
805 mlir::Value element);
806
811fir::ExtendedValue arraySectionElementToExtendedValue(
812 fir::FirOpBuilder &builder, mlir::Location loc,
813 const fir::ExtendedValue &array, mlir::Value element, mlir::Value slice);
814
817void genScalarAssignment(fir::FirOpBuilder &builder, mlir::Location loc,
818 const fir::ExtendedValue &lhs,
819 const fir::ExtendedValue &rhs,
820 bool needFinalization = false,
821 bool isTemporaryLHS = false);
822
826void genRecordAssignment(fir::FirOpBuilder &builder, mlir::Location loc,
827 const fir::ExtendedValue &lhs,
828 const fir::ExtendedValue &rhs,
829 bool needFinalization = false,
830 bool isTemporaryLHS = false);
831
835mlir::TupleType getRaggedArrayHeaderType(fir::FirOpBuilder &builder);
836
841mlir::Value genLenOfCharacter(fir::FirOpBuilder &builder, mlir::Location loc,
842 fir::ArrayLoadOp arrLoad,
843 llvm::ArrayRef<mlir::Value> path,
844 llvm::ArrayRef<mlir::Value> substring);
845mlir::Value genLenOfCharacter(fir::FirOpBuilder &builder, mlir::Location loc,
846 fir::SequenceType seqTy, mlir::Value memref,
847 llvm::ArrayRef<mlir::Value> typeParams,
848 llvm::ArrayRef<mlir::Value> path,
849 llvm::ArrayRef<mlir::Value> substring);
850
853mlir::Value createZeroValue(fir::FirOpBuilder &builder, mlir::Location loc,
854 mlir::Type type);
855
857std::optional<std::int64_t> getExtentFromTriplet(mlir::Value lb, mlir::Value ub,
858 mlir::Value stride);
859
862mlir::Value computeExtent(fir::FirOpBuilder &builder, mlir::Location loc,
863 mlir::Value lb, mlir::Value ub);
864mlir::Value computeExtent(fir::FirOpBuilder &builder, mlir::Location loc,
865 mlir::Value lb, mlir::Value ub, mlir::Value zero,
866 mlir::Value one);
867
869mlir::Value genMaxWithZero(fir::FirOpBuilder &builder, mlir::Location loc,
870 mlir::Value value);
871mlir::Value genMaxWithZero(fir::FirOpBuilder &builder, mlir::Location loc,
872 mlir::Value value, mlir::Value zero);
873
877mlir::Value genCPtrOrCFunptrAddr(fir::FirOpBuilder &builder, mlir::Location loc,
878 mlir::Value cPtr, mlir::Type ty);
879
882mlir::Value genCDevPtrAddr(fir::FirOpBuilder &builder, mlir::Location loc,
883 mlir::Value cDevPtr, mlir::Type ty);
884
886mlir::Value genCPtrOrCFunptrValue(fir::FirOpBuilder &builder,
887 mlir::Location loc, mlir::Value cPtr);
888
891fir::BoxValue createBoxValue(fir::FirOpBuilder &builder, mlir::Location loc,
892 const fir::ExtendedValue &exv);
893
895mlir::Value createNullBoxProc(fir::FirOpBuilder &builder, mlir::Location loc,
896 mlir::Type boxType);
897
900mlir::Value createConvert(mlir::OpBuilder &, mlir::Location, mlir::Type,
901 mlir::Value);
902
904void setInternalLinkage(mlir::func::FuncOp);
905
906llvm::SmallVector<mlir::Value>
907elideExtentsAlreadyInType(mlir::Type type, mlir::ValueRange shape);
908
909llvm::SmallVector<mlir::Value>
910elideLengthsAlreadyInType(mlir::Type type, mlir::ValueRange lenParams);
911
913uint64_t getAllocaAddressSpace(const mlir::DataLayout *dataLayout);
914
921llvm::SmallVector<mlir::Value> deduceOptimalExtents(mlir::ValueRange extents1,
922 mlir::ValueRange extents2);
923
924uint64_t getGlobalAddressSpace(mlir::DataLayout *dataLayout);
925
926uint64_t getProgramAddressSpace(mlir::DataLayout *dataLayout);
927
938llvm::SmallVector<mlir::Value> updateRuntimeExtentsForEmptyArrays(
939 fir::FirOpBuilder &builder, mlir::Location loc, mlir::ValueRange extents);
940
945void genDimInfoFromBox(fir::FirOpBuilder &builder, mlir::Location loc,
946 mlir::Value box,
947 llvm::SmallVectorImpl<mlir::Value> *lbounds,
948 llvm::SmallVectorImpl<mlir::Value> *extents,
949 llvm::SmallVectorImpl<mlir::Value> *strides);
950
954mlir::Value genLifetimeStart(mlir::OpBuilder &builder, mlir::Location loc,
955 fir::AllocaOp alloc, const mlir::DataLayout *dl);
956
959void genLifetimeEnd(mlir::OpBuilder &builder, mlir::Location loc,
960 mlir::Value mem);
961
962} // namespace fir::factory
963
964#endif // FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H
Definition MathOptionsBase.h:22
Definition BoxValue.h:125
Definition BoxValue.h:291
Definition BoxValue.h:478
Definition FIRBuilder.h:502
mlir::Operation::result_range getResults()
End the IfOp and return the results if any.
Definition FIRBuilder.h:522
Definition FIRBuilder.h:55
IfBuilder genIfThenElse(mlir::Location loc, mlir::Value cdt)
Definition FIRBuilder.h:551
fir::StringLitOp createStringLitOp(mlir::Location loc, llvm::StringRef string)
Convert a StringRef string into a fir::StringLitOp.
Definition FIRBuilder.cpp:631
fir::GlobalOp createGlobal(mlir::Location loc, mlir::Type type, llvm::StringRef name, mlir::StringAttr linkage={}, mlir::Attribute value={}, bool isConst=false, bool isTarget=false, cuf::DataAttributeAttr dataAttr={})
Create a global value.
Definition FIRBuilder.cpp:446
void genStackRestore(mlir::Location loc, mlir::Value stackPointer)
Definition FIRBuilder.cpp:439
mlir::SymbolRefAttr getSymbolRefAttr(llvm::StringRef str)
Wrap str to a SymbolRefAttr.
Definition FIRBuilder.h:166
mlir::Value createRealZeroConstant(mlir::Location loc, mlir::Type realType)
Create a real constant of type realType with a value zero.
Definition FIRBuilder.h:207
mlir::Value createSlice(mlir::Location loc, const fir::ExtendedValue &exv, mlir::ValueRange triples, mlir::ValueRange path)
Definition FIRBuilder.cpp:697
mlir::Value createConvert(mlir::Location loc, mlir::Type toTy, mlir::Value val)
Lazy creation of fir.convert op.
Definition FIRBuilder.cpp:611
IfBuilder genIfOp(mlir::Location loc, mlir::TypeRange results, mlir::Value cdt, bool withElseRegion)
Definition FIRBuilder.h:536
mlir::Value genIsNullAddr(mlir::Location loc, mlir::Value addr)
Generate code testing addr is a null address.
Definition FIRBuilder.cpp:855
mlir::func::FuncOp getNamedFunction(mlir::SymbolRefAttr symbol)
Definition FIRBuilder.h:396
mlir::Value createRealConstant(mlir::Location loc, mlir::Type realType, llvm::APFloat::integerPart val)
Create a real constant from an integer value.
Definition FIRBuilder.cpp:177
mlir::Type getCharacterLengthType()
Get character length type.
Definition FIRBuilder.h:159
mlir::Value createTemporaryAlloc(mlir::Location loc, mlir::Type type, llvm::StringRef name, mlir::ValueRange lenParams={}, mlir::ValueRange shape={}, llvm::ArrayRef< mlir::NamedAttribute > attrs={}, std::optional< Fortran::common::CUDADataAttr > cudaAttr=std::nullopt)
Definition FIRBuilder.cpp:329
IfBuilder genIfThen(mlir::Location loc, mlir::Value cdt)
Definition FIRBuilder.h:544
mlir::Value genStackSave(mlir::Location loc)
Definition FIRBuilder.cpp:433
mlir::Value genShape(mlir::Location loc, const fir::AbstractArrayBox &arr)
Construct one of the two forms of shape op from an array box.
Definition FIRBuilder.cpp:663
const fir::KindMapping & getKindMap()
Get a reference to the kind map.
Definition FIRBuilder.h:122
mlir::Type getRefType(mlir::Type eleTy, bool isVolatile=false)
Safely create a reference type to the type eleTy.
Definition FIRBuilder.cpp:108
mlir::Value createAllOnesInteger(mlir::Location loc, mlir::Type integerType)
Definition FIRBuilder.cpp:166
mlir::ModuleOp getModule()
Get the current Module.
Definition FIRBuilder.h:112
std::pair< mlir::Value, bool > createAndDeclareTemp(mlir::Location loc, mlir::Type baseType, mlir::Value shape, llvm::ArrayRef< mlir::Value > extents, llvm::ArrayRef< mlir::Value > typeParams, const std::function< decltype(genTempDeclareOp)> &genDeclare, mlir::Value polymorphicMold, bool useStack, llvm::StringRef tmpName)
Definition FIRBuilder.cpp:392
fir::GlobalOp createGlobalConstant(mlir::Location loc, mlir::Type type, llvm::StringRef name, mlir::StringAttr linkage={}, mlir::Attribute value={})
Create a global constant (read-only) value.
Definition FIRBuilder.h:339
mlir::Value createMinusOneInteger(mlir::Location loc, mlir::Type integerType)
Definition FIRBuilder.h:193
mlir::Value createVolatileCast(mlir::Location loc, bool isVolatile, mlir::Value value)
Cast value to have isVolatile volatility.
Definition FIRBuilder.cpp:581
void setComplexDivisionToRuntimeFlag(bool flag)
Definition FIRBuilder.h:620
mlir::IntegerType getDefaultIntegerType()
Get the default integer type.
Definition FIRBuilder.h:128
mlir::Value createNullConstant(mlir::Location loc, mlir::Type ptrType={})
Definition FIRBuilder.cpp:138
void setFastMathFlags(mlir::arith::FastMathFlags flags)
Definition FIRBuilder.h:581
LLVM_DUMP_METHOD void dumpFunc()
Dump the current function. (debug)
Definition FIRBuilder.cpp:837
mlir::ArrayAttr create2DI64ArrayAttr(llvm::SmallVectorImpl< llvm::SmallVector< int64_t > > &intData)
Definition FIRBuilder.cpp:319
mlir::Value convertWithSemantics(mlir::Location loc, mlir::Type toTy, mlir::Value val, bool allowCharacterConversion=false, bool allowRebox=false)
Definition FIRBuilder.cpp:508
mlir::SymbolTable * getMLIRSymbolTable()
Get func.func/fir.global symbol table attached to this builder if any.
Definition FIRBuilder.h:125
std::pair< mlir::Value, bool > createArrayTemp(mlir::Location loc, fir::SequenceType arrayType, mlir::Value shape, llvm::ArrayRef< mlir::Value > extents, llvm::ArrayRef< mlir::Value > typeParams, const std::function< decltype(genTempDeclareOp)> &genDeclare, mlir::Value polymorphicMold, bool useStack=false, llvm::StringRef tmpName=".tmp.array")
Create and declare an array temporary.
Definition FIRBuilder.h:305
mlir::Value genPtrCompare(mlir::Location loc, mlir::arith::CmpIPredicate predicate, mlir::Value ptr1, mlir::Value ptr2)
Compare two pointer-like values using the given predicate.
Definition FIRBuilder.h:670
mlir::Value genIsNotNullAddr(mlir::Location loc, mlir::Value addr)
Generate code testing addr is not a null address.
Definition FIRBuilder.cpp:849
mlir::Value convertToIndexType(mlir::Location loc, mlir::Value val)
Cast the input value to IndexType.
Definition FIRBuilder.h:456
void createStoreWithConvert(mlir::Location loc, mlir::Value val, mlir::Value addr)
Definition FIRBuilder.cpp:616
void setIntegerOverflowFlags(mlir::arith::IntegerOverflowFlags flags)
Definition FIRBuilder.h:609
mlir::func::FuncOp createRuntimeFunction(mlir::Location loc, llvm::StringRef name, mlir::FunctionType ty, bool isIO=false)
Definition FIRBuilder.cpp:52
mlir::Region & getRegion()
Get the current Region of the insertion point.
Definition FIRBuilder.h:109
void notifyOperationInserted(mlir::Operation *op, mlir::OpBuilder::InsertPoint previous) override
FirOpBuilder hook for creating new operation.
Definition FIRBuilder.h:633
static mlir::Value genTempDeclareOp(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value memref, llvm::StringRef name, mlir::Value shape, llvm::ArrayRef< mlir::Value > typeParams, fir::FortranVariableFlagsAttr attrs)
Definition FIRBuilder.cpp:420
mlir::func::FuncOp getNamedFunction(llvm::StringRef name)
Definition FIRBuilder.h:387
mlir::Value genExtentFromTriplet(mlir::Location loc, mlir::Value lb, mlir::Value ub, mlir::Value step, mlir::Type type)
Definition FIRBuilder.cpp:861
std::string getFastMathFlagsString()
Definition FIRBuilder.h:596
mlir::Value createUnsigned(mlir::Location loc, mlir::Type resultType, mlir::Value left, mlir::Value right)
Definition FIRBuilder.h:647
bool getComplexDivisionToRuntimeFlag() const
Get current ComplexDivisionToRuntimeFlag value.
Definition FIRBuilder.h:625
mlir::Value createBool(mlir::Location loc, bool b)
Create constant i1 with value 1. if b is true or 0. otherwise.
Definition FIRBuilder.h:490
mlir::arith::IntegerOverflowFlags getIntegerOverflowFlags() const
Get current IntegerOverflowFlags value.
Definition FIRBuilder.h:614
mlir::func::FuncOp getFunction()
Get the current Function.
Definition FIRBuilder.h:117
mlir::Value createTemporary(mlir::Location loc, mlir::Type type, llvm::StringRef name={}, mlir::ValueRange shape={}, mlir::ValueRange lenParams={}, llvm::ArrayRef< mlir::NamedAttribute > attrs={}, std::optional< Fortran::common::CUDADataAttr > cudaAttr=std::nullopt)
Definition FIRBuilder.cpp:353
mlir::Type getRealType(int kind)
Get the mlir float type that implements Fortran REAL(kind).
Definition FIRBuilder.cpp:118
mlir::Block * getAllocaBlock()
Get the block for adding Allocas.
Definition FIRBuilder.cpp:277
mlir::Type getVarLenSeqTy(mlir::Type eleTy, unsigned rank=1)
Create a sequence of eleTy with rank dimensions of unknown size.
Definition FIRBuilder.cpp:113
mlir::Value loadIfRef(mlir::Location loc, mlir::Value val)
Definition FIRBuilder.cpp:625
mlir::Value createHeapTemporary(mlir::Location loc, mlir::Type type, llvm::StringRef name={}, mlir::ValueRange shape={}, mlir::ValueRange lenParams={}, llvm::ArrayRef< mlir::NamedAttribute > attrs={})
Create a temporary on the heap.
Definition FIRBuilder.cpp:377
mlir::Value createConvertWithVolatileCast(mlir::Location loc, mlir::Type toTy, mlir::Value val)
Definition FIRBuilder.cpp:591
mlir::Value createShape(mlir::Location loc, const fir::ExtendedValue &exv)
Definition FIRBuilder.cpp:676
mlir::Value allocateLocal(mlir::Location loc, mlir::Type ty, llvm::StringRef uniqName, llvm::StringRef name, bool pinned, llvm::ArrayRef< mlir::Value > shape, llvm::ArrayRef< mlir::Value > lenParams, bool asTarget=false)
Definition FIRBuilder.cpp:237
mlir::Value genAbsentOp(mlir::Location loc, mlir::Type argTy)
Definition FIRBuilder.cpp:878
mlir::arith::FastMathFlags getFastMathFlags() const
Get current FastMathFlags value.
Definition FIRBuilder.h:590
mlir::Value createIntegerConstant(mlir::Location loc, mlir::Type integerType, std::int64_t i)
Definition FIRBuilder.cpp:144
mlir::Value createBox(mlir::Location loc, const fir::ExtendedValue &exv, bool isPolymorphic=false, bool isAssumedType=false)
Definition FIRBuilder.cpp:748
mlir::Block * getEntryBlock()
Get the entry block of the current Function.
Definition FIRBuilder.h:145
mlir::func::FuncOp createFunction(mlir::Location loc, llvm::StringRef name, mlir::FunctionType ty)
Definition FIRBuilder.h:435
mlir::DataLayout & getDataLayout()
Construct a data layout on demand and return it.
Definition FIRBuilder.cpp:941
mlir::Value createTemporary(mlir::Location loc, mlir::Type type, mlir::ValueRange shape)
Create an unnamed and untracked temporary on the stack.
Definition FIRBuilder.h:248
mlir::Type getIntPtrType()
Definition FIRBuilder.h:163
Definition KindMapping.h:48
Definition BoxValue.h:360
Definition FIRType.h:89
Definition OpenACC.h:20
Definition BoxValue.h:445
fir::ExtendedValue componentToExtendedValue(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value component)
Definition FIRBuilder.cpp:1296
mlir::Value genMaxWithZero(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value value)
Generate max(value, 0) where value is a scalar integer.
Definition FIRBuilder.cpp:1714
mlir::Value createZeroValue(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type type)
Definition FIRBuilder.cpp:1654
llvm::SmallVector< mlir::Value > deduceOptimalExtents(mlir::ValueRange extents1, mlir::ValueRange extents2)
Definition FIRBuilder.cpp:1882
mlir::Value readLowerBound(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim, mlir::Value defaultValue)
Definition FIRBuilder.cpp:1008
std::string uniqueCGIdent(llvm::StringRef prefix, llvm::StringRef name)
Definition FIRBuilder.cpp:1210
mlir::Value genCDevPtrAddr(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cDevPtr, mlir::Type ty)
Definition FIRBuilder.cpp:1764
llvm::SmallVector< mlir::Value > updateRuntimeExtentsForEmptyArrays(fir::FirOpBuilder &builder, mlir::Location loc, mlir::ValueRange extents)
Definition FIRBuilder.cpp:1909
void genScalarAssignment(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs, bool needFinalization=false, bool isTemporaryLHS=false)
Definition FIRBuilder.cpp:1395
llvm::SmallVector< mlir::Value > getNonDefaultLowerBounds(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &exv)
Definition FIRBuilder.cpp:1106
fir::ExtendedValue createStringLiteral(fir::FirOpBuilder &, mlir::Location, llvm::StringRef string)
Definition FIRBuilder.cpp:1248
mlir::TupleType getRaggedArrayHeaderType(fir::FirOpBuilder &builder)
Definition FIRBuilder.cpp:1587
mlir::Value locationToFilename(fir::FirOpBuilder &, mlir::Location)
Generate a string literal containing the file name and return its address.
Definition FIRBuilder.cpp:1230
mlir::Value locationToLineNo(fir::FirOpBuilder &, mlir::Location, mlir::Type)
Generate a constant of the given type with the location line number.
Definition FIRBuilder.cpp:1240
mlir::Value readExtent(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim)
Read or get the extent in dimension dim of the array described by box.
Definition FIRBuilder.cpp:977
mlir::Value readCharLen(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box)
Definition FIRBuilder.cpp:952
void genLifetimeEnd(mlir::OpBuilder &builder, mlir::Location loc, mlir::Value mem)
Definition FIRBuilder.cpp:1973
mlir::Value genCPtrOrCFunptrAddr(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cPtr, mlir::Type ty)
Definition FIRBuilder.cpp:1754
llvm::SmallVector< mlir::Value > readExtents(fir::FirOpBuilder &builder, mlir::Location loc, const fir::BoxValue &box)
Read extents from box.
Definition FIRBuilder.cpp:1038
std::optional< std::int64_t > getExtentFromTriplet(mlir::Value lb, mlir::Value ub, mlir::Value stride)
Get the integer constants of triplet and compute the extent.
Definition FIRBuilder.cpp:1674
mlir::Value genCPtrOrCFunptrValue(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cPtr)
Get the C address value.
Definition FIRBuilder.cpp:1783
uint64_t getAllocaAddressSpace(const mlir::DataLayout *dataLayout)
Get the address space which should be used for allocas.
Definition FIRBuilder.cpp:1874
void setInternalLinkage(mlir::func::FuncOp)
Set internal linkage attribute on a function.
Definition FIRBuilder.cpp:1866
mlir::Value createNullBoxProc(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxType)
Generate Null BoxProc for procedure pointer null initialization.
Definition FIRBuilder.cpp:1855
fir::ExtendedValue arraySectionElementToExtendedValue(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &array, mlir::Value element, mlir::Value slice)
Definition FIRBuilder.cpp:1380
mlir::Value genLenOfCharacter(fir::FirOpBuilder &builder, mlir::Location loc, fir::ArrayLoadOp arrLoad, llvm::ArrayRef< mlir::Value > path, llvm::ArrayRef< mlir::Value > substring)
Definition FIRBuilder.cpp:1596
fir::BoxValue createBoxValue(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &exv)
Definition FIRBuilder.cpp:1817
void genDimInfoFromBox(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value box, llvm::SmallVectorImpl< mlir::Value > *lbounds, llvm::SmallVectorImpl< mlir::Value > *extents, llvm::SmallVectorImpl< mlir::Value > *strides)
Definition FIRBuilder.cpp:1935
void genRecordAssignment(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs, bool needFinalization=false, bool isTemporaryLHS=false)
Definition FIRBuilder.cpp:1540
mlir::Value createConvert(mlir::OpBuilder &, mlir::Location, mlir::Type, mlir::Value)
Definition FIRBuilder.cpp:598
fir::ExtendedValue readBoxValue(fir::FirOpBuilder &builder, mlir::Location loc, const fir::BoxValue &box)
Definition FIRBuilder.cpp:1077
mlir::Value computeExtent(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value lb, mlir::Value ub)
Definition FIRBuilder.cpp:1731
fir::ExtendedValue arrayElementToExtendedValue(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &array, mlir::Value element)
Definition FIRBuilder.cpp:1350
llvm::SmallVector< mlir::Value > getNonDeferredLenParams(const fir::ExtendedValue &exv)
Definition FIRBuilder.cpp:1128
llvm::SmallVector< mlir::Value > createExtents(fir::FirOpBuilder &builder, mlir::Location loc, fir::SequenceType seqTy)
Definition FIRBuilder.cpp:1270
mlir::Value genLifetimeStart(mlir::OpBuilder &builder, mlir::Location loc, fir::AllocaOp alloc, const mlir::DataLayout *dl)
Definition FIRBuilder.cpp:1961
Definition AbstractConverter.h:34
KindMapping getKindMapping(mlir::ModuleOp mod)
Definition FIRContext.cpp:43
mlir::Type getIntPtrType(mlir::OpBuilder &builder)
Get the integer type with a pointer size.
Definition FIRBuilder.h:43
bool isAssumedType(mlir::Type ty)
Definition FIRType.cpp:353
Definition AbstractConverter.h:29