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

[CodeGen] Add analyses to help for porting GC passes #74972

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

paperchalice
Copy link
Contributor

@paperchalice paperchalice commented Dec 10, 2023

  • CollectorMetadataAnalysis provides GCStrategyMap.
  • GCFunctionAnalysis provides GCFunctionInfo.

GCStrategyMap owns GCStrategy pointers and this
pass is used by AsmPrinter to iterate all GC strategies.

Most passes that require GCModuleInfo actually require the GCFunctionInfo,
so add GCFunctionAnalysis for convenience.

Copy link

github-actions bot commented Dec 10, 2023

:white_check_mark: With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

Minor drive-by comments so far.

llvm/lib/CodeGen/GCMetadata.cpp Outdated Show resolved Hide resolved
llvm/lib/CodeGen/GCMetadata.cpp Outdated Show resolved Hide resolved
llvm/lib/CodeGen/GCMetadata.cpp Outdated Show resolved Hide resolved
@paperchalice paperchalice force-pushed the NPM/CodeGen/gc branch 2 times, most recently from 35f739d to cb96d32 Compare December 11, 2023 02:40
llvm/lib/CodeGen/GCMetadata.cpp Outdated Show resolved Hide resolved
llvm/lib/CodeGen/GCMetadata.cpp Outdated Show resolved Hide resolved
paperchalice added a commit that referenced this pull request Dec 12, 2023
This pass is broken and looks like no one uses it for the last 15+ years.

```c++
bool Printer::runOnFunction(Function &F) {
  if (F.hasGC())
    return false;

  GCFunctionInfo *FD = &getAnalysis<GCModuleInfo>().getFunctionInfo(F);
```
```c++
GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) {
  assert(!F.isDeclaration() && "Can only get GCFunctionInfo for a definition!");
  assert(F.hasGC()); // Equivalent to `assert(false);` when called by `Printer::runOnFunction`
```

See also #74972.
@paperchalice paperchalice force-pushed the NPM/CodeGen/gc branch 2 times, most recently from ded9ddf to 1430575 Compare December 12, 2023 08:44
@paperchalice paperchalice changed the title [CodeGen] Port GCInfoPrinter to new pass manager [CodeGen] Add analyses to help for porting GC passes Dec 12, 2023
@paperchalice
Copy link
Contributor Author

Just remove the GCInfoPrinter, now only provide two analysis passes.

- `CollectorMetadataAnalysis` provides `GCStrategyMap`.
- `GCFunctionAnalysis` provides `GCFunctionInfo`.

`GCStrategyMap` owns `GCStrategy` pointers and this
pass is used by `AsmPrinter` to iterate all GC strategies.

Most passes that require `GCModuleInfo` actually require the `GCFunctionInfo`,
so add `GCFunctionAnalysis` for convenience.
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

LGTM. Please wait for @arsenm to approve before merging this.

@paperchalice paperchalice merged commit 06aa8b1 into llvm:main Dec 13, 2023
4 checks passed
@paperchalice paperchalice deleted the NPM/CodeGen/gc branch December 13, 2023 07:56
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.

None yet

3 participants