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][NFC] Make createLowerModule public #734

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

seven-mile
Copy link
Collaborator

@seven-mile seven-mile commented Jul 12, 2024

Although currently LowerModule is not ready for formal usage, we need it for target-specific lowering to LLVM. This PR temporarily public the symbol createLowerModule to reuse the logic of preparing a LowerModule, making it easier for future refactor (making TargetLoweringInfo available for most stages in CIR Lowering).

@seven-mile seven-mile requested review from sitio-couto and removed request for bcardosolopes and lanza July 12, 2024 15:29
@@ -91,6 +91,8 @@ class LowerModule {
LogicalResult rewriteFunctionCall(CallOp callOp, FuncOp funcOp);
};

LowerModule createLowerModule(ModuleOp module, PatternRewriter &rewriter);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added it to this internal header. If we want to use it in, let's say, LowerToLLVM.cpp, we still have to write:

#include "../../Dialect/Transforms/TargetLowering/LowerModule.h"

But I'm fine with leaving the interim state somehow dirty. It also encourage the eager refactor.

Copy link
Member

Choose a reason for hiding this comment

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

That's the problem with technical debt, we have a FIXME on the other dirty inclusion and now it seems encouraging to use that hack elsewhere :)

I'm fine with this NFC change but be aware that I'm not gonna approve using #include "../../Dialect/Transforms/TargetLowering/LowerModule.h" over LowerToLLVM.cpp, so we might need other PRs to look into putting those things in a proper location - note that they don't necessarily need to be public, but we could use cmake to pass in proper include dirs, etc.

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.

LGTM but see inline comments for FYI on future requirements.

@@ -91,6 +91,8 @@ class LowerModule {
LogicalResult rewriteFunctionCall(CallOp callOp, FuncOp funcOp);
};

LowerModule createLowerModule(ModuleOp module, PatternRewriter &rewriter);
Copy link
Member

Choose a reason for hiding this comment

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

That's the problem with technical debt, we have a FIXME on the other dirty inclusion and now it seems encouraging to use that hack elsewhere :)

I'm fine with this NFC change but be aware that I'm not gonna approve using #include "../../Dialect/Transforms/TargetLowering/LowerModule.h" over LowerToLLVM.cpp, so we might need other PRs to look into putting those things in a proper location - note that they don't necessarily need to be public, but we could use cmake to pass in proper include dirs, etc.

@bcardosolopes bcardosolopes merged commit d6005d1 into llvm:main Jul 12, 2024
7 checks passed
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Although currently LowerModule is not ready for formal usage, we need it
for target-specific lowering to LLVM. This PR temporarily public the
symbol `createLowerModule` to reuse the logic of preparing a
`LowerModule`, making it easier for future refactor (making
`TargetLoweringInfo` available for most stages in CIR Lowering).
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Although currently LowerModule is not ready for formal usage, we need it
for target-specific lowering to LLVM. This PR temporarily public the
symbol `createLowerModule` to reuse the logic of preparing a
`LowerModule`, making it easier for future refactor (making
`TargetLoweringInfo` available for most stages in CIR Lowering).
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Although currently LowerModule is not ready for formal usage, we need it
for target-specific lowering to LLVM. This PR temporarily public the
symbol `createLowerModule` to reuse the logic of preparing a
`LowerModule`, making it easier for future refactor (making
`TargetLoweringInfo` available for most stages in CIR Lowering).
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Although currently LowerModule is not ready for formal usage, we need it
for target-specific lowering to LLVM. This PR temporarily public the
symbol `createLowerModule` to reuse the logic of preparing a
`LowerModule`, making it easier for future refactor (making
`TargetLoweringInfo` available for most stages in CIR Lowering).
lanza pushed a commit that referenced this pull request Nov 5, 2024
Although currently LowerModule is not ready for formal usage, we need it
for target-specific lowering to LLVM. This PR temporarily public the
symbol `createLowerModule` to reuse the logic of preparing a
`LowerModule`, making it easier for future refactor (making
`TargetLoweringInfo` available for most stages in CIR Lowering).
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