Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
Signed-off-by: fruffy <fruffy@nyu.edu>
  • Loading branch information
fruffy committed Feb 8, 2025
1 parent 93ee19f commit 312dcaf
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions backends/tofino/bf-asm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ if (ENABLE_GTESTS)
endif()


# set_source_files_properties(${BFAS_SOURCES} PROPERTIES COMPILE_FLAGS ${BFASM_CXX_FLAGS})
set_source_files_properties(${BFAS_SOURCES} PROPERTIES COMPILE_FLAGS ${BFASM_CXX_FLAGS})
# Remove compiler flag that is C++ only for vector.c
# string(REPLACE "-Wno-overloaded-virtual" "" vector_c_flags ${BFASM_CXX_FLAGS})
# set_source_files_properties(vector.c PROPERTIES COMPILE_FLAGS ${vector_c_flags})
string(REPLACE "-Wno-overloaded-virtual" "" vector_c_flags ${BFASM_CXX_FLAGS})
set_source_files_properties(vector.c PROPERTIES COMPILE_FLAGS ${vector_c_flags})
add_executable (bfas ${BFAS_SOURCES})
# Enable extensions for bfas. FIXME: Do we need this?
target_compile_options(bfas PRIVATE -std=gnu++17)
Expand Down
7 changes: 3 additions & 4 deletions backends/tofino/bf-asm/crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,13 @@ const char *addr2line(void *addr, const char *text) {
text = exename(program_name);
t = text + strlen(text);
}
memcpy(buffer, text, t - text);
buffer[t - text] = 0;
snprintf(buffer, t - text + 1, "%s", text);
if (child && strcmp(binary, buffer)) {
child = 0;
close(to_child);
close(from_child);
}
memcpy(binary, buffer, (t - text) + 1);
memcpy(binary, buffer, (t - text) + 1); // NOLINT(runtime/printf)
text = binary;
if (!child) {
int pfd1[2], pfd2[2];
Expand All @@ -112,7 +111,7 @@ const char *addr2line(void *addr, const char *text) {
strcpy(p, "$(which ");
p += strlen(p);
} // NOLINT
memcpy(p, text, t - text);
memcpy(p, text, t - text); // NOLINT(runtime/printf)
p += t - text;
if (!memchr(text, '/', t - text)) *p++ = ')';
*p = 0;
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-asm/gtest/register-matcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include "bf-asm/ubits.h"
#include "gtest/gtest.h"
#include "p4c/lib/bitvec.h"
#include "lib/bitvec.h"

namespace BfAsm {

Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-asm/instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ struct VLIWInstruction : Instruction {
};

// target specific template specializations
#include "jbay/instruction.cpp" // NOLINT(build/include)
#include "tofino/instruction.cpp" // NOLINT(build/include)
#include "jbay/instruction.cpp" // NOLINT(build/include)

struct AluOP : VLIWInstruction {
enum special_flags {
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-asm/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include <typeindex>
#include <vector>

#include "backends/tofino/bf-asm/rvalue_reference_wrapper.h"
#include "lib/ordered_map.h"
#include "rvalue_reference_wrapper.h"

using namespace P4;

Expand Down
3 changes: 1 addition & 2 deletions backends/tofino/bf-p4c/arch/psa/psa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ class LoadTargetArchitecture : public Inspector {
if (Device::currentDevice() == Device::TOFINO) {
filenames.push_back("tofino1_specs.p4");
filenames.push_back("tofino1_base.p4");
}
else {
} else {
filenames.push_back("tofino2_specs.p4");
filenames.push_back("tofino2_base.p4");
}
Expand Down
6 changes: 2 additions & 4 deletions backends/tofino/bf-p4c/arch/v1model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,10 @@ class LoadTargetArchitecture : public Inspector {
if (Device::currentDevice() == Device::TOFINO) {
filenames.push_back("tofino1_specs.p4");
filenames.push_back("tofino1_base.p4");
}
else if (Device::currentDevice() == Device::JBAY) {
} else if (Device::currentDevice() == Device::JBAY) {
filenames.push_back("tofino2_specs.p4");
filenames.push_back("tofino2_base.p4");
}
else
} else
BUG("Unsupported device id %s", Device::currentDevice());
filenames.push_back("tofino/stratum.p4");
filenames.push_back("tofino/p4_14_prim.p4");
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/bf-p4c/driver/barefoot.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def process_command_line_options(self, opts):
"""
# Add assembler options.
if os.environ['P4C_BUILD_TYPE'] == "DEVELOPER":
bfas = find_file('bf-asm', 'bfas')
bfas = find_file('.', 'bfas')
else:
bfas = find_file(os.environ['P4C_BIN_DIR'], 'bfas')

Expand Down

0 comments on commit 312dcaf

Please sign in to comment.