@@ -253,22 +253,19 @@ int debug_reg_get_mask(const unsigned regID) {
253253}
254254
255255void debug_touch_reg_read (const unsigned regID ) {
256- if (!(debug .reg_watch_r & dbg_reg_trigger_mask [regID ])) { return ; }
257- debug_open (DBG_REG_READ , regID );
256+ if (unlikely (debug .reg_watch_r & dbg_reg_trigger_mask [regID ])) {
257+ debug_open (DBG_REG_READ , regID );
258+ }
258259}
259260
260261void debug_touch_reg_write (const unsigned regID , const uint32_t oldValue , const uint32_t new_value ) {
261- if (!(debug .reg_watch_w & dbg_reg_trigger_mask [regID ])) {
262- return ;
263- }
264-
265- const uint32_t old_v = debug_norm_reg_value (regID , oldValue );
266- const uint32_t new_v = debug_norm_reg_value (regID , new_value );
267- if (old_v == new_v ) {
268- return ;
262+ if (unlikely (debug .reg_watch_w & dbg_reg_trigger_mask [regID ])) {
263+ const uint32_t old_v = debug_norm_reg_value (regID , oldValue );
264+ const uint32_t new_v = debug_norm_reg_value (regID , new_value );
265+ if (old_v != new_v ) {
266+ debug_open (DBG_REG_WRITE , regID );
267+ }
269268 }
270-
271- debug_open (DBG_REG_WRITE , regID );
272269}
273270
274271void debug_watch (uint32_t addr , int mask , bool set ) {
@@ -341,24 +338,26 @@ void debug_clear_basic_step(void) {
341338void debug_inst_start (void ) {
342339 uint32_t pc = cpu .registers .PC ;
343340 debug .addr [pc ] |= DBG_INST_START_MARKER ;
344- if (debug .step && !(debug .addr [pc ] & DBG_MASK_EXEC ) && pc != debug .tempExec ) {
345- debug .step = debug .stepOver = false;
346- debug_open (DBG_STEP , cpu .registers .PC );
341+ if (unlikely (debug .step )) {
342+ if (!(debug .addr [pc ] & DBG_MASK_EXEC ) && pc != debug .tempExec ) {
343+ debug .step = debug .stepOver = false;
344+ debug_open (DBG_STEP , cpu .registers .PC );
345+ }
347346 }
348347}
349348
350349void debug_inst_fetch (void ) {
351350 uint32_t pc = cpu .registers .PC ;
352351 debug .addr [pc ] |= DBG_INST_MARKER ;
353- if (debug .addr [pc ] & DBG_MASK_EXEC ) {
352+ if (unlikely ( debug .addr [pc ] & DBG_MASK_EXEC ) ) {
354353 debug_open (DBG_BREAKPOINT , pc );
355- } else if (pc == debug .tempExec ) {
354+ } else if (unlikely ( pc == debug .tempExec ) ) {
356355 debug_open (DBG_STEP , pc );
357356 }
358357}
359358
360359void debug_inst_repeat (void ) {
361- if (debug .step ) {
360+ if (unlikely ( debug .step ) ) {
362361 if (debug .stepOver ) {
363362 gui_debug_close ();
364363 } else {
0 commit comments