[P4-dev] p4c compiler output in .p4i
hw342 at cornell.edu
Thu Jun 8 17:16:16 EDT 2017
You can use the —top4 flag in p4c-bm2-ss and p4test to dump IR as inlined comments in p4 program, see slide 32 in compiler-design.pptx
> On Jun 8, 2017, at 2:01 PM, <hemant at mnkcg.com> <hemant at mnkcg.com> wrote:
> Hi Han,
> Got it. I found the tools/driver/p4_src/p4c.bmv2.cfg and see the p4i is part of the preprocessor setup. Thanks to Mihai for replying too. About IR, what support does the current p4c compiler have for outputting IR? Isn’t JSON output pending to be developed?
> From: Han Wang [mailto:hanwang at barefootnetworks.com]
> Sent: Thursday, June 08, 2017 4:48 PM
> To: hemant at mnkcg.com
> Cc: p4-dev <p4-dev at lists.p4.org>
> Subject: Re: [P4-dev] p4c compiler output in .p4i
> Hi Hemant,
> p4c is a compiler driver that invokes the other components of the p4 tool chain to process a p4 program. Specifically, for bmv2, the compiler driver invokes preprocessor and p4c-bm2-ss to generate the output json configuration for bmv2.
> You can use the -### flag or --test-only flag to find out which commands are invoked by p4c compiler driver.
> In this case, the .p4i file is the output of the preprocessor step.
>> On Jun 8, 2017, at 1:40 PM, hemant at mnkcg.com <mailto:hemant at mnkcg.com> wrote:
>> The compiler-design slides included with the docs for the p4c compiler do not include some details. Thus a question:
>> When I use p4c to compile P4-16 code in a .p4 file, the compiler outputs a .p4i file. Looking at this file, it looks like IR (Intermediate Representation) to me – am I correct? It would be good to describe this output file in the docs.
>> P4-dev mailing list
>> P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org <http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the P4-dev