Skip to content

[SandboxIR] Pass registry #108084

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

Merged
merged 1 commit into from
Sep 10, 2024
Merged

[SandboxIR] Pass registry #108084

merged 1 commit into from
Sep 10, 2024

Conversation

vporpo
Copy link
Contributor

@vporpo vporpo commented Sep 10, 2024

This patch implements a simple Pass Registry class, which takes ownership of the passes registered with it and provides an interface to get the pass pointer by its name.

public:
PassRegistry() = default;
/// Registers \p PassPtr and takes ownership.
Pass *registerPass(std::unique_ptr<Pass> &&PassPtr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this should return a reference instead of a pointer since it'll never be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes a reference makes more sense.

EXPECT_EQ(Registry.getPassByName("test-pass1"), TP1);
EXPECT_EQ(Registry.getPassByName("test-pass2"), TP2);

FunctionPassManager FPM("test-fpm");
Copy link
Contributor

Choose a reason for hiding this comment

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

copy pasta?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we don't really need a pass manager in this test.

This patch implements a simple Pass Registry class, which takes ownership
of the passes registered with it and provides an interface to get the pass
pointer by its name.
@vporpo vporpo merged commit 2ddf21b into llvm:main Sep 10, 2024
5 of 7 checks passed
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.

2 participants