forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged main:b797a6aede3d into amd-gfx:a757a754c785
Local branch amd-gfx a757a75 Merged main:b0e28eb83271 into amd-gfx:41686a6f1391 Remote branch main b797a6a [flang] Lower special bind(c) cases without binding labels (llvm#65758)
- Loading branch information
Showing
69 changed files
with
533 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
! Test mangling with BIND(C) inherited from procedure interface. | ||
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s | ||
|
||
subroutine test() | ||
interface | ||
subroutine iface_notbindc() | ||
end subroutine | ||
subroutine iface_bindc() bind(c) | ||
end subroutine | ||
subroutine iface_explicit_name() bind(c, name="explicit_name") | ||
end subroutine | ||
subroutine iface_nobinding() bind(c, name="") | ||
end subroutine | ||
end interface | ||
|
||
procedure(iface_bindc) :: foo_iface_bindc | ||
procedure(iface_explicit_name) :: foo_iface_explicit_name | ||
procedure(iface_nobinding) :: foo_iface_nobinding | ||
|
||
procedure(iface_bindc), bind(c) :: extra_bindc_iface_bindc | ||
procedure(iface_explicit_name), bind(c) :: extra_bindc_iface_explicit_name | ||
procedure(iface_nobinding), bind(c) :: extra_bindc_iface_nobinding | ||
|
||
procedure(iface_bindc), bind(c, name="bar_iface_bindc_2") :: bar_iface_bindc | ||
procedure(iface_explicit_name), bind(c,name="bar_iface_explicit_name_2") :: bar_iface_explicit_name | ||
procedure(iface_nobinding), bind(c, name="bar_iface_nobinding_2") :: bar_iface_nobinding | ||
|
||
procedure(iface_bindc), bind(c, name="") :: nobinding_iface_bindc | ||
procedure(iface_explicit_name), bind(c, name="") :: nobinding_iface_explicit_name | ||
procedure(iface_nobinding), bind(c, name="") :: nobinding_iface_nobinding | ||
|
||
call iface_notbindc() | ||
call iface_bindc() | ||
call iface_explicit_name() | ||
call iface_nobinding() | ||
|
||
call foo_iface_bindc() | ||
call foo_iface_explicit_name() | ||
call foo_iface_nobinding() | ||
|
||
call extra_bindc_iface_bindc() | ||
call extra_bindc_iface_explicit_name() | ||
call extra_bindc_iface_nobinding() | ||
|
||
call bar_iface_bindc() | ||
call bar_iface_explicit_name() | ||
call bar_iface_nobinding() | ||
|
||
call nobinding_iface_bindc() | ||
call nobinding_iface_explicit_name() | ||
call nobinding_iface_nobinding() | ||
|
||
! CHECK: fir.call @_QPiface_notbindc() | ||
! CHECK: fir.call @iface_bindc() | ||
! CHECK: fir.call @explicit_name() | ||
! CHECK: fir.call @_QPiface_nobinding() | ||
! CHECK: fir.call @foo_iface_bindc() | ||
! CHECK: fir.call @foo_iface_explicit_name() | ||
! CHECK: fir.call @foo_iface_nobinding() | ||
! CHECK: fir.call @extra_bindc_iface_bindc() | ||
! CHECK: fir.call @extra_bindc_iface_explicit_name() | ||
! CHECK: fir.call @extra_bindc_iface_nobinding() | ||
! CHECK: fir.call @bar_iface_bindc_2() | ||
! CHECK: fir.call @bar_iface_explicit_name_2() | ||
! CHECK: fir.call @bar_iface_nobinding_2() | ||
! CHECK: fir.call @_QPnobinding_iface_bindc() | ||
! CHECK: fir.call @_QPnobinding_iface_explicit_name() | ||
! CHECK: fir.call @_QPnobinding_iface_nobinding() | ||
end subroutine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
! Test that lowering makes a difference between NAME="" and no NAME | ||
! in BIND(C). See Fortran 2018 standard 18.10.2 point 2. | ||
! BIND(C, NAME="") implies there is no binding label, meaning that | ||
! the Fortran mangled name has to be used. | ||
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s | ||
|
||
!CHECK: func.func @_QPfoo(%{{.*}}: !fir.ref<i16> | ||
subroutine foo(x) bind(c, name="") | ||
integer(2) :: x | ||
end subroutine | ||
|
||
!CHECK: func.func @bar(%{{.*}}: !fir.ref<i32> | ||
subroutine foo(x) bind(c, name="bar") | ||
integer(4) :: x | ||
end subroutine | ||
|
||
!CHECK: func.func @_QMinamodule1Pfoo(%{{.*}}: !fir.ref<i64> | ||
module inamodule1 | ||
contains | ||
subroutine foo(x) bind(c, name="") | ||
integer(8) :: x | ||
end subroutine | ||
end module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
! Test that internal procedure with BIND(C) do not have binding labels, | ||
! that is, that they are generated using usual flang mangling for non BIND(C) | ||
! internal procedures. | ||
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s | ||
|
||
!CHECK: func.func @_QFsub1Pfoo(%{{.*}}: i32 | ||
subroutine sub1() | ||
call foo(42) | ||
contains | ||
subroutine foo(i) bind(c) | ||
integer, value :: i | ||
print *, i | ||
end subroutine | ||
end subroutine | ||
|
||
!CHECK: func.func @_QFsub2Pfoo(%{{.*}}: i64 | ||
subroutine sub2() | ||
call foo(42_8) | ||
contains | ||
subroutine foo(i) bind(c) | ||
integer(8), value :: i | ||
print *, i | ||
end subroutine | ||
end subroutine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.