void* vector

2006-12-09 Thread Alexey Smirnov

Hello,

I am trying to use vec.h to implement a vector of pointers:

typedef void* handle_t;

DEF_VEC_I(handle_t);
DEF_VEC_ALLOC_I(handle_t,heap);

extern VEC(handle_t,heap) *handles;

It does not compile:


In function 'VEC_handle_t_must_be_integral_type':
error: wrong type argument to bit-complement


The reason is the bit-complement test to decide if the supplied type
is integral or
not. It does not compile if void* is used:

 (void)~(void*)0;

However, it is obviously possible to use void pointers along with
ints because they are equivalent on x86 as specified in i386.h:

#define Pmode (TARGET_64BIT ? DImode : SImode)

Therefore, we should use the mode of a constant of the type in
question to support void pointer vectors. That is, I would like to
use the following test:

__builtin_mode( (T) 0) == (TARGET_64BIT ? DImode : SImode)

Is a builtin like this available in GCC or not? Thanks,

Alexey


Re: void* vector

2006-12-09 Thread Alexey Smirnov

The documentation in vec.h says that pointer values are dereferenced:


Both the structure object and pointer variants
pass pointers to objects around -- in the former case the pointers
are stored into the vector and in the latter case the pointers are
dereferenced and the objects copied into the vector.


It is impossible to dereference a void*. Therefore, we need to use either VEC_I
or structure object, but the latter is a stretch.

On 12/9/06, Steven Bosscher <[EMAIL PROTECTED]> wrote:

On 12/9/06, Alexey Smirnov <[EMAIL PROTECTED]> wrote:
> typedef void* handle_t;
>
> DEF_VEC_I(handle_t);
> DEF_VEC_ALLOC_I(handle_t,heap);

Why DEF_VEC_I instead of DEF_VEC_P?

See vec.h.

Gr.
Steven



GCC Internals Wikibook

2006-03-02 Thread Alexey Smirnov

Hello,

There is a wikibook that describes the internals of GCC and GEM, an 
extensibility framework.


http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals

GEM allows programmers to write extensions to GNU C. We will submit the 
framework as a GCC patch. Please give us feedback on the framework.


Thanks.

Alexey



Re: GCC Internals Wikibook

2006-03-06 Thread Alexey Smirnov

There is a wikibook that describes the internals of GCC and GEM, an
extensibility framework.


Your internals documentation looks pretty good, so I have made a link
to it from gcc.gnu.org/readings.html.  Thanks,


It describes AST part of GCC source code. We would like to ask developers to 
work on the intermediate representation and backends. When the book gets 
comprehensive enough we will generate a PDF from it for a convenient 
distribution.


Alexey



Re: documentation on inlining model needed

2006-03-08 Thread Alexey Smirnov

Recently, I'm very interested in the inlining model of gcc.I need a
detailed documentation describing how the inlining is implemented in
gcc 4.0. Anybody who has been or is working on it please send me a
documentation. I'd really appreciate your help.


There is no such documentation; you're going to have to look at the 
source.

The mechanism of actually duplicating a function body and substituting it
for a call is in tree-inline.c. The decision about which calls to expand
inline is made in cgraph.c and cgraphunit.c.


If you decide to write up your results please add them to the compiler 
internals Wikibook at

http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals
Thanks.

Alexey