[flang][hlfir] add hlfir.get_extent
authorTom Eccles <tom.eccles@arm.com>
Wed, 12 Apr 2023 14:57:45 +0000 (14:57 +0000)
committerTom Eccles <tom.eccles@arm.com>
Mon, 17 Apr 2023 13:25:54 +0000 (13:25 +0000)
commit80e45a7947fa17a14db575a71aa178747de19b20
treeb2ac3fb4305293ca0b78c63d363d17ebab655d79
parent5c925079927766adf72116b508d061c4a5803b56
[flang][hlfir] add hlfir.get_extent

This operation fetches an extent value from a fir.shape. The operation
could just as easily live in the fir namespace, but is only needed for
hlfir lowering so I put it here.

This operation is required to allow one to defer getting the extents of a shape
generated by hlfir.get_shape until after that shape has been resolved
(after bufferization of the hlfir.expr).

This operation will be lowered to FIR as an arith.constant created using
the definition of the fir.shape argument.

Depends on: D146830

Differential Revision: https://reviews.llvm.org/D148220
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
flang/test/HLFIR/getextent.fir [new file with mode: 0644]
flang/test/HLFIR/invalid.fir