Skip to content

Use struct types during codegen in less places #105252

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

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Dec 4, 2022

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.

@bjorn3 bjorn3 added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-cranelift Things relevant to the [future] cranelift backend labels Dec 4, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2022

r? @fee1-dead

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2022
@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2022

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

@fee1-dead
Copy link
Member

r? compiler

@rustbot rustbot assigned lcnr and unassigned fee1-dead Dec 4, 2022
@lcnr
Copy link
Contributor

lcnr commented Dec 4, 2022

r? compiler

@rustbot rustbot assigned nagisa and unassigned lcnr Dec 4, 2022
Copy link
Member

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

r=me but see the comment

fn cleanup_landing_pad(&mut self, ty: Self::Type, pers_fn: Self::Value) -> Self::Value;
fn resume(&mut self, exn: Self::Value);
fn cleanup_landing_pad(&mut self, pers_fn: Self::Value) -> (Self::Value, Self::Value);
fn resume(&mut self, exn0: Self::Value, exn1: Self::Value);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a more descriptive name we could give for these fields? Ultimately these values are produced by the personality function and have specific meaning, don’t they?

Copy link
Member Author

Choose a reason for hiding this comment

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

They have a specific meaning (the exception object as first value and 0 as second value). But as far as the codegen backend is concerned they are just opaque values to pass back to resume. I'm not sure why the second value even exists at all. It could have been an LLVM limitation or because we used to reuse GCC's C++ personality function which uses both.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, so we could call it something like exception_obj and dummy, but doesn’t matter much either way.

@nagisa
Copy link
Member

nagisa commented Dec 11, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 11, 2022

📌 Commit 262ace5 has been approved by nagisa

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 11, 2022
@bors
Copy link
Collaborator

bors commented Dec 12, 2022

⌛ Testing commit 262ace5 with merge 37d7de3...

@bors
Copy link
Collaborator

bors commented Dec 12, 2022

☀️ Test successful - checks-actions
Approved by: nagisa
Pushing 37d7de3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 12, 2022
@bors bors merged commit 37d7de3 into rust-lang:master Dec 12, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 12, 2022
@bors bors mentioned this pull request Dec 12, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (37d7de3): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.4% [2.4%, 2.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@bjorn3 bjorn3 deleted the codegen_less_pair_values branch December 12, 2022 17:10
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…agisa

Use struct types during codegen in less places

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
antoyo pushed a commit to antoyo/rust that referenced this pull request Jun 19, 2023
…agisa

Use struct types during codegen in less places

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants