Assert that we only use virtual registers with moves (#5440)
Assert that we never see real registers as arguments to move instructions in VCodeBuilder::collect_operands. Also fix a bug in the riscv64 backend that was discovered by these assertions: the lowerings of get_stack_pointer and get_frame_pointer were using physical registers 8 and 2 directly. The solution was similar to other backends: add a move instruction specifically for moving out of physical registers, whose source operand is opaque to regalloc2.
This commit is contained in:
@@ -858,10 +858,10 @@
|
||||
;;; Rules for `get_{frame,stack}_pointer` and `get_return_address` ;;;;;;;;;;;;;
|
||||
|
||||
(rule (lower (get_frame_pointer))
|
||||
(gen_move2 (x_reg 8) $I64 $I64))
|
||||
(gen_mov_from_preg (fp_reg)))
|
||||
|
||||
(rule (lower (get_stack_pointer))
|
||||
(gen_move2 (x_reg 2) $I64 $I64))
|
||||
(gen_mov_from_preg (sp_reg)))
|
||||
|
||||
(rule (lower (get_return_address))
|
||||
(load_ra))
|
||||
|
||||
Reference in New Issue
Block a user