This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Tree


konica sarker <konica.sarker@gmail.com> writes:

> here is a tree code :
> for example output of debug_tree(t1)
>
> <real_type 0xb77a6120 float address-space-1 SF
>     size <integer_cst 0xb76d42c0 type <integer_type 0xb76e8060
> bit_size_type> constant 32>
>     unit size <integer_cst 0xb76d4060 type <integer_type 0xb76e8000
> long unsigned int> constant 4>
>     align 32 symtab 0 alias set -1 canonical type 0xb77a6120 precision 32>
>
> if I use addr_space_t asl = TYPE_ADDR_SPACE (t1);
> I get the address space value in asl.
>
>
> now, I have another tree code :
>  debug_tree(t2)
>
>  <var_decl 0xb781d284 z
>     type <real_type 0xb781c120 float address-space-1 SF
>         size <integer_cst 0xb774a2c0 constant 32>
>         unit size <integer_cst 0xb774a060 constant 4>
>         align 32 symtab 0 alias set -1 canonical type 0xb781c120 precision 32>
>     used public external common SF defer-output file /tmp/test.c line
> 21 col 21 size <integer_cst 0xb774a2c0 32> unit size <integer_cst
> 0xb774a060 4>
>     align 32>
>
> if I use addr_space_t asl = TYPE_ADDR_SPACE (t2);
> I am not getting the address space value .
>
> so , what is the difference of this two tree?
> how do I get the address space value of the 2nd one?

In this example, t1 is a REAL_TYPE, but t2 is a VAR_DECL.  You have to
use TYPE_ADDR_SPACE with a type, not a decl.  A decl has a type, but it
is not a type.  For this example, you should be using TYPE_ADDR_SPACE
(TREE_TYPE (t2)), not TYPE_ADDR_SPACE (t2).  If you look carefully at
the debug_tree (t2) output, you can see that address-space-1 is
associated with the type field of the VAR_DECL.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]