qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inline expressions for decodetree !function syntax


From: Richard Henderson
Subject: Re: inline expressions for decodetree !function syntax
Date: Thu, 15 Jul 2021 08:53:17 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]