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

Add option to print preprocessed P4 and continue with compilation #5152

Open
kfcripps opened this issue Feb 27, 2025 · 2 comments
Open

Add option to print preprocessed P4 and continue with compilation #5152

kfcripps opened this issue Feb 27, 2025 · 2 comments
Assignees
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser) enhancement This topic discusses an improvement to existing compiler code.

Comments

@kfcripps
Copy link
Contributor

kfcripps commented Feb 27, 2025

When the -E option is provided, the compiler prints the contents of the preprocessed P4 file, and exits. It would be nice if there existed an option to do the same (and maybe print the preprocessed P4 to some output file in the --dump directory instead of to stdout), but continue with compilation instead of exiting. Is there any reason to not add such an option?

@kfcripps kfcripps added core Topics concerning the core segments of the compiler (frontend, midend, parser) enhancement This topic discusses an improvement to existing compiler code. labels Feb 27, 2025
@kfcripps kfcripps self-assigned this Feb 27, 2025
@asl
Copy link
Contributor

asl commented Feb 27, 2025

Normally such option is called --save-temps for C/C++ compilers

@vgurevich
Copy link

vgurevich commented Feb 27, 2025

Actually, Tofino compiler does it already by default, but this is done by the compiler driver (p4c or bf-p4c) (by invoking CPP with the proper parameters) and not by the backend (p4c-barefoot) itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser) enhancement This topic discusses an improvement to existing compiler code.
Projects
None yet
Development

No branches or pull requests

3 participants