Skip to content

Commit 8c84da5

Browse files
committed
Add isCompressed flag to STFBranch
Fix stfpy compiler warnings with latest Clang
1 parent 8e02d5d commit 8c84da5

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

stf-inc/stf_branch.hpp

+13
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ namespace stf {
114114
uint64_t rs1_value_ = 0;
115115
uint64_t rs2_value_ = 0;
116116
uint64_t rd_value_ = 0;
117+
bool compressed_ = false;
117118
bool taken_ = false;
118119
bool conditional_ = false;
119120
bool call_ = false;
@@ -164,6 +165,7 @@ namespace stf {
164165
rs1_value_ = 0;
165166
rs2_value_ = 0;
166167
rd_value_ = 0;
168+
compressed_ = false;
167169
taken_ = false;
168170
conditional_ = false;
169171
call_ = false;
@@ -224,6 +226,7 @@ namespace stf {
224226
const Registers::STF_REG rs1,
225227
const Registers::STF_REG rs2,
226228
const Registers::STF_REG rd,
229+
const bool compressed,
227230
const bool is_conditional,
228231
const bool is_call,
229232
const bool is_return,
@@ -245,6 +248,7 @@ namespace stf {
245248
rs1_ = rs1;
246249
rs2_ = rs2;
247250
rd_ = rd;
251+
compressed_ = compressed;
248252
conditional_ = is_conditional;
249253
call_ = is_call;
250254
return_ = is_return;
@@ -331,6 +335,13 @@ namespace stf {
331335
return target_opcode_;
332336
}
333337

338+
/**
339+
* Gets whether the branch is compressed
340+
*/
341+
inline bool isCompressed() const {
342+
return compressed_;
343+
}
344+
334345
/**
335346
* Gets whether the branch is an indirect
336347
*/
@@ -513,6 +524,7 @@ namespace stf {
513524
const Registers::STF_REG rs1,
514525
const Registers::STF_REG rs2,
515526
const Registers::STF_REG rd,
527+
const bool compressed,
516528
const bool is_conditional,
517529
const bool is_call,
518530
const bool is_return,
@@ -530,6 +542,7 @@ namespace stf {
530542
rs1,
531543
rs2,
532544
rd,
545+
compressed,
533546
is_conditional,
534547
is_call,
535548
is_return,

stf-inc/stf_branch_decoder.hpp

+11
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ namespace stf {
332332
Registers::STF_REG& rs1,
333333
Registers::STF_REG& rs2,
334334
Registers::STF_REG& rd,
335+
bool& compressed,
335336
bool& is_conditional,
336337
bool& is_call,
337338
bool& is_return,
@@ -343,6 +344,7 @@ namespace stf {
343344
bool& compare_greater_than_or_equal,
344345
bool& compare_less_than,
345346
bool& compare_unsigned) {
347+
compressed = true;
346348
return decodeBranch16_(iem,
347349
rec.getPC(),
348350
rec.getOpcode(),
@@ -390,6 +392,7 @@ namespace stf {
390392
Registers::STF_REG& rs1,
391393
Registers::STF_REG& rs2,
392394
Registers::STF_REG& rd,
395+
bool& compressed,
393396
bool& is_conditional,
394397
bool& is_call,
395398
bool& is_return,
@@ -401,6 +404,7 @@ namespace stf {
401404
bool& compare_greater_than_or_equal,
402405
bool& compare_less_than,
403406
bool& compare_unsigned) {
407+
compressed = false;
404408
return decodeBranch32_(rec.getPC(),
405409
rec.getOpcode(),
406410
target,
@@ -449,6 +453,7 @@ namespace stf {
449453
Registers::STF_REG& rs1,
450454
Registers::STF_REG& rs2,
451455
Registers::STF_REG& rd,
456+
bool& compressed,
452457
bool& is_conditional,
453458
bool& is_call,
454459
bool& is_return,
@@ -466,6 +471,7 @@ namespace stf {
466471
rs1,
467472
rs2,
468473
rd,
474+
compressed,
469475
is_conditional,
470476
is_call,
471477
is_return,
@@ -495,6 +501,7 @@ namespace stf {
495501
Registers::STF_REG rs1;
496502
Registers::STF_REG rs2;
497503
Registers::STF_REG rd;
504+
bool compressed = false;
498505
bool is_conditional = false;
499506
bool is_call = false;
500507
bool is_return = false;
@@ -513,6 +520,7 @@ namespace stf {
513520
rs1,
514521
rs2,
515522
rd,
523+
compressed,
516524
is_conditional,
517525
is_call,
518526
is_return,
@@ -534,6 +542,7 @@ namespace stf {
534542
rs1,
535543
rs2,
536544
rd,
545+
compressed,
537546
is_conditional,
538547
is_call,
539548
is_return,
@@ -562,6 +571,7 @@ namespace stf {
562571
Registers::STF_REG rs1 = Registers::STF_REG::STF_REG_INVALID;
563572
Registers::STF_REG rs2 = Registers::STF_REG::STF_REG_INVALID;
564573
Registers::STF_REG rd = Registers::STF_REG::STF_REG_INVALID;
574+
bool compressed = false;
565575
bool is_conditional = false;
566576
bool is_call = false;
567577
bool is_return = false;
@@ -580,6 +590,7 @@ namespace stf {
580590
rs1,
581591
rs2,
582592
rd,
593+
compressed,
583594
is_conditional,
584595
is_call,
585596
is_return,

stfpy/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include_directories(${STF_BASE}/stf-inc)
77
add_compile_options(-Wno-sign-conversion -Wno-deprecated-declarations -Wno-deprecated-copy -Wno-implicit-int-conversion -Wno-missing-field-initializers)
88

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

0 commit comments

Comments
 (0)