Hi Pan, > Given we have a call, we would like to restore before call and then > backup frm after call. Looks current mode switching cannot emit insn > like that, it can only either emit insn before (mostly) or after > (when NOTE_INSN_BASIC_BLOCK_P). Thus, we try to emit the one after > call when needed as a specially handling here.
Would you mind explaining a bit more here? As far as I know we can perform necessary mode switching (including saving necessary registers) directly after function entry and right before function exit. Is this somehow too early or too late or cannot handle what you want? The patch in itself makes sense (apart from some nits and possible cleanups) but I'm still missing the bigger picture. For me it gets more confusing with every patch to be honest :D Regards Robin