>> Why do we appear to return a different mode here?  We already request
>> FRM_MODE_DYN_CALL in mode_needed.  It looks like in the whole function
>> we do not change the mode so we could just always return the incoming
>> mode?
> 
> Because we need to emit 2 insn when meet a call. One before the call,
> we must return DYN_CALL when needed, then the emit part is able to
> know the mode switch to DYN_CALL and restore. One after the call, we
> must return DYN_CALL when after, then the next insn emit part is able
> to know the prev_mode is DYN_CALL and backup.

My question was not about DYN_CALL in general but rather - mode switching
will switch to the moded requested by mode_needed.  The mode_after hook
allows to specify if we want to change a mode afterwards but it doesn't look
like we every do.

mode_needed -> CALL_P -> DYN_CALL
mode_sw switches to DYN_CALL
mode_after -> DYN_CALL

so there is no need to appear to change the mode but we can just pass it
through, possibly same for DYN?  Or to put it differently, can we start
with "return mode" in riscv_frm_mode_after and then only add the condition
that are strictly necessary?

I also noticed an unused bb in riscv_frm_adjust_mode_after_call that
we want to remove.  Also, if (mode != prev_mode) in mode_set is unnecessary
as mode_sw already checks that.

Regards
 Robin

Reply via email to