COMPONENT_REF problem ?

Pranav Bhandarkar pranav.bhandarkar@gmail.com
Sat Oct 3 10:43:00 GMT 2009


Hi,

Is it possible for a component_ref node to have its arg 0 to be NULL ?
I would think not because from tree.def I gather that arg 0 tells me
what structures field this component_ref refers to. For convenience, I
have pasted here what tree.def tells me about a component_ref


/* Value is structure or union component.
   Operand 0 is the structure or union (an expression).
   Operand 1 is the field (a node of type FIELD_DECL).
   Operand 2, if present, is the value of DECL_FIELD_OFFSET, measured
   in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT.  */
DEFTREECODE (COMPONENT_REF, "component_ref", tcc_reference, 3)


I am working on a target hook wherein I use the MEM_EXPR of a mem rtx.
It returns the following component_ref node

<component_ref 0x2b3599d0ca00
    type <integer_type 0x2b35998f1e40 int32 sizes-gimplified public SI
        size <integer_cst 0x2b359975a840 constant 32>
        unit size <integer_cst 0x2b359975a4b0 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x2b359976d6c0
precision 32 min <integer_cst 0x2b359975a8a0 -2147483648> max \
<integer_cst 0x2b359975a8d0 2147483647>
        pointer_to_this <pointer_type 0x2b3599b1c300>>

    arg 1 <field_decl 0x2b3599b18140 dcfMemL1 type <integer_type
0x2b35998f1e40 int32>
        used nonlocal decl_3 SI file ../src/synth_core/QDSP6/svrreg.h
line 134 col 11 size <integer_cst 0x2b359975a840 32> unit siz\
e <integer_cst 0x2b359975a4b0 4>
        align 32 offset_align 64
        offset <integer_cst 0x2b3599b04b10 constant 152> bit offset
<integer_cst 0x2b359975a840 32> context <record_type 0x2b3599b1\
2840 dlsSvrReg>
        chain <field_decl 0x2b3599b181e0 dcfMemL2 type <integer_type
0x2b35998f1e40 int32>
            used nonlocal decl_3 SI file
../src/synth_core/QDSP6/svrreg.h line 135 col 11 size <integer_cst
0x2b359975a840 32> unit\
 size <integer_cst 0x2b359975a4b0 4>
            align 32 offset_align 64
            offset <integer_cst 0x2b3599b04b70 constant 160>
            bit offset <integer_cst 0x2b359977e0c0 constant 0> context
<record_type 0x2b3599b12840 dlsSvrReg> chain <field_decl 0x2\
b3599b18280 dcfMemR1>>>>


Following this if I do
exp = TREE_OPERAND ( comp_ref_node, 0);

I get "exp" as NULL ?

Is this possible ? or Is there something I am doing wrong ? or There
is something fishy here with the tree node that MEM_EXPR is giving me
?

Thanks,
Pranav



More information about the Gcc mailing list