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

backend: (x86) lowering of func.func and func.ret to x86_func #3918

Merged
merged 7 commits into from
Feb 17, 2025

Conversation

qaco
Copy link
Collaborator

@qaco qaco commented Feb 15, 2025

No description provided.

@qaco qaco added transformations Changes or adds a transformatio backend Compiler backend in xDSL labels Feb 15, 2025
@qaco qaco self-assigned this Feb 15, 2025
Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.31%. Comparing base (887391b) to head (ee0c1b9).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3918      +/-   ##
==========================================
+ Coverage   91.29%   91.31%   +0.01%     
==========================================
  Files         466      467       +1     
  Lines       58012    58108      +96     
  Branches     5566     5579      +13     
==========================================
+ Hits        52962    53060      +98     
+ Misses       3622     3618       -4     
- Partials     1428     1430       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qaco qaco marked this pull request as draft February 15, 2025 23:56
@qaco qaco marked this pull request as ready for review February 16, 2025 01:57
first_block = op.body.blocks.first

if first_block is None:
raise ValueError("Cannot lower external functions (not implemented)")
Copy link
Member

Choose a reason for hiding this comment

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

Can you please change these to DiagnosticException, and add filecheck stubs to exercise them? Ideally we want 100% code coverage for lowerings like this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done !

Copy link
Collaborator

@compor compor left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments

mov_op = x86.RM_MovOp(
r1=get_reg_op.result,
r2=get_sp_op.result,
offset=8 * (i + 1),
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have a good way to represent x86 vs x86-64 (and probably we might never need this), but maybe make the offset set (8 bytes) a bit more pronounced in this pass? Maybe a global constant or similar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thx done !

@qaco qaco merged commit 38089d6 into xdslproject:main Feb 17, 2025
16 checks passed
@qaco qaco deleted the hugo/func-to-x86 branch February 17, 2025 13:05
Comment on lines +22 to +25
func.func @foo_int() -> (i32,i32) {
%a = "test.op"(): () -> i32
func.return %a,%a: i32,i32
}
Copy link
Member

Choose a reason for hiding this comment

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

no test here

class LowerReturnOp(RewritePattern):
@op_type_rewrite_pattern
def match_and_rewrite(self, op: func.ReturnOp, rewriter: PatternRewriter):
if len(op.arguments) == 0:
Copy link
Member

Choose a reason for hiding this comment

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

this should be if not op.arguments instead, getting the length is potentially O(n), whereas truthiness is constant time and cheap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Compiler backend in xDSL transformations Changes or adds a transformatio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants