[P4-dev] preprocessor support in HLIR?

Pavel Chuprikov pschuprikov at gmail.com
Wed Nov 2 12:36:39 EDT 2016


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.

Regards,
Pavel

ср, 2 нояб. 2016 г. в 15:59, <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.
>
>
>
> Thanks,
>
>
>
> Hemant
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161102/a5eb3f03/attachment-0002.html>


More information about the P4-dev mailing list