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

[Moore] Add the SimplifyProcedures pass. #7161

Merged

Conversation

hailongSun2000
Copy link
Member

Cause we intend to entirely inline the always_comb body into the module body(moore.module). Due to the difference way between continuous and blocking assignments, we decided to create a new pass named SimplifyProcedures to insert a local "shadow" variable in always blocks for every module-level/global variable that the process modifies. Quote @fabianschuiki 's example:

origin:

module Foo;
  int a;
  int x, y, z;
  always_comb begin
    a = 1;
    x = a;
    a += 1;
    y = a;
    a += 1;
    z = a;
  end
endmodule

after performing SimplifyProcedures pass:

module Foo;
  int a;
  int x, y, z;
  always_comb begin
    int local_a = a;
    local_a = 1; a = local_a;
    x = local_a;
    local_a += 1; a = local_a;
    y = local_a;
    local_a += 1; a = local_a;
    z = local_a;
  end
endmodule

@hailongSun2000
Copy link
Member Author

Thanks for the code review in advance! ❤️

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding all the infrastructure for Moore dialect passes in this PR 👍

@hailongSun2000 hailongSun2000 force-pushed the hailong/add-simplify-procedures-pass branch from 97e1a45 to 55c965e Compare June 13, 2024 02:49
@hailongSun2000 hailongSun2000 merged commit 2b16c06 into llvm:main Jun 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants