Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove superfluous Tofino include. Make Tofino include paths fully qualified. #4998

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ include_directories (
${P4C_SOURCE_DIR}
${P4C_BINARY_DIR}
${P4C_SOURCE_DIR}/extensions
${P4C_SOURCE_DIR}/backends/tofino ## FIXME
)
add_definitions (-DCONFIG_PREFIX="${CMAKE_INSTALL_PREFIX}")
add_definitions (-DCONFIG_PKGDATADIR="${CMAKE_INSTALL_PREFIX}/${P4C_ARTIFACTS_OUTPUT_DIRECTORY}")
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/add_t2na_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "bf-p4c/arch/add_t2na_meta.h"
#include "backends/tofino/bf-p4c/arch/add_t2na_meta.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be just #include "add_t2na_meta.h" as it is in the same directory. No need for a full path.

Lots of other places this could be cleaned up too -- possibly a separate cleanup change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is a stylistic choice. Not many guides mention it but Google style guide recommends to qualify all paths: https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes

I guess to avoid accidental conflicts with includes?

I do not have a strong preference but the Tofino back end is not the only part which doesn't follow this style. So this likely should be a separate cleanup change.


namespace BFN {

Expand Down
16 changes: 8 additions & 8 deletions backends/tofino/bf-p4c/arch/arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "bf-p4c/arch/arch.h"
#include "backends/tofino/bf-p4c/arch/arch.h"

#include <utility>

#include "bf-p4c/arch/psa/psa.h"
#include "bf-p4c/arch/t2na.h"
#include "bf-p4c/arch/tna.h"
#include "bf-p4c/arch/v1model.h"
#include "bf-p4c/bf-p4c-options.h"
#include "bf-p4c/common/pragma/collect_global_pragma.h"
#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/arch/psa/psa.h"
#include "backends/tofino/bf-p4c/arch/t2na.h"
#include "backends/tofino/bf-p4c/arch/tna.h"
#include "backends/tofino/bf-p4c/arch/v1model.h"
#include "backends/tofino/bf-p4c/bf-p4c-options.h"
#include "backends/tofino/bf-p4c/common/pragma/collect_global_pragma.h"
#include "backends/tofino/bf-p4c/device.h"
#include "frontends/p4/methodInstance.h"
#include "ir/declaration.h"
#include "ir/id.h"
Expand Down
10 changes: 5 additions & 5 deletions backends/tofino/bf-p4c/arch/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

#include <boost/algorithm/string.hpp>

#include "bf-p4c/arch/program_structure.h"
#include "bf-p4c/bf-p4c-options.h"
#include "bf-p4c/ir/gress.h"
#include "bf-p4c/lib/assoc.h"
#include "bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/arch/program_structure.h"
#include "backends/tofino/bf-p4c/bf-p4c-options.h"
#include "backends/tofino/bf-p4c/ir/gress.h"
#include "backends/tofino/bf-p4c/lib/assoc.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"
#include "frontends/common/options.h"
#include "frontends/common/resolveReferences/referenceMap.h"
#include "frontends/common/resolveReferences/resolveReferences.h"
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/arch_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef BACKENDS_TOFINO_BF_P4C_ARCH_ARCH_SPEC_H_
#define BACKENDS_TOFINO_BF_P4C_ARCH_ARCH_SPEC_H_

#include "bf-p4c/ir/gress.h"
#include "backends/tofino/bf-p4c/ir/gress.h"
#include "ir/ir.h"

struct IntrinsicField {
Expand Down
8 changes: 4 additions & 4 deletions backends/tofino/bf-p4c/arch/bridge_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

#include <boost/range/adaptor/sliced.hpp>

#include "bf-p4c/arch/collect_bridged_fields.h"
#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/midend/path_linearizer.h"
#include "bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/arch/collect_bridged_fields.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"
#include "frontends/common/resolveReferences/referenceMap.h"
#include "frontends/common/resolveReferences/resolveReferences.h"
#include "frontends/p4/typeMap.h"
Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/bridge_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifndef BF_P4C_ARCH_BRIDGE_METADATA_H_
#define BF_P4C_ARCH_BRIDGE_METADATA_H_

#include "bf-p4c/arch/program_structure.h"
#include "bf-p4c/ir/gress.h"
#include "bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/arch/program_structure.h"
#include "backends/tofino/bf-p4c/ir/gress.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "frontends/common/resolveReferences/resolveReferences.h"
#include "frontends/p4/evaluator/evaluator.h"
#include "ir/ir.h"
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/check_extern_invocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "check_extern_invocation.h"

#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/device.h"
#include "lib/bitvec.h"

namespace BFN {
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/check_extern_invocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_
#define BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_

#include "bf-p4c/arch/arch.h"
#include "backends/tofino/bf-p4c/arch/arch.h"
#include "frontends/p4/methodInstance.h"
#include "ir/ir.h"
#include "ir/visitor.h"
Expand Down
4 changes: 2 additions & 2 deletions backends/tofino/bf-p4c/arch/collect_bridged_fields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <boost/range/adaptor/sliced.hpp>

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "frontends/common/resolveReferences/referenceMap.h"
#include "frontends/p4/typeMap.h"
#include "ir/ir.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifndef BF_P4C_ARCH_COLLECT_HARDWARE_CONSTRAINED_FIELDS_H_
#define BF_P4C_ARCH_COLLECT_HARDWARE_CONSTRAINED_FIELDS_H_

#include "bf-p4c/common/ir_utils.h"
#include "bf-p4c/common/pragma/all_pragmas.h"
#include "bf-p4c/phv/phv_fields.h"
#include "backends/tofino/bf-p4c/common/ir_utils.h"
#include "backends/tofino/bf-p4c/common/pragma/all_pragmas.h"
#include "backends/tofino/bf-p4c/phv/phv_fields.h"
#include "ir/ir.h"
#include "lib/cstring.h"
#include "lib/ordered_map.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

#include "add_metadata_parser_states.h"

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/arch/fromv1.0/egress_packet_length.h"
#include "bf-p4c/arch/fromv1.0/mirror.h"
#include "bf-p4c/arch/fromv1.0/phase0.h"
#include "bf-p4c/arch/fromv1.0/resubmit.h"
#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/arch/remove_set_metadata.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/egress_packet_length.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/mirror.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/phase0.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/resubmit.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/arch/remove_set_metadata.h"

namespace BFN {

Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "bf-p4c/arch/fromv1.0/checksum.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/checksum.h"

namespace BFN {
namespace V1 {
Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/fromv1.0/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifndef BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_CHECKSUM_H_
#define BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_CHECKSUM_H_

#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/lib/assoc.h"
#include "bf-p4c/midend/parser_graph.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/lib/assoc.h"
#include "backends/tofino/bf-p4c/midend/parser_graph.h"
#include "frontends/p4/methodInstance.h"
#include "v1_program_structure.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "egress_packet_length.h"

#include "bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"

// Check whether egress parser parses mirror packets
class MirrorEgressParseEval : public Inspector {
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/field_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_FIELD_LIST_H_
#define BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_FIELD_LIST_H_

#include "bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "frontends/p4-14/fromv1.0/converters.h"
#include "ir/ir.h"

Expand Down
10 changes: 5 additions & 5 deletions backends/tofino/bf-p4c/arch/fromv1.0/mirror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

#include "mirror.h"

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/common/ir_utils.h"
#include "bf-p4c/device.h"
#include "bf-p4c/lib/pad_alignment.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/common/ir_utils.h"
#include "backends/tofino/bf-p4c/device.h"
#include "backends/tofino/bf-p4c/lib/pad_alignment.h"
#include "frontends/p4-14/fromv1.0/v1model.h"
#include "frontends/p4/cloner.h"
#include "frontends/p4/coreLibrary.h"
Expand Down
4 changes: 2 additions & 2 deletions backends/tofino/bf-p4c/arch/fromv1.0/parser_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <boost/range/adaptor/reversed.hpp>

#include "bf-p4c/common/utils.h"
#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/common/utils.h"
#include "backends/tofino/bf-p4c/device.h"
#include "ir/ir.h"

namespace BFN {
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/fromv1.0/parser_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef BF_P4C_ARCH_FROMV1_0_PARSER_COUNTER_H_
#define BF_P4C_ARCH_FROMV1_0_PARSER_COUNTER_H_

#include "bf-p4c/arch/fromv1.0/v1_converters.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/v1_converters.h"

namespace BFN {
namespace V1 {
Expand Down
20 changes: 10 additions & 10 deletions backends/tofino/bf-p4c/arch/fromv1.0/phase0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@

#include <algorithm>

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/arch/fromv1.0/programStructure.h"
#include "bf-p4c/arch/tna.h"
#include "bf-p4c/common/asm_output.h"
#include "bf-p4c/device.h"
#include "bf-p4c/lib/pad_alignment.h"
#include "bf-p4c/midend/path_linearizer.h"
#include "bf-p4c/midend/type_categories.h"
#include "bf-p4c/midend/type_checker.h"
#include "bf-p4c/parde/field_packing.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/programStructure.h"
#include "backends/tofino/bf-p4c/arch/tna.h"
#include "backends/tofino/bf-p4c/common/asm_output.h"
#include "backends/tofino/bf-p4c/device.h"
#include "backends/tofino/bf-p4c/lib/pad_alignment.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/midend/type_categories.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/parde/field_packing.h"
#include "frontends/common/resolveReferences/referenceMap.h"
#include "frontends/p4-14/fromv1.0/v1model.h"
#include "frontends/p4/cloner.h"
Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/fromv1.0/primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

#include <cmath>

#include "bf-p4c/arch/fromv1.0/programStructure.h"
#include "bf-p4c/bf-p4c-options.h"
#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/programStructure.h"
#include "backends/tofino/bf-p4c/bf-p4c-options.h"
#include "backends/tofino/bf-p4c/device.h"
#include "frontends/p4-14/fromv1.0/converters.h"

namespace P4 {
Expand Down
12 changes: 6 additions & 6 deletions backends/tofino/bf-p4c/arch/fromv1.0/programStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

#include "programStructure.h"

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/arch/fromv1.0/meter.h"
#include "bf-p4c/arch/fromv1.0/phase0.h"
#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/common/pragma/all_pragmas.h"
#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/meter.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/phase0.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/common/pragma/all_pragmas.h"
#include "backends/tofino/bf-p4c/device.h"
#include "frontends/p4-14/fromv1.0/converters.h"
#include "frontends/p4-14/header_type.h"
#include "frontends/p4-14/typecheck.h"
Expand Down
16 changes: 8 additions & 8 deletions backends/tofino/bf-p4c/arch/fromv1.0/programStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

#include <boost/range/adaptor/reversed.hpp>

#include "bf-p4c/arch/fromv1.0/add_metadata_parser_states.h"
#include "bf-p4c/arch/fromv1.0/checksum.h"
#include "bf-p4c/arch/program_structure.h"
#include "bf-p4c/bf-p4c-options.h"
#include "bf-p4c/common/utils.h"
#include "bf-p4c/lib/assoc.h"
#include "bf-p4c/midend/parser_graph.h"
#include "bf-p4c/midend/path_linearizer.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/add_metadata_parser_states.h"
#include "backends/tofino/bf-p4c/arch/fromv1.0/checksum.h"
#include "backends/tofino/bf-p4c/arch/program_structure.h"
#include "backends/tofino/bf-p4c/bf-p4c-options.h"
#include "backends/tofino/bf-p4c/common/utils.h"
#include "backends/tofino/bf-p4c/lib/assoc.h"
#include "backends/tofino/bf-p4c/midend/parser_graph.h"
#include "backends/tofino/bf-p4c/midend/path_linearizer.h"
#include "frontends/common/constantFolding.h"
#include "frontends/common/resolveReferences/resolveReferences.h"
#include "frontends/p4-14/fromv1.0/converters.h"
Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/fromv1.0/resubmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

#include "resubmit.h"

#include "bf-p4c/arch/intrinsic_metadata.h"
#include "bf-p4c/device.h"
#include "bf-p4c/parde/parde_visitor.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/device.h"
#include "backends/tofino/bf-p4c/parde/parde_visitor.h"
#include "frontends/p4-14/fromv1.0/v1model.h"
#include "frontends/p4/cloner.h"
#include "frontends/p4/coreLibrary.h"
Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/fromv1.0/v1_converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

#include <boost/range/adaptor/reversed.hpp>

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/common/utils.h"
#include "bf-p4c/device.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/common/utils.h"
#include "backends/tofino/bf-p4c/device.h"
#include "lib/map.h"
#include "lib/ordered_map.h"
#include "v1_program_structure.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "v1_program_structure.h"

#include "bf-p4c/common/pragma/all_pragmas.h"
#include "backends/tofino/bf-p4c/common/pragma/all_pragmas.h"
#include "v1_converters.h"

namespace BFN {
Expand Down
4 changes: 2 additions & 2 deletions backends/tofino/bf-p4c/arch/fromv1.0/v1_program_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#ifndef BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_V1_PROGRAM_STRUCTURE_H_
#define BACKENDS_TOFINO_BF_P4C_ARCH_FROMV1_0_V1_PROGRAM_STRUCTURE_H_

#include "bf-p4c/arch/program_structure.h"
#include "bf-p4c/ir/gress.h"
#include "backends/tofino/bf-p4c/arch/program_structure.h"
#include "backends/tofino/bf-p4c/ir/gress.h"
#include "frontends/common/resolveReferences/resolveReferences.h"
#include "frontends/p4/evaluator/evaluator.h"
#include "ir/ir.h"
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "bf-p4c/arch/helpers.h"
#include "backends/tofino/bf-p4c/arch/helpers.h"

namespace BFN {

Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/arch/intrinsic_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "bf-p4c/arch/intrinsic_metadata.h"
#include "backends/tofino/bf-p4c/arch/intrinsic_metadata.h"

#include "ir/ir.h"

Expand Down
6 changes: 3 additions & 3 deletions backends/tofino/bf-p4c/arch/intrinsic_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#ifndef BF_P4C_ARCH_INTRINSIC_METADATA_H_
#define BF_P4C_ARCH_INTRINSIC_METADATA_H_

#include "bf-p4c/arch/bridge_metadata.h"
#include "bf-p4c/device.h"
#include "bf-p4c/midend/type_checker.h"
#include "backends/tofino/bf-p4c/arch/bridge_metadata.h"
#include "backends/tofino/bf-p4c/device.h"
#include "backends/tofino/bf-p4c/midend/type_checker.h"
#include "frontends/p4/cloner.h"
#include "frontends/p4/typeChecking/typeChecker.h"
#include "ir/ir.h"
Expand Down
Loading
Loading