I wrote the following ISLE code (inside cranelift/codegen/src/isa/aarch64/inst.isle
):
(type AModeNew
(enum
(RegOffset
(rn Reg)
(off i64)
(ty Type))
))
(decl load_addr_new (AModeNew) Reg)
(rule (load_addr_new (AModeNew.RegOffset r 0 _)) (r))
and when I try to rebuild Cranelift, I get the following cryptic ISLE compiler error (which refers to the last line):
src/isa/aarch64/inst.isle:2545:1: type error: Unknown term in pattern: 'r'
The error message also suggests running:
cargo check -p cranelift-codegen --features isle-errors
but that doesn't help. It feels like I am missing something obvious, but I just can't figure out what; I would appreciate any suggestions.
@Anton Kirilov the "Unknown term in pattern" error is indicating that a "term" lookup (for the first symbol in a paren expression) failed; so I would expect source code like (r ...)
to produce such an error (the r
is the term here). I'm surprised it's picking up the r
in the second position in that way. Do you have a branch (even just a WIP commit) somewhere I can reproduce this and play with it?
... oh, nevermind, I see it
the (r)
in your right-hand side is the issue: it is invoking r
as if it were a constructor
I think remove the parens around that and it'll work?
separately, this error message is I think the one that's firing and should say "Unknown term in expression" rather than "Unknown term in pattern"; that's part of the confusion here I think
Indeed, it worked! Thanks a lot! My hunch that it was something obvious was correct, after all :smile:.
https://github.com/bytecodealliance/wasmtime/pull/4775 to fix the error message
thanks for asking here :-)
However, I am not sure the updated error message would have helped - I guess I still have to wrap my head around the fact that I need to be careful with my usage of brackets.
Or maybe it was just a long day :smile:.
Anton Kirilov has marked this topic as resolved.
yeah, it is a bit of a case of "Lisp: use lots of parens, but not too many"
sorry about that :-)
Last updated: Dec 23 2024 at 13:07 UTC