llvm / llvm/circt

InnerSymbols: Improvements, ideas, wishlist

Open
#4,454 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Tracking Issue
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

* [ ] Track users and support RAUW. InnerSymDCE needs this and computes it itself presently (cc #4418).
* [ ] Add functionality to add/modify/drop inner symbols to IST. Doing this interacts with `walkSymbols` and otherwise allowing operations to define their symbols. May want approach like SubElementInterface.
* Will need a reasonable/efficient way to generate unique names.
* [ ] See about replacing (Module)Namespace with IST, especially when both are used, and the common "map of ModuleNamespace"s pattern (ISTC?).
* This may not be worth it, and they do serve conceptually separate roles. Some details to sort out re:Namespace's tracking used integer suffixes which may be a pain to efficiently track as symbols are inserted/removed.
* Name legality concerns may not belong in IST.
* The two have different storage/lifetime details.
* If IST is used instead, may not need to recompute as frequently (modulo verifier).
* [ ] PrintIST pass, or otherwise facilitate seeing this information more easily.
* [ ] Consolidate `getInnerRefTo`'s.
* [ ] Sort out how to add dependentTrait on SymbolTable to IRN (as suggested in PR adding it, thanks!)
* [ ] Better story for repeatedly recomputing IST's throughout the pipeline. There's a few warts here, some are:
* Verifier rebuilds IST's each time, would be great to use preserved IST information where possible (or if we want to rebuild in order to actually verify, preserve results for use in next pass).
* Verifiers cannot use analyses is part of/related to why this is not done presently. To be fair, this is pretty heavy-weight for a verifier.
* Similarly, ISTC as an analysis would ideally be able to use preserved IST's when available.
* [ ] Revisit and drop or define meaning for visibility information.
* [ ] Clarify "InnerSymbol" as a concept vs the myriad ways it's stored (and vs "inner_sym"). Be consistent about whether this refers to top-level name, what sort of entity that name targets (the result of an instance, the instance itself..?), and so on.
* [ ] Clarify and document limitations/assumptions re:inner symbols on fields.
* [ ] Make "null"/null-able InnerSymAttr behavior easier to work with-- right now it's common to need to check it's non-null, and `InnerSymAttr.empty()` (sometimes `isa()`).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the InnerSymDCE reference in #4418 and the existing walkSymbols, getInnerRefTo, SymbolTable, IRN, verifier, ISTC, PrintIST, and InnerSymAttr discussions. The issue is a broad wishlist rather than a single entry point; scope one item and confirm its intended behavior with maintainers before determining which tests and verifier expectations define done.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.