* [Qemu-devel] definition of struct TCGv_i64_d
@ 2016-10-21 14:48 Programmingkid
2016-10-21 15:17 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: Programmingkid @ 2016-10-21 14:48 UTC (permalink / raw)
To: qemu-devel qemu-devel
In the tcg.h file, there is this line: typedef struct TCGv_i64_d *TCGv_i64;
Would anyone know where the definition of struct TCGv_i64_d is?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] definition of struct TCGv_i64_d
2016-10-21 14:48 [Qemu-devel] definition of struct TCGv_i64_d Programmingkid
@ 2016-10-21 15:17 ` Peter Maydell
2016-10-27 16:42 ` G 3
0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2016-10-21 15:17 UTC (permalink / raw)
To: Programmingkid; +Cc: qemu-devel qemu-devel
On 21 October 2016 at 15:48, Programmingkid <programmingkidx@gmail.com> wrote:
> In the tcg.h file, there is this line: typedef struct TCGv_i64_d *TCGv_i64;
>
> Would anyone know where the definition of struct TCGv_i64_d is?
There is none, because the "pointers" in these variables are
never dereferenced. These are just magic to let us make use
of the compiler's typechecking -- the actual values in the
TCGv_i64 variables are integers (offsets into arrays describing
the temporaries inside the TCG code). The only way to create a
TCGv_i64 is with MAKE_TCGV_I64, and then you can get back to
the underlying integer (if you're code in tcg/) is with
GET_TCGV_I64.
We used to typedef TCGv_i64 &c as plain "int"s, but then the
compiler doesn't complain if you pass a TCGv_i32 to a function
expecting a TCGv_i64.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] definition of struct TCGv_i64_d
2016-10-21 15:17 ` Peter Maydell
@ 2016-10-27 16:42 ` G 3
2016-10-27 16:53 ` Peter Maydell
0 siblings, 1 reply; 4+ messages in thread
From: G 3 @ 2016-10-27 16:42 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel qemu-devel
On Oct 21, 2016, at 11:17 AM, Peter Maydell wrote:
> On 21 October 2016 at 15:48, Programmingkid
> <programmingkidx@gmail.com> wrote:
>> In the tcg.h file, there is this line: typedef struct TCGv_i64_d
>> *TCGv_i64;
>>
>> Would anyone know where the definition of struct TCGv_i64_d is?
>
> There is none, because the "pointers" in these variables are
> never dereferenced. These are just magic to let us make use
> of the compiler's typechecking -- the actual values in the
> TCGv_i64 variables are integers (offsets into arrays describing
> the temporaries inside the TCG code). The only way to create a
> TCGv_i64 is with MAKE_TCGV_I64, and then you can get back to
> the underlying integer (if you're code in tcg/) is with
> GET_TCGV_I64.
>
> We used to typedef TCGv_i64 &c as plain "int"s, but then the
> compiler doesn't complain if you pass a TCGv_i32 to a function
> expecting a TCGv_i64.
>
> thanks
> -- PMM
Would you accept a patch that added a comment explaining that struct
TCGv_i64 isn't really a structure?
I'm thinking something like this would help:
/*
There is no TCGv_i64_d structure. This is really a way around a gcc
issue.
TCGv_i64 can be considered a pointer to an integer. Only
MAKE_TCGV_I64
can create an instance variable. GET_TCGV_I64 is what is
used to access the value.
*/
typedef struct TCGv_i64_d *TCGv_i64;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] definition of struct TCGv_i64_d
2016-10-27 16:42 ` G 3
@ 2016-10-27 16:53 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-10-27 16:53 UTC (permalink / raw)
To: G 3; +Cc: qemu-devel qemu-devel
On 27 October 2016 at 17:42, G 3 <programmingkidx@gmail.com> wrote:
> Would you accept a patch that added a comment explaining that struct
> TCGv_i64 isn't really a structure?
Sorry, I forgot to cc you on
https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg05179.html
when I posted it last week.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-27 16:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-21 14:48 [Qemu-devel] definition of struct TCGv_i64_d Programmingkid
2016-10-21 15:17 ` Peter Maydell
2016-10-27 16:42 ` G 3
2016-10-27 16:53 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).