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

Improve SemIR naming of import_refs #4769

Open
4 tasks
zygoloid opened this issue Jan 7, 2025 · 0 comments
Open
4 tasks

Improve SemIR naming of import_refs #4769

zygoloid opened this issue Jan 7, 2025 · 0 comments
Labels
good first issue Possibly a good first issue for newcomers toolchain

Comments

@zygoloid
Copy link
Contributor

zygoloid commented Jan 7, 2025

Currently import_refs have a non-descriptive name, containing only a content hash and disambiguator, such as %import_ref.a69 or %import_ref.f9d349.2. We should be able to do better.

Ideas:

  • Include the name of the package and library from which the entity was ultimately imported in the name. We may want to do some shortening here, for example we could take the component of the library name following the final /.
  • When the import_ref is loaded, look at its constant value and use that to form a name for the import_ref.
  • Use the instruction in the target IR to form a name.
  • Cache InstNamers for all IRs being processed by the toolchain invocation, and actually use the name of the instruction (including disambiguator) from the target IR, either in the name of the import_ref or at least in the right-hand side when printing formatted SemIR.
@zygoloid zygoloid added good first issue Possibly a good first issue for newcomers toolchain labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Possibly a good first issue for newcomers toolchain
Projects
None yet
Development

No branches or pull requests

1 participant