[flang-dev] Fwd: Internal linkage for private subroutines

Stephen Scalpone via flang-dev flang-dev at lists.llvm.org
Wed Dec 4 17:40:54 PST 2019


This looks promising:

ll_write.cpp:  fprintf(out, "define %s %s %s ", ll_get_linkage_string(function->linkage),

From: flang-dev <flang-dev-bounces at lists.llvm.org> on behalf of Alexey Zhikhartsev via flang-dev <flang-dev at lists.llvm.org>
Reply-To: Alexey Zhikhartsev <alexey.zhikhar at gmail.com>
Date: Wednesday, December 4, 2019 at 4:49 PM
To: "flang-dev at lists.llvm.org" <flang-dev at lists.llvm.org>
Subject: [flang-dev] Fwd: Internal linkage for private subroutines

Hi all,

In the code below, every function in module m is private by default, and only bar() is declared public:

module m

implicit none
private
public :: bar
integer :: arr1(42)

contains

  subroutine foo(a)
  integer :: a

  arr1(1) = 2

  end subroutine foo

  subroutine bar(a)
  integer :: a

  call foo(a)

  end subroutine bar
end module m

However, in the resulting LLVM IR, no function is declared with an attribute “internal”:

define void @m_foo_(i64* %a) !dbg !5 {
L.entry:
  br label %L.LB2_313

L.LB2_313:                                        ; preds = %L.entry
  %0 = bitcast %struct_m_4_* @_m_4_ to i32*, !dbg !10
  store i32 2, i32* %0, align 4, !dbg !10, !tbaa !12
  ret void, !dbg !16
}

define void @m_bar_(i64* %a) !dbg !17 {
L.entry:
  br label %L.LB3_314

L.LB3_314:                                        ; preds = %L.entry
  call void @m_foo_(i64* %a), !dbg !18
  ret void, !dbg !20
}

Am I missing something? I tried to find where it might be implemented in flang by grepping the flang codebase for SC_STATIC but there’s just too many places. Any pointers would be much appreciated.

Alexey


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20191205/c51781b5/attachment-0001.html>


More information about the flang-dev mailing list