Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][ABI] Create target lowering library skeleton #643

Merged

Conversation

sitio-couto
Copy link
Collaborator

This patch adds a new TargetLowering library that intends to add supoort for lowering CIR code to target specific CIR code. It is largely based on the original codegen library used to lower AST nodes to ABI/Target -specific LLVM IR instructions. Because of this, each file has a comment specifying the original codegen file that inspired the new file. The idea is that anyone who wishes to expand this library can look at the original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details for a later stage in the pipeline. One reason for this is to keep the intermediate representation on a higher-level, which makes it easier to reason about and to perform optimizations. However, we still need to lower such representation to a target-specific format at some point. Some examples are ctor/dtors and calling conventions, which are not fully handled by CIRGen. The new library will be responsible for these lowerings.

Some files are empty but will eventually be used and a few getters and methods where added to avoid unused warnings. Missing features in this library are tracked in a dedicated MissingFeature.h header.

@bcardosolopes
Copy link
Member

The idea is that anyone who wishes to expand this library can look at the original codegen file to understand how to implement the new feature.

Nice :)

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for building something nice for callconv here!

Overall this feels a bit isolated with some duplication that we can already avoid, so comments are mostly on that direction. Like I mentioned in one of the comments, the fact that you can test the abi library on the side for some initial time should be orthogonal to unifying the implementation pieces.

Copy link
Collaborator Author

@sitio-couto sitio-couto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcardosolopes answered.

Copy link
Collaborator Author

@sitio-couto sitio-couto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcardosolopes applied.

This patch adds a new TargetLowering library that intends to add supoort
for lowering CIR code to target specific CIR code. It is largely based
on the original codegen library used to lower AST nodes to ABI/Target
-specific LLVM IR instructions. Because of this, each file has a comment
specifying the original codegen file that inspired the new file. The
idea is that anyone who wishes to expand this library can look at the
original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details
for a later stage in the pipeline. One reason for this is to keep the
intermediate representation on a higher-level, which makes it easier to
reason about and to perform optimizations. However, we still need to
lower such representation to a target-specific format at some point.
Some examples are ctor/dtors and calling conventions, which are not
fully handled by CIRGen. The new library will be responsible for these
lowerings.

Some files are empty but will eventually be used and a few getters and
methods where added to avoid unused warnings. Missing features in this
library are tracked in a dedicated MissingFeature.h header.
@sitio-couto sitio-couto force-pushed the vinicius/target-lowering-lib-skeleton branch from 03d72e0 to 620a03c Compare June 4, 2024 00:32
@sitio-couto
Copy link
Collaborator Author

@bcardosolopes applied.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there. I didn't see existing ABI lowering code getting included here, if the plan is for next PR to tackle that than it's fine, if you were planning for longer term it should be fix now. Let me know.

clang/include/clang/CIR/Common/ABIArgInfo.h Outdated Show resolved Hide resolved
clang/include/clang/CIR/Common/ABIArgInfo.h Outdated Show resolved Hide resolved
@sitio-couto
Copy link
Collaborator Author

@bcardosolopes applied.

This PR doesn't Implement ABI lowering, only the library structure. The following PRs will.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@sitio-couto sitio-couto merged commit 2cb424c into llvm:main Jun 5, 2024
6 checks passed
@sitio-couto sitio-couto deleted the vinicius/target-lowering-lib-skeleton branch June 5, 2024 23:21
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
This patch adds a new TargetLowering library that intends to add supoort
for lowering CIR code to target specific CIR code. It is largely based
on the original codegen library used to lower AST nodes to ABI/Target
-specific LLVM IR instructions. Because of this, each file has a comment
specifying the original codegen file that inspired the new file. The
idea is that anyone who wishes to expand this library can look at the
original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details
for a later stage in the pipeline. One reason for this is to keep the
intermediate representation on a higher-level, which makes it easier to
reason about and to perform optimizations. However, we still need to
lower such representation to a target-specific format at some point.
Some examples are ctor/dtors and calling conventions, which are not
fully handled by CIRGen. The new library will be responsible for these
lowerings.

Some files are empty but will eventually be used and a few getters and
methods where added to avoid unused warnings. Missing features in this
library are tracked in a dedicated MissingFeature.h header.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
This patch adds a new TargetLowering library that intends to add supoort
for lowering CIR code to target specific CIR code. It is largely based
on the original codegen library used to lower AST nodes to ABI/Target
-specific LLVM IR instructions. Because of this, each file has a comment
specifying the original codegen file that inspired the new file. The
idea is that anyone who wishes to expand this library can look at the
original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details
for a later stage in the pipeline. One reason for this is to keep the
intermediate representation on a higher-level, which makes it easier to
reason about and to perform optimizations. However, we still need to
lower such representation to a target-specific format at some point.
Some examples are ctor/dtors and calling conventions, which are not
fully handled by CIRGen. The new library will be responsible for these
lowerings.

Some files are empty but will eventually be used and a few getters and
methods where added to avoid unused warnings. Missing features in this
library are tracked in a dedicated MissingFeature.h header.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
This patch adds a new TargetLowering library that intends to add supoort
for lowering CIR code to target specific CIR code. It is largely based
on the original codegen library used to lower AST nodes to ABI/Target
-specific LLVM IR instructions. Because of this, each file has a comment
specifying the original codegen file that inspired the new file. The
idea is that anyone who wishes to expand this library can look at the
original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details
for a later stage in the pipeline. One reason for this is to keep the
intermediate representation on a higher-level, which makes it easier to
reason about and to perform optimizations. However, we still need to
lower such representation to a target-specific format at some point.
Some examples are ctor/dtors and calling conventions, which are not
fully handled by CIRGen. The new library will be responsible for these
lowerings.

Some files are empty but will eventually be used and a few getters and
methods where added to avoid unused warnings. Missing features in this
library are tracked in a dedicated MissingFeature.h header.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
This patch adds a new TargetLowering library that intends to add supoort
for lowering CIR code to target specific CIR code. It is largely based
on the original codegen library used to lower AST nodes to ABI/Target
-specific LLVM IR instructions. Because of this, each file has a comment
specifying the original codegen file that inspired the new file. The
idea is that anyone who wishes to expand this library can look at the
original codegen file to understand how to implement the new feature.

In some cases, CIRGen defers the handling of ABI/target-specific details
for a later stage in the pipeline. One reason for this is to keep the
intermediate representation on a higher-level, which makes it easier to
reason about and to perform optimizations. However, we still need to
lower such representation to a target-specific format at some point.
Some examples are ctor/dtors and calling conventions, which are not
fully handled by CIRGen. The new library will be responsible for these
lowerings.

Some files are empty but will eventually be used and a few getters and
methods where added to avoid unused warnings. Missing features in this
library are tracked in a dedicated MissingFeature.h header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants