[P4-dev] preprocessor support in HLIR?

hemant at mnkcg.com hemant at mnkcg.com
Wed Nov 2 12:41:01 EDT 2016



Sounds reasonable to me – thanks!  The back-end compiler does need any pre-processor lines of code in the P4 file to be translated by HLIR.  If a new issue could be filed related to the HLIR, I’d appreciate it.






From: Pavel Chuprikov [mailto:pschuprikov at gmail.com] 
Sent: Wednesday, November 02, 2016 12:37 PM
To: hemant at mnkcg.com; p4-dev at lists.p4.org
Subject: Re: [P4-dev] preprocessor support in HLIR?


The PP directives are lost on a very early stage <https://github.com/p4lang/p4-hlir/blob/master/p4_hlir/frontend/preprocessor.py#L48>  when the input is fed to gcc.


If those directives are actually used in p4 code, I can suggest to query the p4 object that depends on those directives, e.g., whether some conditionally compiled action is present or, if you have something like field_name : SOME_MACRO, what is the width of the field.





ср, 2 нояб. 2016 г. в 15:59, <hemant at mnkcg.com <mailto:hemant at mnkcg.com> >:

If one adds a C  “#define VAR_FOO 1” in P4 code, does HLIR generate an IR for it?  One needs the defines in the back-end compiler.   





P4-dev mailing list
P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/9922a56d/attachment-0002.html>

More information about the P4-dev mailing list