Skip to content

Commit

Permalink
Add isCompressed flag to STFBranch
Browse files Browse the repository at this point in the history
Fix stfpy compiler warnings with latest Clang
  • Loading branch information
bdutro committed Jan 10, 2025
1 parent 8e02d5d commit 8c84da5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions stf-inc/stf_branch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ namespace stf {
uint64_t rs1_value_ = 0;
uint64_t rs2_value_ = 0;
uint64_t rd_value_ = 0;
bool compressed_ = false;
bool taken_ = false;
bool conditional_ = false;
bool call_ = false;
Expand Down Expand Up @@ -164,6 +165,7 @@ namespace stf {
rs1_value_ = 0;
rs2_value_ = 0;
rd_value_ = 0;
compressed_ = false;
taken_ = false;
conditional_ = false;
call_ = false;
Expand Down Expand Up @@ -224,6 +226,7 @@ namespace stf {
const Registers::STF_REG rs1,
const Registers::STF_REG rs2,
const Registers::STF_REG rd,
const bool compressed,
const bool is_conditional,
const bool is_call,
const bool is_return,
Expand All @@ -245,6 +248,7 @@ namespace stf {
rs1_ = rs1;
rs2_ = rs2;
rd_ = rd;
compressed_ = compressed;
conditional_ = is_conditional;
call_ = is_call;
return_ = is_return;
Expand Down Expand Up @@ -331,6 +335,13 @@ namespace stf {
return target_opcode_;
}

/**
* Gets whether the branch is compressed
*/
inline bool isCompressed() const {
return compressed_;
}

/**
* Gets whether the branch is an indirect
*/
Expand Down Expand Up @@ -513,6 +524,7 @@ namespace stf {
const Registers::STF_REG rs1,
const Registers::STF_REG rs2,
const Registers::STF_REG rd,
const bool compressed,
const bool is_conditional,
const bool is_call,
const bool is_return,
Expand All @@ -530,6 +542,7 @@ namespace stf {
rs1,
rs2,
rd,
compressed,
is_conditional,
is_call,
is_return,
Expand Down
11 changes: 11 additions & 0 deletions stf-inc/stf_branch_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ namespace stf {
Registers::STF_REG& rs1,
Registers::STF_REG& rs2,
Registers::STF_REG& rd,
bool& compressed,
bool& is_conditional,
bool& is_call,
bool& is_return,
Expand All @@ -343,6 +344,7 @@ namespace stf {
bool& compare_greater_than_or_equal,
bool& compare_less_than,
bool& compare_unsigned) {
compressed = true;
return decodeBranch16_(iem,
rec.getPC(),
rec.getOpcode(),
Expand Down Expand Up @@ -390,6 +392,7 @@ namespace stf {
Registers::STF_REG& rs1,
Registers::STF_REG& rs2,
Registers::STF_REG& rd,
bool& compressed,
bool& is_conditional,
bool& is_call,
bool& is_return,
Expand All @@ -401,6 +404,7 @@ namespace stf {
bool& compare_greater_than_or_equal,
bool& compare_less_than,
bool& compare_unsigned) {
compressed = false;
return decodeBranch32_(rec.getPC(),
rec.getOpcode(),
target,
Expand Down Expand Up @@ -449,6 +453,7 @@ namespace stf {
Registers::STF_REG& rs1,
Registers::STF_REG& rs2,
Registers::STF_REG& rd,
bool& compressed,
bool& is_conditional,
bool& is_call,
bool& is_return,
Expand All @@ -466,6 +471,7 @@ namespace stf {
rs1,
rs2,
rd,
compressed,
is_conditional,
is_call,
is_return,
Expand Down Expand Up @@ -495,6 +501,7 @@ namespace stf {
Registers::STF_REG rs1;
Registers::STF_REG rs2;
Registers::STF_REG rd;
bool compressed = false;
bool is_conditional = false;
bool is_call = false;
bool is_return = false;
Expand All @@ -513,6 +520,7 @@ namespace stf {
rs1,
rs2,
rd,
compressed,
is_conditional,
is_call,
is_return,
Expand All @@ -534,6 +542,7 @@ namespace stf {
rs1,
rs2,
rd,
compressed,
is_conditional,
is_call,
is_return,
Expand Down Expand Up @@ -562,6 +571,7 @@ namespace stf {
Registers::STF_REG rs1 = Registers::STF_REG::STF_REG_INVALID;
Registers::STF_REG rs2 = Registers::STF_REG::STF_REG_INVALID;
Registers::STF_REG rd = Registers::STF_REG::STF_REG_INVALID;
bool compressed = false;
bool is_conditional = false;
bool is_call = false;
bool is_return = false;
Expand All @@ -580,6 +590,7 @@ namespace stf {
rs1,
rs2,
rd,
compressed,
is_conditional,
is_call,
is_return,
Expand Down
2 changes: 1 addition & 1 deletion stfpy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include_directories(${STF_BASE}/stf-inc)
add_compile_options(-Wno-sign-conversion -Wno-deprecated-declarations -Wno-deprecated-copy -Wno-implicit-int-conversion -Wno-missing-field-initializers)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-ignored-optimization-argument -Wno-unknown-warning-option)
add_compile_options(-Wno-ignored-optimization-argument -Wno-unknown-warning-option -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
add_link_options(-Wno-unused-command-line-argument -Wno-ignored-optimization-argument)
endif()

Expand Down

0 comments on commit 8c84da5

Please sign in to comment.