diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td --- a/flang/include/flang/Optimizer/Dialect/FIROps.td +++ b/flang/include/flang/Optimizer/Dialect/FIROps.td @@ -166,7 +166,7 @@ CArg<"mlir::ValueRange", "{}">:$shape, CArg<"llvm::ArrayRef", "{}">:$attributes)>]; - let verifier = [{ return ::verify(*this); }]; + let verifier = "return ::verify(*this);"; let extraClassDeclaration = [{ mlir::Type getAllocatedType(); @@ -224,7 +224,7 @@ CArg<"mlir::ValueRange", "{}">:$shape, CArg<"llvm::ArrayRef", "{}">:$attributes)>]; - let verifier = [{ return ::verify(*this); }]; + let verifier = "return ::verify(*this);"; let extraClassDeclaration = [{ mlir::Type getAllocatedType(); @@ -409,7 +409,7 @@ attr-dict `:` type(operands) }]; - let verifier = [{ return ::verify(*this); }]; + let verifier = "return ::verify(*this);"; } def fir_UndefOp : fir_OneResultOp<"undefined", [NoSideEffect]> { @@ -602,7 +602,8 @@ p << ' '; p.printOperand(getSelector()); p << " : " << getSelector().getType() << " ["; - auto cases = (*this)->getAttrOfType(getCasesAttr()).getValue(); + auto cases = + (*this)->getAttrOfType(getCasesAttr()).getValue(); auto count = getNumConditions(); for (decltype(count) i = 0; i != count; ++i) { if (i) @@ -616,8 +617,9 @@ printSuccessorAtIndex(p, i); } p << ']'; - p.printOptionalAttrDict((*this)->getAttrs(), {getCasesAttr(), getCompareOffsetAttr(), - getTargetOffsetAttr(), getOperandSegmentSizeAttr()}); + p.printOptionalAttrDict((*this)->getAttrs(), {getCasesAttr(), + getCompareOffsetAttr(), getTargetOffsetAttr(), + getOperandSegmentSizeAttr()}); }]; let verifier = [{ @@ -625,7 +627,8 @@ getSelector().getType().isa() || getSelector().getType().isa())) return emitOpError("must be an integer"); - auto cases = (*this)->getAttrOfType(getCasesAttr()).getValue(); + auto cases = + (*this)->getAttrOfType(getCasesAttr()).getValue(); auto count = getNumDest(); if (count == 0) return emitOpError("must have at least one successor"); @@ -822,9 +825,9 @@ let assemblyFormat = "$resval attr-dict `:` type($resval)"; } -//===------------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// // Operations on !fir.box type objects -//===------------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// def fir_EmboxOp : fir_Op<"embox", [NoSideEffect, AttrSizedOperandSegments]> { let summary = "boxes a given reference and (optional) dimension information"; @@ -887,26 +890,27 @@ } def fir_ReboxOp : fir_Op<"rebox", [NoSideEffect, AttrSizedOperandSegments]> { - let summary = "create a box given another box and (optional) dimension information"; + let summary = + "create a box given another box and (optional) dimension information"; let description = [{ - Create a new boxed reference value from another box. This is meant to be used - when the taking a reference to part of a boxed value, or to an entire boxed value with - new shape or type information. + Create a new boxed reference value from another box. This is meant to be + used when the taking a reference to part of a boxed value, or to an entire + boxed value with new shape or type information. The new extra information can be: - new shape information (new lower bounds, new rank, or new extents. New rank/extents can only be provided if the original fir.box is - contiguous in all dimension but maybe the first one). The shape + contiguous in all dimension but maybe the first row). The shape operand must be provided to set new shape information. - - new type (only for derived types). It is possible to set the dynamic type - of the new box to one of the parent types of the input box dynamic type. - Type parameters cannot be changed. This change is reflected in the requested - result type of the new box. + - new type (only for derived types). It is possible to set the dynamic + type of the new box to one of the parent types of the input box dynamic + type. Type parameters cannot be changed. This change is reflected in + the requested result type of the new box. - A slice argument can be provided to build a reference to part of a boxed value. - In this case, the shape operand must be absent or be a fir.shift that can be - used to provide a non default origin for the slice. + A slice argument can be provided to build a reference to part of a boxed + value. In this case, the shape operand must be absent or be a fir.shift + that can be used to provide a non default origin for the slice. The following example illustrates creating a fir.box for x(10:33:2) where x is described by a fir.box and has non default lower bounds, @@ -1338,6 +1342,16 @@ let summary = "Load an array as a value."; let description = [{ + This operation taken with array_merge_store captures Fortran's + copy-in/copy-out semantics. One way to think of this is that array_load + creates a snapshot copy of the entire array. This copy can then be used + as the "original value" of the array while the array's new value is + computed. The array_merge_store operation is the copy-out semantics, which + merge the updates with the original array value to produce the final array + result. This abstracts the copy operations as opposed to always creating + copies or requiring dependence analysis be performed on the syntax trees + and before lowering to the IR. + Load an entire array as a single SSA value. ```fortran @@ -1538,7 +1552,7 @@ `:` functional-type(operands, results) }]; - let verifier = [{ return ::verify(*this); }]; + let verifier = "return ::verify(*this);"; } def fir_ArrayMergeStoreOp : fir_Op<"array_merge_store", @@ -1985,7 +1999,7 @@ "llvm::ArrayRef":$vcoor)> ]; - let verifier = [{ return ::verify(*this); }]; + let verifier = "return ::verify(*this);"; } def fir_LenParamIndexOp : fir_OneResultOp<"len_param_index", [NoSideEffect]> { @@ -2464,22 +2478,18 @@ fir_Op, Results<(outs AnyType)> { - let parser = [{ - return impl::parseOneResultSameOperandTypeOp(parser, result); - }]; + let parser = "return impl::parseOneResultSameOperandTypeOp(parser, result);"; - let printer = [{ return printBinaryOp(this->getOperation(), p); }]; + let printer = "return printBinaryOp(this->getOperation(), p);"; } class fir_UnaryArithmeticOp traits = []> : fir_Op, Results<(outs AnyType)> { - let parser = [{ - return impl::parseOneResultSameOperandTypeOp(parser, result); - }]; + let parser = "return impl::parseOneResultSameOperandTypeOp(parser, result);"; - let printer = [{ return printUnaryOp(this->getOperation(), p); }]; + let printer = "return printUnaryOp(this->getOperation(), p);"; } def fir_ConstcOp : fir_Op<"constc", [NoSideEffect]> { @@ -2831,7 +2841,7 @@ A dispatch table is an untyped symbol that contains a list of associations between method identifiers and corresponding `FuncOp` symbols. - The ordering of associations in the map is determined by the front-end. + The ordering of associations in the map is determined by the front end. ```mlir fir.dispatch_table @_QDTMquuzTfoo {