Skip to content

Conversation

@PappasBrent
Copy link
Contributor

@PappasBrent PappasBrent commented May 27, 2023

  • Add the method MacroExpansion::AlignedParameterSubstitutions() to map each of a macro's parameters to a vector of Stmts that align with those parameters' substitutions in the macro expansion.
  • Add the method MacroExpansion::ParameterUseCounts() to map each of the macro's parameters to the number of times it was substituted into the macro expansion.

With these two methods combined, users can check if every one of a macro expansion's parameter substitutions align with a Stmt. This is demonstrated in the new binary, print-aligned-parameters-substitutions. This will be useful when deciding what macro expansions to lower down to MLIR, and for getting the regions of code that should emitted for each of the macro expansion's arguments.

- Add `MacroExpansion::AlignedParameterSubstitutions()` to map each of
  a macro expansion's parameters to a vector of stmts that the
  parameter's substitutions cover/align with.
- Add `MacroExpansion::ParameterUseCounts()` to map each of the macro
  expansion's parameters to the number of times it was substituted into
  the expansion.
- Define the `<` operator for macros so that we can use
  `MacroParameter`s as map keys.
- Add binary print-aligned-parameter-substitutions to enable testing of
  `MacroExpansion::AlignedParameterSubstitutions()`.
- Update appropriate CMake files.
@PappasBrent PappasBrent requested a review from pgoodman as a code owner May 27, 2023 01:02
@pgoodman pgoodman merged commit 921ab78 into master May 27, 2023
@pgoodman pgoodman deleted the aligned-parameter-substitutions branch May 27, 2023 20:06
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.

3 participants