diff --git a/flang/docs/FIRArrayOperations.md b/flang/docs/FIRArrayOperations.md --- a/flang/docs/FIRArrayOperations.md +++ b/flang/docs/FIRArrayOperations.md @@ -83,9 +83,9 @@ reference, and its semantics guarantee immutability. ```mlir -%s = fir.shape_shift %lb1, %ex1, %lb2, %ex2 : (index, index, index, index) -> !fir.shape<2> +%s = fir.shape_shift %lb1, %ex1, %lb2, %ex2 : (index, index, index, index) -> !fir.shapeshift<2> // load the entire array 'a' -%v = fir.array_load %a(%s) : (!fir.ref>, !fir.shape<2>) -> !fir.array +%v = fir.array_load %a(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array // a fir.store here into array %a does not change %v ``` 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 @@ -105,7 +105,7 @@ constant `1`, then pass that by reference to foo. Likewise for the second and third calls to foo, each stack slot being initialized accordingly. It is also a conforming implementation to reuse the same stack slot for all three - calls, just initializing each in turn. This is possible as the lifetime of + calls, just initializing each in turn. This is possible as the lifetime of the copy of each constant need not exceed that of the CALL statement. Indeed, a user would likely expect a good Fortran compiler to perform such an optimization. @@ -343,7 +343,6 @@ The above fir.save_result allows saving a fir.array function result into a buffer to later access its 5th element. - }]; let arguments = (ins ArrayOrBoxOrRecord:$value, @@ -410,7 +409,7 @@ %a = fir.undefined !fir.array<10 x !fir.type> ``` - The example creates an array shaped ssa value. The array is rank 1, extent + The example creates an array shaped ssa-value. The array is rank 1, extent 10, and each element has type `!fir.type`. }]; @@ -734,7 +733,7 @@ let description = [{ Create a boxed reference value. In Fortran, the implementation can require extra information about an entity, such as its type, rank, etc. This - auxilliary information is packaged and abstracted as a value with box type + auxiliary information is packaged and abstracted as a value with box type by the calling routine. (In Fortran, these are called descriptors.) ```mlir @@ -820,7 +819,6 @@ %3 = fir.shape %c3, %c4 : (index, index) -> !fir.shape<2> %4 = fir.rebox %2(%3) : (!fir.box>, !fir.shape<2>) -> !fir.box> ``` - }]; let arguments = (ins @@ -1029,8 +1027,8 @@ not be known until runtime. ```mlir - %53 = fir.box_elesize %40 : (!fir.box, i32) -> i32 // size=4 - %54 = fir.box_elesize %40 : (!fir.box>, i32) -> i32 + %53 = fir.box_elesize %40 : (!fir.box) -> i32 // size=4 + %54 = fir.box_elesize %40 : (!fir.box>) -> i32 ``` In the above example, `%53` may box an array of REAL values while `%54` @@ -1234,14 +1232,14 @@ One can use `fir.array_load` to produce an ssa-value that captures an immutable value of the entire array `a`, as in the Fortran array expression shown above. Subsequent changes to the memory containing the array do not - alter its composite value. This operation let's one load an array as a + alter its composite value. This operation lets one load an array as a value while applying a runtime shape, shift, or slice to the memory reference, and its semantics guarantee immutability. ```mlir - %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shape<2> + %s = fir.shape_shift %o, %n, %p, %m : (index, index, index, index) -> !fir.shapeshift<2> // load the entire array 'a' - %v = fir.array_load %a(%s) : (!fir.ref>, !fir.shape<2>) -> !fir.array + %v = fir.array_load %a(%s) : (!fir.ref>, !fir.shapeshift<2>) -> !fir.array // a fir.store here into array %a does not change %v ``` }]; @@ -1389,16 +1387,13 @@ ```mlir %s = fir.shape %n : (index) -> !fir.shape<1> // Load the entire array 'a'. - %v = fir.array_load %a(%s) : (!fir.ref>, !fir.shape<1>) - -> !fir.array + %v = fir.array_load %a(%s) : (!fir.ref>, !fir.shape<1>) -> !fir.array // Update the value of one of the array value's elements with a user // defined assignment from %rhs. %new = fir.do_loop %i = ... (%inner = %v) { %rhs = ... - %addr, %r = fir.array_modify %inner, %i, %j : (!fir.array, - index) -> fir.ref, !fir.array - fir.call @user_def_assign(%addr, %rhs) (fir.ref, - fir.ref>) -> () + %addr, %r = fir.array_modify %inner, %i : (!fir.array, index) -> (fir.ref, !fir.array) + fir.call @user_def_assign(%addr, %rhs) (fir.ref, fir.ref>) -> () fir.result %r : !fir.ref> } fir.array_merge_store %v, %new to %a : !fir.ref> @@ -1466,7 +1461,7 @@ between. TODO: The above restriction is not enforced. The design of the operation - might need to be revisited to avoid such restructions. + might need to be revisited to avoid such restrictions. More information about `array_access` and other array operations can be found in flang/docs/FIRArrayOperations.md. @@ -1895,7 +1890,7 @@ let description = [{ Insert a value into an entity with a type composed of tuples, arrays, - and/or derived types. Returns a new ssa value with the same type as the + and/or derived types. Returns a new ssa-value with the same type as the original entity. Cannot be used on values of `!fir.box` type. It can also be used to set complex parts and elements of a character string. @@ -1928,7 +1923,7 @@ let description = [{ Insert copies of a value into an entity with an array type of constant shape and size. - Returns a new ssa value with the same type as the original entity. + Returns a new ssa-value with the same type as the original entity. The values are inserted at a contiguous range of indices in Fortran row-to-column element order as specified by lower and upper bound coordinates. @@ -1958,7 +1953,7 @@ "create a field index value from a LEN type parameter identifier"; let description = [{ - Generate a LEN parameter (offset) value from an LEN parameter identifier. + Generate a LEN parameter (offset) value from a LEN parameter identifier. The type of a LEN parameter value is `!fir.len` and these values can be used with the `fir.coordinate_of` instructions to compute (abstract) addresses of LEN parameters. @@ -2517,7 +2512,7 @@ let description = [{ Convert a symbol (a function or global reference) to an SSA-value to be - used in other Operations. References to Fortran symbols are distinguished + used in other operations. References to Fortran symbols are distinguished via this operation from other arbitrary constant values. ```mlir @@ -2536,7 +2531,7 @@ let summary = "encapsulates all Fortran entity type conversions"; let description = [{ - Generalized type conversion. Convert the ssa value from type T to type U. + Generalized type conversion. Convert the ssa-value from type T to type U. Not all pairs of types have conversions. When types T and U are the same type, this instruction is a NOP and may be folded away. This also supports integer to pointer conversion and pointer to integer conversion.