Storage References - GNU Compiler Collection (GCC) Internals
Description: GNU Compiler Collection (GCC) Internals

Next: Unary and Binary Expressions, Previous: Constant expressions, Up: Expression trees

#### 11.6.2 References to storage

`ARRAY_REF`
  These nodes represent array accesses. The first operand is the array; the second is the index. To calculate the address of the memory accessed, you must scale the index by the size of the type of the array elements. The type of these expressions must be the type of a component of the array. The third and fourth operands are used after gimplification to represent the lower bound and component size but should not be used directly; call `array_ref_low_bound` and `array_ref_element_size` instead.
`ARRAY_RANGE_REF`
  These nodes represent access to a range (or “slice”) of an array. The operands are the same as that for `ARRAY_REF` and have the same meanings. The type of these expressions must be an array whose component type is the same as that of the first operand. The range of that array type determines the amount of data these expressions access.
`TARGET_MEM_REF`
  These nodes represent memory accesses whose address directly map to an addressing mode of the target architecture. The first argument is `TMR_SYMBOL` and must be a `VAR_DECL` of an object with a fixed address. The second argument is `TMR_BASE` and the third one is `TMR_INDEX`. The fourth argument is `TMR_STEP` and must be an `INTEGER_CST`. The fifth argument is `TMR_OFFSET` and must be an `INTEGER_CST`. Any of the arguments may be NULL if the appropriate component does not appear in the address. Address of the `TARGET_MEM_REF` is determined in the following way.

                &TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET

  The sixth argument is the reference to the original memory access, which is preserved for the purposes of the RTL alias analysis. The seventh argument is a tag representing the results of tree level alias analysis.

`ADDR_EXPR`
  These nodes are used to represent the address of an object. (These expressions will always have pointer or reference type.) The operand may be another expression, or it may be a declaration.

  As an extension, GCC allows users to take the address of a label. In this case, the operand of the `ADDR_EXPR` will be a `LABEL_DECL`. The type of such an expression is `void*`.

  If the object addressed is not an lvalue, a temporary is created, and the address of the temporary is used.

`INDIRECT_REF`
  These nodes are used to represent the object pointed to by a pointer. The operand is the pointer being dereferenced; it will always have pointer or reference type.
`MEM_REF`
  These nodes are used to represent the object pointed to by a pointer offset by a constant. The first operand is the pointer being dereferenced; it will always have pointer or reference type. The second operand is a pointer constant. Its type is specifying the type to be used for type-based alias analysis.
`COMPONENT_REF`
  These nodes represent non-static data member accesses. The first operand is the object (rather than a pointer to it); the second operand is the `FIELD_DECL` for the data member. The third operand represents the byte offset of the field, but should not be used directly; call `component_ref_field_offset` instead.