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 createExternalLinkage() { return getStringAttr("external"); }
376
377 mlir::StringAttr createInternalLinkage() { return getStringAttr("internal"); }
378
379 mlir::StringAttr createLinkOnceLinkage() { return getStringAttr("linkonce"); }
380
381 mlir::StringAttr createLinkOnceODRLinkage() {
382 return getStringAttr("linkonce_odr");
383 }
384
385 mlir::StringAttr createWeakLinkage() { return getStringAttr("weak"); }
386
389 mlir::func::FuncOp getNamedFunction(llvm::StringRef name) {
391 }
392 static mlir::func::FuncOp
393 getNamedFunction(mlir::ModuleOp module, const mlir::SymbolTable *symbolTable,
394 llvm::StringRef name);
395
398 mlir::func::FuncOp getNamedFunction(mlir::SymbolRefAttr symbol) {
399 return getNamedFunction(getModule(), getMLIRSymbolTable(), symbol);
400 }
401 static mlir::func::FuncOp
402 getNamedFunction(mlir::ModuleOp module, const mlir::SymbolTable *symbolTable,
403 mlir::SymbolRefAttr symbol);
404
405 fir::GlobalOp getNamedGlobal(llvm::StringRef name) {
406 return getNamedGlobal(getModule(), getMLIRSymbolTable(), name);
407 }
408
409 static fir::GlobalOp getNamedGlobal(mlir::ModuleOp module,
410 const mlir::SymbolTable *symbolTable,
411 llvm::StringRef name);
412
414 mlir::Value createConvert(mlir::Location loc, mlir::Type toTy,
415 mlir::Value val);
416
419 mlir::Value createConvertWithVolatileCast(mlir::Location loc, mlir::Type toTy,
420 mlir::Value val);
421
423 mlir::Value createVolatileCast(mlir::Location loc, bool isVolatile,
424 mlir::Value value);
425
428 void createStoreWithConvert(mlir::Location loc, mlir::Value val,
429 mlir::Value addr);
430
433 mlir::Value loadIfRef(mlir::Location loc, mlir::Value val);
434
437 mlir::func::FuncOp createFunction(mlir::Location loc, llvm::StringRef name,
438 mlir::FunctionType ty) {
439 return createFunction(loc, getModule(), name, ty, getMLIRSymbolTable());
440 }
441
442 static mlir::func::FuncOp createFunction(mlir::Location loc,
443 mlir::ModuleOp module,
444 llvm::StringRef name,
445 mlir::FunctionType ty,
446 mlir::SymbolTable *);
447
452 mlir::func::FuncOp createRuntimeFunction(mlir::Location loc,
453 llvm::StringRef name,
454 mlir::FunctionType ty,
455 bool isIO = false);
456
458 mlir::Value convertToIndexType(mlir::Location loc, mlir::Value val) {
459 return createConvert(loc, getIndexType(), val);
460 }
461
463 mlir::Value genShape(mlir::Location loc, const fir::AbstractArrayBox &arr);
464 mlir::Value genShape(mlir::Location loc, llvm::ArrayRef<mlir::Value> shift,
466 mlir::Value genShape(mlir::Location loc, llvm::ArrayRef<mlir::Value> exts);
467 mlir::Value genShift(mlir::Location loc, llvm::ArrayRef<mlir::Value> shift);
468
471 mlir::Value createShape(mlir::Location loc, const fir::ExtendedValue &exv);
472
475 mlir::Value createSlice(mlir::Location loc, const fir::ExtendedValue &exv,
476 mlir::ValueRange triples, mlir::ValueRange path);
477
484 mlir::Value createBox(mlir::Location loc, const fir::ExtendedValue &exv,
485 bool isPolymorphic = false, bool isAssumedType = false);
486
487 mlir::Value createBox(mlir::Location loc, mlir::Type boxType,
488 mlir::Value addr, mlir::Value shape, mlir::Value slice,
489 llvm::ArrayRef<mlir::Value> lengths, mlir::Value tdesc);
490
492 mlir::Value createBool(mlir::Location loc, bool b) {
493 return createIntegerConstant(loc, getIntegerType(1), b ? 1 : 0);
494 }
495
496 //===--------------------------------------------------------------------===//
497 // If-Then-Else generation helper
498 //===--------------------------------------------------------------------===//
499
504 class IfBuilder {
505 public:
506 IfBuilder(fir::IfOp ifOp, FirOpBuilder &builder)
507 : ifOp{ifOp}, builder{builder} {}
508 template <typename CC>
509 IfBuilder &genThen(CC func) {
510 builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
511 func();
512 return *this;
513 }
514 template <typename CC>
515 IfBuilder &genElse(CC func) {
516 assert(!ifOp.getElseRegion().empty() && "must have else region");
517 builder.setInsertionPointToStart(&ifOp.getElseRegion().front());
518 func();
519 return *this;
520 }
521 void end() { builder.setInsertionPointAfter(ifOp); }
522
524 mlir::Operation::result_range getResults() {
525 end();
526 return ifOp.getResults();
527 }
528
529 fir::IfOp &getIfOp() { return ifOp; };
530
531 private:
532 fir::IfOp ifOp;
533 FirOpBuilder &builder;
534 };
535
538 IfBuilder genIfOp(mlir::Location loc, mlir::TypeRange results,
539 mlir::Value cdt, bool withElseRegion) {
540 auto op = fir::IfOp::create(*this, loc, results, cdt, withElseRegion);
541 return IfBuilder(op, *this);
542 }
543
546 IfBuilder genIfThen(mlir::Location loc, mlir::Value cdt) {
547 auto op = fir::IfOp::create(*this, loc, mlir::TypeRange(), cdt, false);
548 return IfBuilder(op, *this);
549 }
550
553 IfBuilder genIfThenElse(mlir::Location loc, mlir::Value cdt) {
554 auto op = fir::IfOp::create(*this, loc, mlir::TypeRange(), cdt, true);
555 return IfBuilder(op, *this);
556 }
557
558 mlir::Value genNot(mlir::Location loc, mlir::Value boolean) {
559 return mlir::arith::CmpIOp::create(*this, loc,
560 mlir::arith::CmpIPredicate::eq, boolean,
561 createBool(loc, false));
562 }
563
565 mlir::Value genIsNotNullAddr(mlir::Location loc, mlir::Value addr);
566
568 mlir::Value genIsNullAddr(mlir::Location loc, mlir::Value addr);
569
572 mlir::Value genExtentFromTriplet(mlir::Location loc, mlir::Value lb,
573 mlir::Value ub, mlir::Value step,
574 mlir::Type type);
575
578 mlir::Value genAbsentOp(mlir::Location loc, mlir::Type argTy);
579
583 void setFastMathFlags(mlir::arith::FastMathFlags flags) {
584 fastMathFlags = flags;
585 }
586
590
592 mlir::arith::FastMathFlags getFastMathFlags() const { return fastMathFlags; }
593
599 mlir::arith::FastMathFlags flags = getFastMathFlags();
600 if (flags == mlir::arith::FastMathFlags::none)
601 return {};
602
603 std::string fmfString{mlir::arith::stringifyFastMathFlags(flags)};
604 std::replace(fmfString.begin(), fmfString.end(), ',', '_');
605 return fmfString;
606 }
607
611 void setIntegerOverflowFlags(mlir::arith::IntegerOverflowFlags flags) {
612 integerOverflowFlags = flags;
613 }
614
616 mlir::arith::IntegerOverflowFlags getIntegerOverflowFlags() const {
617 return integerOverflowFlags;
618 }
619
623 complexDivisionToRuntimeFlag = flag;
624 }
625
628 return complexDivisionToRuntimeFlag;
629 }
630
632 LLVM_DUMP_METHOD void dumpFunc();
633
635 void notifyOperationInserted(mlir::Operation *op,
636 mlir::OpBuilder::InsertPoint previous) override {
637 // We only care about newly created operations.
638 if (previous.isSet())
639 return;
640 setCommonAttributes(op);
641 }
642
644 mlir::DataLayout &getDataLayout();
645
648 template <typename OpTy>
649 mlir::Value createUnsigned(mlir::Location loc, mlir::Type resultType,
650 mlir::Value left, mlir::Value right) {
651 if (!resultType.isIntOrFloat())
652 return OpTy::create(*this, loc, resultType, left, right);
653 mlir::Type signlessType = mlir::IntegerType::get(
654 getContext(), resultType.getIntOrFloatBitWidth(),
655 mlir::IntegerType::SignednessSemantics::Signless);
656 mlir::Type opResType = resultType;
657 if (left.getType().isUnsignedInteger()) {
658 left = createConvert(loc, signlessType, left);
659 opResType = signlessType;
660 }
661 if (right.getType().isUnsignedInteger()) {
662 right = createConvert(loc, signlessType, right);
663 opResType = signlessType;
664 }
665 mlir::Value result = OpTy::create(*this, loc, opResType, left, right);
666 if (resultType.isUnsignedInteger())
667 result = createConvert(loc, resultType, result);
668 return result;
669 }
670
672 mlir::Value genPtrCompare(mlir::Location loc,
673 mlir::arith::CmpIPredicate predicate,
674 mlir::Value ptr1, mlir::Value ptr2) {
675 ptr1 = createConvert(loc, getIndexType(), ptr1);
676 ptr2 = createConvert(loc, getIndexType(), ptr2);
677 return mlir::arith::CmpIOp::create(*this, loc, predicate, ptr1, ptr2);
678 }
679
680private:
683 void setCommonAttributes(mlir::Operation *op) const;
684
685 KindMapping kindMap;
686
689 mlir::arith::FastMathFlags fastMathFlags{};
690
693 mlir::arith::IntegerOverflowFlags integerOverflowFlags{};
694
697 bool complexDivisionToRuntimeFlag = true;
698
701 mlir::SymbolTable *symbolTable = nullptr;
702
706 std::unique_ptr<mlir::DataLayout> dataLayout = nullptr;
707};
708
709} // namespace fir
710
711namespace fir::factory {
712
713//===----------------------------------------------------------------------===//
714// ExtendedValue inquiry helpers
715//===----------------------------------------------------------------------===//
716
721mlir::Value readCharLen(fir::FirOpBuilder &builder, mlir::Location loc,
722 const fir::ExtendedValue &box);
723
725mlir::Value readExtent(fir::FirOpBuilder &builder, mlir::Location loc,
726 const fir::ExtendedValue &box, unsigned dim);
727
731mlir::Value readLowerBound(fir::FirOpBuilder &builder, mlir::Location loc,
732 const fir::ExtendedValue &box, unsigned dim,
733 mlir::Value defaultValue);
734
736llvm::SmallVector<mlir::Value> readExtents(fir::FirOpBuilder &builder,
737 mlir::Location loc,
738 const fir::BoxValue &box);
739
745fir::ExtendedValue readBoxValue(fir::FirOpBuilder &builder, mlir::Location loc,
746 const fir::BoxValue &box);
747
750llvm::SmallVector<mlir::Value>
751getNonDefaultLowerBounds(fir::FirOpBuilder &builder, mlir::Location loc,
752 const fir::ExtendedValue &exv);
753
757llvm::SmallVector<mlir::Value>
758getNonDeferredLenParams(const fir::ExtendedValue &exv);
759
760//===----------------------------------------------------------------------===//
761// String literal helper helpers
762//===----------------------------------------------------------------------===//
763
766fir::ExtendedValue createStringLiteral(fir::FirOpBuilder &, mlir::Location,
767 llvm::StringRef string);
768
771std::string uniqueCGIdent(llvm::StringRef prefix, llvm::StringRef name);
772
775llvm::SmallVector<mlir::Value> createExtents(fir::FirOpBuilder &builder,
776 mlir::Location loc,
777 fir::SequenceType seqTy);
778
779//===--------------------------------------------------------------------===//
780// Location helpers
781//===--------------------------------------------------------------------===//
782
784mlir::Value locationToFilename(fir::FirOpBuilder &, mlir::Location);
786mlir::Value locationToLineNo(fir::FirOpBuilder &, mlir::Location, mlir::Type);
787
788//===--------------------------------------------------------------------===//
789// ExtendedValue helpers
790//===--------------------------------------------------------------------===//
791
794fir::ExtendedValue componentToExtendedValue(fir::FirOpBuilder &builder,
795 mlir::Location loc,
796 mlir::Value component);
797
804fir::ExtendedValue arrayElementToExtendedValue(fir::FirOpBuilder &builder,
805 mlir::Location loc,
806 const fir::ExtendedValue &array,
807 mlir::Value element);
808
813fir::ExtendedValue arraySectionElementToExtendedValue(
814 fir::FirOpBuilder &builder, mlir::Location loc,
815 const fir::ExtendedValue &array, mlir::Value element, mlir::Value slice);
816
819void genScalarAssignment(fir::FirOpBuilder &builder, mlir::Location loc,
820 const fir::ExtendedValue &lhs,
821 const fir::ExtendedValue &rhs,
822 bool needFinalization = false,
823 bool isTemporaryLHS = false);
824
828void genRecordAssignment(fir::FirOpBuilder &builder, mlir::Location loc,
829 const fir::ExtendedValue &lhs,
830 const fir::ExtendedValue &rhs,
831 bool needFinalization = false,
832 bool isTemporaryLHS = false);
833
837mlir::TupleType getRaggedArrayHeaderType(fir::FirOpBuilder &builder);
838
843mlir::Value genLenOfCharacter(fir::FirOpBuilder &builder, mlir::Location loc,
844 fir::ArrayLoadOp arrLoad,
845 llvm::ArrayRef<mlir::Value> path,
846 llvm::ArrayRef<mlir::Value> substring);
847mlir::Value genLenOfCharacter(fir::FirOpBuilder &builder, mlir::Location loc,
848 fir::SequenceType seqTy, mlir::Value memref,
849 llvm::ArrayRef<mlir::Value> typeParams,
850 llvm::ArrayRef<mlir::Value> path,
851 llvm::ArrayRef<mlir::Value> substring);
852
855mlir::Value createZeroValue(fir::FirOpBuilder &builder, mlir::Location loc,
856 mlir::Type type);
857
859std::optional<std::int64_t> getExtentFromTriplet(mlir::Value lb, mlir::Value ub,
860 mlir::Value stride);
861
864mlir::Value computeExtent(fir::FirOpBuilder &builder, mlir::Location loc,
865 mlir::Value lb, mlir::Value ub);
866mlir::Value computeExtent(fir::FirOpBuilder &builder, mlir::Location loc,
867 mlir::Value lb, mlir::Value ub, mlir::Value zero,
868 mlir::Value one);
869
871mlir::Value genMaxWithZero(fir::FirOpBuilder &builder, mlir::Location loc,
872 mlir::Value value);
873mlir::Value genMaxWithZero(fir::FirOpBuilder &builder, mlir::Location loc,
874 mlir::Value value, mlir::Value zero);
875
879mlir::Value genCPtrOrCFunptrAddr(fir::FirOpBuilder &builder, mlir::Location loc,
880 mlir::Value cPtr, mlir::Type ty);
881
884mlir::Value genCDevPtrAddr(fir::FirOpBuilder &builder, mlir::Location loc,
885 mlir::Value cDevPtr, mlir::Type ty);
886
888mlir::Value genCPtrOrCFunptrValue(fir::FirOpBuilder &builder,
889 mlir::Location loc, mlir::Value cPtr);
890
893fir::BoxValue createBoxValue(fir::FirOpBuilder &builder, mlir::Location loc,
894 const fir::ExtendedValue &exv);
895
897mlir::Value createNullBoxProc(fir::FirOpBuilder &builder, mlir::Location loc,
898 mlir::Type boxType);
899
902mlir::Value createConvert(mlir::OpBuilder &, mlir::Location, mlir::Type,
903 mlir::Value);
904
906void setInternalLinkage(mlir::func::FuncOp);
907
908llvm::SmallVector<mlir::Value>
909elideExtentsAlreadyInType(mlir::Type type, mlir::ValueRange shape);
910
911llvm::SmallVector<mlir::Value>
912elideLengthsAlreadyInType(mlir::Type type, mlir::ValueRange lenParams);
913
915uint64_t getAllocaAddressSpace(const mlir::DataLayout *dataLayout);
916
923llvm::SmallVector<mlir::Value> deduceOptimalExtents(mlir::ValueRange extents1,
924 mlir::ValueRange extents2);
925
926uint64_t getGlobalAddressSpace(mlir::DataLayout *dataLayout);
927
928uint64_t getProgramAddressSpace(mlir::DataLayout *dataLayout);
929
940llvm::SmallVector<mlir::Value> updateRuntimeExtentsForEmptyArrays(
941 fir::FirOpBuilder &builder, mlir::Location loc, mlir::ValueRange extents);
942
947void genDimInfoFromBox(fir::FirOpBuilder &builder, mlir::Location loc,
948 mlir::Value box,
949 llvm::SmallVectorImpl<mlir::Value> *lbounds,
950 llvm::SmallVectorImpl<mlir::Value> *extents,
951 llvm::SmallVectorImpl<mlir::Value> *strides);
952
956mlir::Value genLifetimeStart(mlir::OpBuilder &builder, mlir::Location loc,
957 fir::AllocaOp alloc, const mlir::DataLayout *dl);
958
961void genLifetimeEnd(mlir::OpBuilder &builder, mlir::Location loc,
962 mlir::Value mem);
963
969mlir::Value getDescriptorWithNewBaseAddress(fir::FirOpBuilder &builder,
970 mlir::Location loc, mlir::Value box,
971 mlir::Value newAddr);
972
973} // namespace fir::factory
974
975#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:504
mlir::Operation::result_range getResults()
End the IfOp and return the results if any.
Definition FIRBuilder.h:524
Definition FIRBuilder.h:55
IfBuilder genIfThenElse(mlir::Location loc, mlir::Value cdt)
Definition FIRBuilder.h:553
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:538
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:398
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:546
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:622
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:583
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:672
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:458
void createStoreWithConvert(mlir::Location loc, mlir::Value val, mlir::Value addr)
Definition FIRBuilder.cpp:616
void setIntegerOverflowFlags(mlir::arith::IntegerOverflowFlags flags)
Definition FIRBuilder.h:611
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:635
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:389
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:598
mlir::Value createUnsigned(mlir::Location loc, mlir::Type resultType, mlir::Value left, mlir::Value right)
Definition FIRBuilder.h:649
bool getComplexDivisionToRuntimeFlag() const
Get current ComplexDivisionToRuntimeFlag value.
Definition FIRBuilder.h:627
mlir::Value createBool(mlir::Location loc, bool b)
Create constant i1 with value 1. if b is true or 0. otherwise.
Definition FIRBuilder.h:492
mlir::arith::IntegerOverflowFlags getIntegerOverflowFlags() const
Get current IntegerOverflowFlags value.
Definition FIRBuilder.h:616
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:592
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:437
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 getDescriptorWithNewBaseAddress(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value box, mlir::Value newAddr)
Definition FIRBuilder.cpp:1978
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