riscv64: Move is_null/is_invalid to ISLE (#5874)

* riscv64: Move `is_null`/`is_invalid` to ISLE

* riscv64: Fix `is_invalid` codegen

* Implement review suggestions

Thanks!

Co-authored-by: Jamey Sharp <jamey@minilop.net>

---------

Co-authored-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
Afonso Bordado
2023-02-25 12:48:44 +00:00
committed by GitHub
parent 67e2e57b02
commit 36e92add6f
10 changed files with 33 additions and 116 deletions

View File

@@ -612,14 +612,16 @@
(gen_stack_addr ss offset))
;;;;; Rules for `is_null`;;;;;;;;;
(rule
(lower (is_null v))
(gen_reference_check (ReferenceCheckOP.IsNull) v))
;; Null references are represented by the constant value `0`.
(rule (lower (is_null v))
(seqz v))
;;;;; Rules for `is_invalid`;;;;;;;;;
(rule
(lower (is_invalid v))
(gen_reference_check (ReferenceCheckOP.IsInvalid) v))
;; Invalid references are represented by the constant value `-1`.
(rule (lower (is_invalid v))
(seqz (alu_rr_imm12 (AluOPRRI.Addi) v (imm12_const 1))))
;;;;; Rules for `select`;;;;;;;;;
(rule