<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/flang/lib/Optimizer/CodeGen/Target.cpp, branch users/meinersbur/flang_runtime_split-headers</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[flang] AArch64 ABI for BIND(C) VALUE parameters (#118305)</title>
<updated>2024-12-18T07:43:22+00:00</updated>
<author>
<name>David Truby</name>
<email>david.truby@arm.com</email>
</author>
<published>2024-12-18T07:43:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=44aa476aa1468adbbbca79cc77cfb5905f5fd3d6'/>
<id>44aa476aa1468adbbbca79cc77cfb5905f5fd3d6</id>
<content type='text'>
This patch adds handling for derived type VALUE parameters in BIND(C)
functions for AArch64.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds handling for derived type VALUE parameters in BIND(C)
functions for AArch64.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][fir] fix ABI bug 116844 (#118121)</title>
<updated>2024-12-02T13:45:14+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2024-12-02T13:45:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cbb49d4be676a251ca140db92aa2788dd5514569'/>
<id>cbb49d4be676a251ca140db92aa2788dd5514569</id>
<content type='text'>
Fix issue #116844.

The issue came from a look-up on the func.func for the sret attribute
when lowering fir.call with character arguments. This was broken because
the func.func may or may not have been rewritten when dealing with the
fir.call, but the lookup assumed it had not been rewritten yet. If the
func.func was rewritten and the result moved to a sret argument, the
call was lowered as if the character was meant to be the result, leading
to bad call code and an assert.

It turns out that the whole logic is actually useless since fir.boxchar
are never lowered as sret arguments, instead, lowering directly breaks
the character result into the first two `fir.ref&lt;&gt;, i64` arguments. So,
the sret case was actually never used, except in this bug.

Hence, instead of fixing the logic (probably by looking for argument
attributes on the call itself), just remove this logic that brings
unnecessary complexity.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix issue #116844.

The issue came from a look-up on the func.func for the sret attribute
when lowering fir.call with character arguments. This was broken because
the func.func may or may not have been rewritten when dealing with the
fir.call, but the lookup assumed it had not been rewritten yet. If the
func.func was rewritten and the result moved to a sret argument, the
call was lowered as if the character was meant to be the result, leading
to bad call code and an assert.

It turns out that the whole logic is actually useless since fir.boxchar
are never lowered as sret arguments, instead, lowering directly breaks
the character result into the first two `fir.ref&lt;&gt;, i64` arguments. So,
the sret case was actually never used, except in this bug.

Hence, instead of fixing the logic (probably by looking for argument
attributes on the call itself), just remove this logic that brings
unnecessary complexity.</pre>
</div>
</content>
</entry>
<entry>
<title>[Flang] LoongArch64 support for BIND(C) derived types in mabi=lp64d. (#117108)</title>
<updated>2024-11-29T03:50:28+00:00</updated>
<author>
<name>Zhaoxin Yang</name>
<email>yangzhaoxin@loongson.cn</email>
</author>
<published>2024-11-29T03:50:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=dab9fa2d7f3b3092d4ab0c815868ec68a968a31a'/>
<id>dab9fa2d7f3b3092d4ab0c815868ec68a968a31a</id>
<content type='text'>
This patch:
- Supports both the passing and returning of BIND(C) type parameters.
- Adds `mabi` check for LoongArch64. Currently, flang only supports
`mabi=` option
set to `lp64d` in LoongArch64, other ABIs will report an error and may
be supported
  in the future.

Reference ABI:

https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#subroutine-calling-sequence</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch:
- Supports both the passing and returning of BIND(C) type parameters.
- Adds `mabi` check for LoongArch64. Currently, flang only supports
`mabi=` option
set to `lp64d` in LoongArch64, other ABIs will report an error and may
be supported
  in the future.

Reference ABI:

https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#subroutine-calling-sequence</pre>
</div>
</content>
</entry>
<entry>
<title>[flang] AArch64 support for BIND(C) derived return types (#114051)</title>
<updated>2024-11-25T14:36:53+00:00</updated>
<author>
<name>David Truby</name>
<email>david.truby@arm.com</email>
</author>
<published>2024-11-25T14:36:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2d62daab497bfe1991869dc090c7d20a71108360'/>
<id>2d62daab497bfe1991869dc090c7d20a71108360</id>
<content type='text'>
This patch adds support for BIND(C) derived types as return values
matching the AArch64 Procedure Call Standard for C.

Support for BIND(C) derived types as value parameters will be in a
separate patch.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds support for BIND(C) derived types as return values
matching the AArch64 Procedure Call Standard for C.

Support for BIND(C) derived types as value parameters will be in a
separate patch.</pre>
</div>
</content>
</entry>
<entry>
<title>[Flang][LoongArch] Add sign extension for i32 arguments and returns in function signatures. (#116146)</title>
<updated>2024-11-19T11:58:20+00:00</updated>
<author>
<name>Zhaoxin Yang</name>
<email>yangzhaoxin@loongson.cn</email>
</author>
<published>2024-11-19T11:58:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b24acc06e1d465b3e3e4e28515dd437f6a7454f2'/>
<id>b24acc06e1d465b3e3e4e28515dd437f6a7454f2</id>
<content type='text'>
In loongarch64 LP64D ABI, `unsigned 32-bit` types, such as unsigned int,
are stored in general-purpose registers as proper sign extensions of
their 32-bit values. Therefore, Flang also follows it if a function
needs to be interoperable with C.

Reference:

https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#Fundamental-types</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In loongarch64 LP64D ABI, `unsigned 32-bit` types, such as unsigned int,
are stored in general-purpose registers as proper sign extensions of
their 32-bit values. Therefore, Flang also follows it if a function
needs to be interoperable with C.

Reference:

https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc#Fundamental-types</pre>
</div>
</content>
</entry>
<entry>
<title>[Flang][LoongArch] Add support for complex16 params/returns. (#114732)</title>
<updated>2024-11-13T08:13:37+00:00</updated>
<author>
<name>Zhaoxin Yang</name>
<email>yangzhaoxin@loongson.cn</email>
</author>
<published>2024-11-13T08:13:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=20b442a25d86c35556cfc1bba4356f8ee75987bd'/>
<id>20b442a25d86c35556cfc1bba4356f8ee75987bd</id>
<content type='text'>
In LoongArch64, the passing and returning of type `complex16` is similar
to that of structure type like `struct {fp128, fp128}`, meaning they are
passed and returned by reference. This behavior is similar to clang, so
it can implement conveniently `iso_c_binding`.

Additionally, this patch fixes the failure in flang test
Integration/debug-complex-1.f90:
```
llvm-project/flang/lib/Optimizer/codeGen/Target.cpp:56:
not yet implemented: complex for this precision for return type</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In LoongArch64, the passing and returning of type `complex16` is similar
to that of structure type like `struct {fp128, fp128}`, meaning they are
passed and returned by reference. This behavior is similar to clang, so
it can implement conveniently `iso_c_binding`.

Additionally, this patch fixes the failure in flang test
Integration/debug-complex-1.f90:
```
llvm-project/flang/lib/Optimizer/codeGen/Target.cpp:56:
not yet implemented: complex for this precision for return type</pre>
</div>
</content>
</entry>
<entry>
<title>[flang] correctly deal with bind(c) derived type result ABI (#111969)</title>
<updated>2024-10-14T07:35:29+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2024-10-14T07:35:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=367c3c968eb8f29b55fb8019b2464c7ff6307ca8'/>
<id>367c3c968eb8f29b55fb8019b2464c7ff6307ca8</id>
<content type='text'>
Derived type results of BIND(C) function should be returned according
the the C ABI for returning the related C struct type.

This currently did not happen since the abstract-result pass was forcing
the Fortran ABI for all derived type results.
use the bind_c attribute that was added on call/func/dispatch in FIR to
prevent such rewrite in the abstract result pass, and update the
target-rewrite pass to deal with the struct return ABI.

So far, the target specific part of the target-rewrite is only
implemented for X86-64 according to the "System V Application Binary
Interface AMD64 v1", the other targets will hit a TODO, just like for
BIND(C), VALUE derived type arguments.

This intends to deal with #102113.

This is a re-land of #111678 with an extra commit to keep rewriting `type(c_ptr)`
results to `!fir.ref&lt;none&gt;` in the abstract result pass regardless of the ABIs.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Derived type results of BIND(C) function should be returned according
the the C ABI for returning the related C struct type.

This currently did not happen since the abstract-result pass was forcing
the Fortran ABI for all derived type results.
use the bind_c attribute that was added on call/func/dispatch in FIR to
prevent such rewrite in the abstract result pass, and update the
target-rewrite pass to deal with the struct return ABI.

So far, the target specific part of the target-rewrite is only
implemented for X86-64 according to the "System V Application Binary
Interface AMD64 v1", the other targets will hit a TODO, just like for
BIND(C), VALUE derived type arguments.

This intends to deal with #102113.

This is a re-land of #111678 with an extra commit to keep rewriting `type(c_ptr)`
results to `!fir.ref&lt;none&gt;` in the abstract result pass regardless of the ABIs.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[flang] correctly deal with bind(c) derived type result ABI" (#111858)</title>
<updated>2024-10-10T15:25:57+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2024-10-10T15:25:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4ddc756bccb34f3d07e30c9ca96bba32cb0cf4f9'/>
<id>4ddc756bccb34f3d07e30c9ca96bba32cb0cf4f9</id>
<content type='text'>
Reverts llvm/llvm-project#111678

Causes ARM failure in test suite. TYPE(C_PTR) result should not regress
even if struct ABI no implemented for the target.
https://lab.llvm.org/buildbot/#/builders/143/builds/2731
I need to revisit this.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#111678

Causes ARM failure in test suite. TYPE(C_PTR) result should not regress
even if struct ABI no implemented for the target.
https://lab.llvm.org/buildbot/#/builders/143/builds/2731
I need to revisit this.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang] correctly deal with bind(c) derived type result ABI (#111678)</title>
<updated>2024-10-10T13:37:19+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2024-10-10T13:37:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=480e7f0667794822f7f3a065bed73d9a2ecc2d58'/>
<id>480e7f0667794822f7f3a065bed73d9a2ecc2d58</id>
<content type='text'>
Derived type results of BIND(C) function should be returned according
the the C ABI for returning the related C struct type.

This currently did not happen since the abstract-result pass was forcing
the Fortran ABI for all derived type results.
use the bind_c attribute that was added on call/func/dispatch in FIR to
prevent such rewrite in the abstract result pass, and update the
target-rewrite pass to deal with the struct return ABI.

So far, the target specific part of the target-rewrite is only
implemented for X86-64 according to the "System V Application Binary
Interface AMD64 v1", the other targets will hit a TODO, just like for
BIND(C), VALUE derived type arguments.

This intends to deal with
https://github.com/llvm/llvm-project/issues/102113.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Derived type results of BIND(C) function should be returned according
the the C ABI for returning the related C struct type.

This currently did not happen since the abstract-result pass was forcing
the Fortran ABI for all derived type results.
use the bind_c attribute that was added on call/func/dispatch in FIR to
prevent such rewrite in the abstract result pass, and update the
target-rewrite pass to deal with the struct return ABI.

So far, the target specific part of the target-rewrite is only
implemented for X86-64 according to the "System V Application Binary
Interface AMD64 v1", the other targets will hit a TODO, just like for
BIND(C), VALUE derived type arguments.

This intends to deal with
https://github.com/llvm/llvm-project/issues/102113.</pre>
</div>
</content>
</entry>
<entry>
<title>[flang][FIR] remove fir.complex type and its fir.real element type (#111025)</title>
<updated>2024-10-04T07:57:03+00:00</updated>
<author>
<name>jeanPerier</name>
<email>jperier@nvidia.com</email>
</author>
<published>2024-10-04T07:57:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1753de2d9564682cd9034aae50e81691bfd168ec'/>
<id>1753de2d9564682cd9034aae50e81691bfd168ec</id>
<content type='text'>
Final patch of
https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292

Since fir.real was only still used as fir.complex element type, this
patch removes it at the same time.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Final patch of
https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292

Since fir.real was only still used as fir.complex element type, this
patch removes it at the same time.</pre>
</div>
</content>
</entry>
</feed>
