Skip to content

Re-add rustc_codegen_ssa::builder::array_alloca #104022

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

Ayush1325
Copy link
Contributor

This function was removed in the #102551
I need this function in #100316 for the custom entry function for UEFI.

Signed-off-by: Ayush Singh ayushsingh1325@gmail.com

@rustbot
Copy link
Collaborator

rustbot commented Nov 5, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 5, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 5, 2022

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

This function was removed in the rust-lang#102551
I need this function in rust-lang#100316
for the custom entry function for UEFI.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
@nikic
Copy link
Contributor

nikic commented Nov 5, 2022

From a brief glance to #100316, this looks unnecessary. Array allocas are non-canonical and only needed if the alloca is dynamically sized, which does not appear to be the case here. You can create a standard [2 x ptr] alloca.

@Ayush1325
Copy link
Contributor Author

From a brief glance to #100316, this looks unnecessary. Array allocas are non-canonical and only needed if the alloca is dynamically sized, which does not appear to be the case here. You can create a standard [2 x ptr] alloca.

Thanks. When you mean standard [2 x ptr] alloca, do you mean something like this:

bx.alloca(cx.type_array(cx.type_i8p(), bx.const_int(cx.type_int(), 2)), Align::ONE);

@nikic
Copy link
Contributor

nikic commented Nov 5, 2022

It's probably just cx.type_array(cx.type_i8p(), 2), and that alignment looks somewhat dubious, but the general idea is right.

@Ayush1325 Ayush1325 closed this Nov 5, 2022
@Ayush1325 Ayush1325 deleted the array_alloca branch November 5, 2022 20:34
Ayush1325 added a commit to Ayush1325/rust that referenced this pull request Nov 6, 2022
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait.
This allows using normal alloca function to create arrays as suggested in
rust-lang#104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Nov 6, 2022
Add type_array to BaseTypeMethods

Moved `type_array` function to `rustc_codegen_ssa::BaseTypeMethods` trait. This allows using normal `alloca` function to create arrays as suggested in rust-lang#104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Nov 7, 2022
Add type_array to BaseTypeMethods

Moved `type_array` function to `rustc_codegen_ssa::BaseTypeMethods` trait. This allows using normal `alloca` function to create arrays as suggested in rust-lang#104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
antoyo pushed a commit to rust-lang/rustc_codegen_gcc that referenced this pull request Mar 1, 2023
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait.
This allows using normal alloca function to create arrays as suggested in
rust-lang/rust#104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
antoyo pushed a commit to rust-lang/rustc_codegen_gcc that referenced this pull request Jun 3, 2023
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait.
This allows using normal alloca function to create arrays as suggested in
rust-lang/rust#104022.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

4 participants