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

Venkataramanan Kumar via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 25 05:43:30 PDT 2018


 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/0946e0f5/attachment.html>


More information about the llvm-dev mailing list