Help on understanding assume shape array processing and array descriptors in LLVM IR

Hi,

I am trying to understand how assume shaped arrays are received and
processed in LLVM IR. I am using “flang” for my front end.

There seems to be an array descriptor received as implicit argument
for every assume shaped array.

For my test routine:

—snip–
SUBROUTINE test(a,b,Li,Lj,Istr,Iend,Jstr,Jend)
INTEGER, INTENT(IN) :: Li,Lj
INTEGER, INTENT(IN) :: Istr, Iend, Jstr,Jend
INTEGER :: i, j
REAL8, INTENT(INOUT) :: a(Li:,Lj:)
REAL
8, INTENT(IN) :: b(Li:,Lj:)
–snip–

I got the below LLVM IR, the parameters received.

–snip–
; Function Attrs: norecurse nounwind
define void @test_(i64* noalias nocapture %a, i64* noalias nocapture
readonly %b, i64* noalias nocapture readonly %li, i64* noalias
nocapture readonly %lj, i64* noalias nocapture readonly %istr, i64*
noalias nocapture readonly %iend, i64* noalias nocapture readonly
%jstr, i64* noalias nocapture readonly %jend, i64* noalias nocapture
readonly %“a$sd”, i64* noalias nocapture readonly %“b$sd”)
local_unnamed_addr #0 !dbg !5 {
–snip–

Here “a$sd” and “b$sd” looks like array descriptors and received as
implicit parameters.

I found this article which explains how gfortran implements:
http://thinkingeek.com/2017/01/14/gfortran-array-descriptor/

Can Someone throw some light on LLVM’s array descriptors and how they
are processed ?

regards,
Venkat.

Hello,

I believe these descriptors are specific to flang, not to LLVM. You should probably ask your question on flang-dev list.

Thank you,

–Eugene

Hi Eugene,