Skip to content

Create Rust::GGC::Ident#3855

Merged
P-E-P merged 1 commit into
Rust-GCC:masterfrom
powerboat9:intern
Jun 25, 2025
Merged

Create Rust::GGC::Ident#3855
P-E-P merged 1 commit into
Rust-GCC:masterfrom
powerboat9:intern

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

This should make it easier for us to hand identifiers off to the back end

Comment thread gcc/rust/util/rust-ggc.h
Comment thread gcc/rust/Make-lang.in
This should make it easier for us to hand identifiers off to the
back end.

gcc/rust/ChangeLog:

	* Make-lang.in (GRS_OBJS): Add rust-ggc.o.
	* backend/rust-compile-base.cc
	(HIRCompileBase::compile_function): Adjust call to
	Backend::function.
	(HIRCompileBase::compile_constant_item): Likewise and adjust
	initialization of Backend::typed_identifier.
	* backend/rust-compile-expr.cc (CompileExpr::visit): Adjust call
	to Backend::label.
	* backend/rust-compile-type.cc (TyTyResolveCompile::visit):
	Adjust initialization of Backend::typed_identifier.
	* rust-backend.h: Add includes.
	(Backend::GGC::Ident): Use Rust::GGC::Ident.
	(struct typed_identifier): Store name as a GGC::Ident rather
	than a std::string and adjust constructors.
	(named_type): Take GGC::Ident/tl::optional<GGC::Ident> rather
	than std::string.
	(global_variable): Likewise.
	(local_variable): Likewise.
	(parameter_variable): Likewise.
	(static_chain_variable): Likewise.
	(label): Likewise.
	(function): Likewise.
	* rust-gcc.cc (named_type): Likewise.
	(global_variable): Likewise.
	(local_variable): Likewise.
	(parameter_variable): Likewise.
	(static_chain_variable): Likewise.
	(label): Likewise.
	(function): Likewise.
	(function_defer_statement): Adjust call to Backend::label.
	(get_identifier_from_string): Remove function.
	(fill_in_fields): Handle adjustments to typed_identifier.
	* util/rust-ggc.cc: New file.
	* util/rust-ggc.h: New file.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

@philberty philberty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is actually quite useful the get_identifier_with_length is a pain to call sometimes iirc i ended up making some stupid wrapper in rust-gcc.cc at one point can you double check in there? Maybe see about removing it if it is there.

@powerboat9

Copy link
Copy Markdown
Collaborator Author

This is actually quite useful the get_identifier_with_length is a pain to call sometimes iirc i ended up making some stupid wrapper in rust-gcc.cc at one point can you double check in there? Maybe see about removing it if it is there.

I removed get_identifier_from_string, and I think there was another one, but that one wasn't static and was used elsewhere

@P-E-P P-E-P added this pull request to the merge queue Jun 25, 2025
Merged via the queue into Rust-GCC:master with commit be2afed Jun 25, 2025
13 checks passed
@powerboat9 powerboat9 deleted the intern branch June 25, 2025 21:14
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.

3 participants