-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bc7b75b
Showing
252 changed files
with
39,112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Autotools generated files | ||
|
||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache | ||
compile | ||
config.guess | ||
config.h | ||
config.h.in | ||
config.log | ||
config.status | ||
config.sub | ||
configure | ||
depcomp | ||
install-sh | ||
libtool | ||
ltmain.sh | ||
missing | ||
stamp-h1 | ||
test-driver | ||
ylwrap | ||
|
||
TAGS | ||
tags | ||
|
||
extensions/* | ||
backendMakefiles.am | ||
*.d | ||
*.output | ||
|
||
build/ | ||
|
||
m4/libtool.m4 | ||
m4/ltoptions.m4 | ||
m4/ltsugar.m4 | ||
m4/ltversion.m4 | ||
m4/lt~obsolete.m4 | ||
|
||
*tests.am |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set noparent | ||
filter=-build/include_dirname,-build/c++11 | ||
filter=-build/include_what_you_use | ||
filter=-legal/copyright | ||
filter=-runtime/int | ||
filter=-runtime/references | ||
filter=-readability/todo | ||
filter=-readability/function | ||
linelength=100 | ||
|
||
filematch=*.ypp | ||
# yacc productions&actions really confuse cpplint.py, so disable a bunch of things | ||
filter=-readability/braces | ||
filter=-whitespace/braces | ||
filter=-whitespace/semicolon | ||
filter=-readability/namespace | ||
|
||
filematch=*.l | ||
filter=-whitespace/semicolon,-whitespace/braces,-whitespace/comma | ||
filter=-whitespace/operators | ||
filter=-readability/multiline_string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
ACLOCAL_AMFLAGS = -I m4 | ||
AM_CPPFLAGS = -I$(srcdir)/frontends -I$(srcdir)/backends -Wall -Wextra \ | ||
-Wno-deprecated-register -Wno-overloaded-virtual -Wno-deprecated | ||
AM_YFLAGS = -v | ||
|
||
TOOLSDIR=$(srcdir)/tools | ||
GENTESTS=$(TOOLSDIR)/gen-tests.py | ||
|
||
.l.c: | ||
$(LEX.l) $< > $@ | ||
|
||
# Variables that are appended to in sub-Makefiles | ||
# Please use += to add values to these variables | ||
# The first 6 are standard automake variables | ||
CLEANFILES = # Files to remove on clean | ||
bin_PROGRAMS = # Binaries built | ||
noinst_LIBRARIES = # Static libraries built | ||
BUILT_SOURCES = # Generated source files | ||
TESTS = # Tests to execute | ||
XFAIL_TESTS = # Tests that are supposed to fail | ||
|
||
cpplint_FILES = # Files that should be passed to cpplint (and etags) | ||
ir_DEF_FILES = # Files that generate the IR | ||
ir_SOURCES = # Other files that contribute to the IR | ||
|
||
include $(srcdir)/lib/Makefile.am | ||
include $(srcdir)/tools/ir-generator/Makefile.am | ||
include $(srcdir)/ir/Makefile.am | ||
include $(srcdir)/frontends/Makefile.am | ||
include $(srcdir)/midend/Makefile.am | ||
|
||
# The following file is generated by a script. | ||
include $(srcdir)/backendMakefiles.am | ||
|
||
######## Generate C++ IR files from *.def files using ir-generator | ||
|
||
# make is very stupid regarding multiple files generated from the same source | ||
# this pattern ensures that parallel builds continue to work | ||
ir/ir-generated.h: irgenerator $(ir_DEF_FILES) | ||
./irgenerator -t ir/gen-tree-macro.h -i ir/ir-generated.cpp $(ir_DEF_FILES) >$@ | ||
@$(srcdir)/tools/fixup-line-directives $@ >$@.tmp | ||
@mv $@.tmp $@ | ||
ir/gen-tree-macro.h: ir/ir-generated.h | ||
@$(srcdir)/tools/fixup-line-directives $@ >$@.tmp | ||
@mv $@.tmp $@ | ||
ir/ir-generated.cpp: ir/ir-generated.h | ||
@$(srcdir)/tools/fixup-line-directives $@ >$@.tmp | ||
@mv $@.tmp $@ | ||
|
||
BUILT_SOURCES += \ | ||
ir/ir-generated.h \ | ||
ir/ir-generated.cpp \ | ||
ir/gen-tree-macro.h | ||
|
||
################ | ||
|
||
# Front-end library | ||
noinst_LIBRARIES += libfrontend.a | ||
libfrontend_a_SOURCES = \ | ||
setup.h \ | ||
setup.cpp \ | ||
$(frontend_SOURCES) \ | ||
$(midend_SOURCES) \ | ||
$(ir_SOURCES) | ||
|
||
# unit tests | ||
include $(srcdir)/test/Makefile.am | ||
|
||
################ Misc custom targets | ||
|
||
clean-local: | ||
-rm -f $(BUILT_SOURCES) $(CLEANFILES) | ||
|
||
cpplint: | ||
cd $(srcdir); tools/cpplint.py --root=$(srcdir) --extensions=h,hpp,c,cpp,ypp,l $(sort $(cpplint_FILES)) | ||
|
||
tags: | ||
cd $(srcdir); ctags -R --langmap=C++:+.def,Flex:+.l,YACC:+.ypp \ | ||
backends frontends ir lib tools | ||
cd $(srcdir)/tools/ir-generator; ctags -R --langmap=Flex:+.l,YACC:+.ypp \ | ||
. ../../lib | ||
etags: | ||
cd $(srcdir); ctags -e -R --langmap=C++:+.def,Flex:+.l,YACC:+.ypp \ | ||
backends frontends ir lib tools | ||
cd $(srcdir)/tools/ir-generator; ctags -e -R --langmap=Flex:+.l,YACC:+.ypp \ | ||
. ../../lib | ||
|
||
check-%: | ||
@$(MAKE) check TESTS="$(filter $*/%, $(TESTS))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This folder contains the C++ source code for the P4 v1.2 compiler. | ||
|
||
The compiler documentation is in [docs/README.md](docs/README.md) | ||
|
||
To build execute the following commands: | ||
|
||
``` | ||
./bootstrap.sh | ||
cd build | ||
make check | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Makefile for a backend that generates code for the Behavioral Model version 2 (BMv2) | ||
# To be included in the main P4C compiler makefile | ||
|
||
bin_PROGRAMS += p4c-bmv2 | ||
p4c_bmv2_LDADD = -lgc libfrontend.a libp4ctoolkit.a | ||
|
||
p4c_bmv2_SOURCES = \ | ||
backends/bmv2/bmv2.cpp \ | ||
backends/bmv2/analyzer.h \ | ||
backends/bmv2/analyzer.cpp \ | ||
backends/bmv2/jsonconverter.h \ | ||
backends/bmv2/jsonconverter.cpp \ | ||
backends/bmv2/controlInlining.h \ | ||
backends/bmv2/controlInlining.cpp \ | ||
backends/bmv2/midend.h \ | ||
backends/bmv2/midend.cpp \ | ||
backends/bmv2/lower.h \ | ||
backends/bmv2/lower.cpp | ||
|
||
cpplint_FILES += $(p4c_bmv2_SOURCES) | ||
|
||
# Tests | ||
-include $(srcdir)/bmv2tests.am | ||
|
||
CLEANFILES += $(srcdir)/bmv2tests.am | ||
|
||
$(srcdir)/bmv2tests.am: $(srcdir)/testdata/v1_samples/*.p4 | ||
@$(GENTESTS) $(srcdir) bmv2 $(srcdir)/backends/bmv2/run-bmv2-test.py $^ >$@ | ||
|
||
XFAIL_TESTS += \ | ||
bmv2/testdata/v1_samples/09-IPv4OptionsUnparsed.p4.test \ | ||
bmv2/testdata/v1_samples/action_profile.p4.test \ | ||
bmv2/testdata/v1_samples/resubmit.p4.test \ | ||
bmv2/testdata/v1_samples/hitmiss.p4.test \ | ||
bmv2/testdata/v1_samples/packet_redirect.p4.test \ | ||
bmv2/testdata/v1_samples/TLV_parsing.p4.test \ | ||
bmv2/testdata/v1_samples/truncate.p4.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This is a back-end which generates code for the Behavioral Model version 2 (BMv2). | ||
https://github.com/p4lang/behavioral-model.git | ||
|
||
The back-end accepts code written for the v1model.p4 switch model. |
Oops, something went wrong.