[llvm-dev] Help on understanding assume shape array processing and array descriptors in LLVM IR

Epshteyn, Eugene via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 25 10:09:33 PDT 2018


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

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Venkataramanan Kumar via llvm-dev
Sent: Wednesday, April 25, 2018 8:44 AM
To: llvm-dev at lists.llvm.org
Subject: [llvm-dev] 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
     REAL*8, 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180425/e930f9a1/attachment.html>


More information about the llvm-dev mailing list