[llvm-dev] Proposal for a LLVM front-end for P4 language

Dangeti Tharun kumar via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 12 21:38:04 PDT 2018

Dear community,

We, a team at IIT Hyderabad are developing an LLVM front end for a
networking language called P4 (https://p4.org/). Our work aims to enable
LLVM based optimizations for P4.

As the P4 language was designed to target many different switch
architectures, we feel that P4 can comfortably fit in the LLVM framework
where adding targets is more structured.

The existing open-source P4 compiler (https://github.com/p4lang/p4c)
supports its BPF backend via clang by emitting C code.

P4  ---> C ----> | Clang | --> BPF.

We propose that having an LLVM front-end can make it much simpler by
by-passing the C code-generation step.

As part of our implementation, we have a zeroth version of front-end to
support some P4-16 constructs. We request the community to help us with the
feedback. Here is the GitHub link <https://github.com/IITH-Compilers/p4lang>

Background on P4:

P4 is a high-level language for Programming Protocol-independent Packet
Processors. P4 resembles C language, and is developed with the following


   Reconfigurability in the field: Programmers should be able to change the
   way switches process packets once they are deployed.

   Protocol independence: Switches should not be tied to any specific
   network protocols.

   Target independence: Programmers should be able to describe packet
   processing functionality independently of the specifics of the underlying

More details can be found in the published p4 paper. (




   P4 Paper DOI:  http://dx.doi.org/10.1145/2656877.2656890

   Opensource P4 compiler https://github.com/p4lang/p4c


*Thank you= Tharun, Venkat, Pankaj and Bhanu*

D Tharun Kumar
CSE-IIT Hyderabad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180313/15effc99/attachment.html>

More information about the llvm-dev mailing list