ISLE: Common accessors for some insn data fields (#3781)

Add accessors to prelude.isle to access data fields of
`func_addr` and `symbol_value` instructions.

These are based on similar versions I had added to the s390x
back-end, but are a bit more straightforward to use.

- func_ref_data: Extract SigRef, ExternalName, and RelocDistance
  fields given a FuncRef.

- symbol_value_data: Extract ExternalName, RelocDistance, and
  offset fields given a GlobalValue representing a Symbol.

- reloc_distance_near: Test for RelocDistance::Near.

The s390x back-end is changed to use these common versions.

Note that this exposed a bug in common isle code: This extractor:

(extractor (load_sym inst)
  (and inst
       (load _ (def_inst (symbol_value
                           (symbol_value_data _
                             (reloc_distance_near) offset)))
               (i64_from_offset
                 (memarg_symbol_offset_sum <offset _)))))

would raise an assertion in sema.rs due to a supposed cycle in
extractor definitions.  But there was no actual cycle, it was
simply that the extractor tree refers twice to the `insn_data`
extractor (once via the `load` and once via the `symbol_value`
extractor).  Fixed by checking for pre-existing definitions only
along one path in the tree, not across the whole tree.
This commit is contained in:
Ulrich Weigand
2022-02-09 02:57:27 +01:00
committed by GitHub
parent 9c5c872b3b
commit 10198553c7
13 changed files with 960 additions and 883 deletions

View File

@@ -1,4 +1,4 @@
src/clif.isle 9ea75a6f790b5c03
src/prelude.isle 6aaf8ce0f5a5c2ec
src/isa/s390x/inst.isle 1ae3c0f9c956affd
src/isa/s390x/lower.isle d18ee0bff12cad4e
src/prelude.isle 73285cd431346d53
src/isa/s390x/inst.isle 87a2d7c0c69d0324
src/isa/s390x/lower.isle 3c124e26bc411983