This repository was archived by the owner on Jul 17, 2024. It is now read-only.
File tree 2 files changed +28
-12
lines changed
2 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,10 @@ class VM_Version : public Abstract_VM_Version {
61
61
_enabled = true ;
62
62
_value = value;
63
63
}
64
+ void disable_feature () {
65
+ _enabled = false ;
66
+ _value = -1 ;
67
+ }
64
68
const char * pretty () { return _pretty; }
65
69
uint64_t feature_bit () { return _feature_bit; }
66
70
bool feature_string () { return _feature_string; }
@@ -69,16 +73,21 @@ class VM_Version : public Abstract_VM_Version {
69
73
virtual void update_flag () = 0;
70
74
};
71
75
72
- #define UPDATE_DEFAULT (flag ) \
73
- void update_flag () { \
74
- assert (enabled (), " Must be." ); \
75
- if (FLAG_IS_DEFAULT (flag)) { \
76
- FLAG_SET_DEFAULT (flag, true ); \
77
- } \
78
- } \
79
-
80
- #define NO_UPDATE_DEFAULT \
81
- void update_flag () {} \
76
+ #define UPDATE_DEFAULT (flag ) \
77
+ void update_flag () { \
78
+ assert (enabled (), " Must be." ); \
79
+ if (FLAG_IS_DEFAULT (flag)) { \
80
+ FLAG_SET_DEFAULT (flag, true ); \
81
+ } else { \
82
+ /* Sync CPU features with flags */ \
83
+ if (!flag) { \
84
+ disable_feature (); \
85
+ } \
86
+ } \
87
+ } \
88
+
89
+ #define NO_UPDATE_DEFAULT \
90
+ void update_flag () {} \
82
91
83
92
// Frozen standard extensions
84
93
// I RV64I
Original file line number Diff line number Diff line change @@ -115,6 +115,15 @@ void VM_Version::setup_cpu_available_features() {
115
115
int i = 0 ;
116
116
while (_feature_list[i] != nullptr ) {
117
117
if (_feature_list[i]->enabled ()) {
118
+ // Change flag default
119
+ _feature_list[i]->update_flag ();
120
+
121
+ // Feature will be disabled by update_flag() if flag
122
+ // is set to false by the user on the command line.
123
+ if (!_feature_list[i]->enabled ()) {
124
+ continue ;
125
+ }
126
+
118
127
log_debug (os, cpu)(" Enabled RV64 feature \" %s\" (%ld)" ,
119
128
_feature_list[i]->pretty (),
120
129
_feature_list[i]->value ());
@@ -139,8 +148,6 @@ void VM_Version::setup_cpu_available_features() {
139
148
if (_feature_list[i]->feature_bit () != 0 ) {
140
149
_features |= _feature_list[i]->feature_bit ();
141
150
}
142
- // Change flag default
143
- _feature_list[i]->update_flag ();
144
151
}
145
152
i++;
146
153
}
You can’t perform that action at this time.
0 commit comments