afonso360 commented on issue #6933:
My guess is that if possible it'd be best to break up the macro-instruction into its components to handle this. That way instead of using macro-instructions the helpers in ISLE can be used. This may not always be applicable though.
I did look at a few of these in emit.rs though and they were related to things like sp adjustments and stack probe loops which I think could also reasonably be switched over to asserting that the constant fits in an instruction rather than requiring a pool. (so long as the range matches what one would reasonably expect for these situations)
We already sort of do this. We have
Inst::load_constant_u64
that tries to pattern match either a singleaddi
or aaddi+lui
before falling back to theLoadInlineConst
instruction as a last resort.I'd eventually like to try and fully merge the load constant logic with some ISLE rules, but I'm not entirely sure how to do that.
afonso360 edited a comment on issue #6933:
My guess is that if possible it'd be best to break up the macro-instruction into its components to handle this. That way instead of using macro-instructions the helpers in ISLE can be used. This may not always be applicable though.
I did look at a few of these in emit.rs though and they were related to things like sp adjustments and stack probe loops which I think could also reasonably be switched over to asserting that the constant fits in an instruction rather than requiring a pool. (so long as the range matches what one would reasonably expect for these situations)
We already sort of do this. We have
Inst::load_constant_u64
that tries to pattern match either a singleaddi
or aaddi+lui
before falling back to theLoadInlineConst
instruction as a last resort.I'd eventually like to try and fully merge the load constant logic with some ISLE rules, but I'm not entirely sure how to do that.
Right now both
Inst::load_constant_u64
and ISLE call intoInst::generate_imm
, but I'd like to build some more complex pattern matching in ISLE and still have it available inemit.rs
alexcrichton commented on issue #6933:
Makes sense! I was thinking that the "solution" there is to slowly whittle away at callers to
Inst::load_constant_u64
as opposed to refactoring the internals of that to use ISLE (which would probably be different given the required contexts), but that's naturally much easier said than done
Last updated: Nov 22 2024 at 17:03 UTC