On 7/15/21 2:33 AM, Peter Maydell wrote:
I have found myself wondering whether it would be a good idea for
decodetree to support some minimal syntax for defining constant-modifying
functions inline in the decode file, so that instead of writing
%imm4_16_p1 16:4 !function=plus_1
and then having to define a "plus_1" function somewhere in a .c file,
you could write something like
%imm4_16_p1 16:4 !function="x + 1"
and decodetree would just wrap the quoted string in
"static inline int fnname(DisasContext *s, int x) {return %s;}"
(autogenerating a unique function name for it).
Seems workable.
(target/arm actually has three separate implementations of
the "add 1" function right now :-))
Ew. :-)
r~