jasmin
jasmin copied to clipboard
Systematic treatment of (potentially too large) immediates
Currently, during lowering, we transform some instructions (in particular additions) if the immediate they take as an argument is too large to be taken directly. We then introduce a move of this immediate to a register, and replace the immediate by this register in the original instruction. This approach has several drawbacks:
- this introduces an extra instruction without the user noticing -> the compiler should at least emit a warning
- this is done only for some instructions in an ad-hoc manner -> it should be done in a systematic way, dealing both with the cases where immediates are not allowed and the cases where immediates are allowed with an upper bound
This could be done in a different pass after lowering.
Actually, it has been decided that the pass must be optional, and disabled when we use the "strict mode".