does TARGET_MEM_REF documentation need updating?
Richard Biener
richard.guenther@gmail.com
Thu Nov 4 07:25:55 GMT 2021
On Wed, Nov 3, 2021 at 7:26 PM Martin Sebor via Gcc <gcc@gcc.gnu.org> wrote:
>
> The manual says that the first argument of a TARGET_MEM_REF
>
> "is @code{TMR_SYMBOL} and must be a @code{VAR_DECL} of an object
> with a fixed address."
>
> The TARGET_MEM_REF below has as its first argument an ADDR_EXPR
> and not a VAR_DECL as the manual claims. The code I looked at
> seems to be prepared for the first argument to be pretty much
> any address, including an SSA_NAME. What should the manual be
> updated to, to make it accurate?
>
> The description also says:
>
> The second argument is @code{TMR_BASE} and the third one is
> @code{TMR_INDEX}.
>
> and gives the formula below to compute its address:
>
> &TMR_SYMBOL + TMR_BASE + TMR_INDEX * TMR_STEP + TMR_OFFSET
>
> The second argument of my TARGET_MEM_REF is a pointer and not
> something I'd expect to see added to the address of something.
> Is the second argument meant to have a dual purpose like in
> a MEM_REF?
The docs are out of date, I will update them. Yes, operands zero and one
are exactly like for MEM_REF. There's two extra offset pieces,
TMR_INDEX * TMR_STEP (operands 2 and 3) and TMR_INDEX2 (operand 3).
As usual tree.def is a better source of information.
>
> Thanks
> Martin
>
>
> <target_mem_ref 0x7fffe400f440
> type <pointer_type 0x7fffe5197738
> type <pointer_type 0x7fffe7c0fe70 tree type <union_type
> 0x7fffe7c0fd20 tree_node>
> sizes-gimplified public unsigned type_6 DI
> size <integer_cst 0x7fffea7f5f48 constant 64>
> unit-size <integer_cst 0x7fffea7f5f60 constant 8>
> align:64 warn_if_not_align:0 symtab:0 alias-set -1
> canonical-type 0x7fffe7c0fdc8
> pointer_to_this <pointer_type 0x7fffe706e888>
> reference_to_this <reference_type 0x7fffe75b3b28>>
> readonly sizes-gimplified unsigned DI size <integer_cst
> 0x7fffea7f5f48 64> unit-size <integer_cst 0x7fffea7f5f60 8>
> user align:128 warn_if_not_align:0 symtab:0 alias-set -1
> canonical-type 0x7fffe6836dc8>
> readonly
> arg:0 <addr_expr 0x7fffe63dfd60
> type <pointer_type 0x7fffe4b2d540 type <array_type 0x7fffe6836348>
> public unsigned DI size <integer_cst 0x7fffea7f5f48 64>
> unit-size <integer_cst 0x7fffea7f5f60 8>
> align:64 warn_if_not_align:0 symtab:0 alias-set -1
> canonical-type 0x7fffe4b2d540>
> readonly constant
> arg:0 <var_decl 0x7fffe6838e10 fname_vars type <array_type
> 0x7fffe6836348>
> readonly used static tree_1 tree_2 tree_6 read decl_5
> decl_6 BLK /src/gcc/trunk/gcc/c-family/c-common.c:301:26
> size <integer_cst 0x7fffea634240 constant 512>
> unit-size <integer_cst 0x7fffe90db720 constant 64>
> align:256 warn_if_not_align:0 context
> <translation_unit_decl 0x7fffea803168 /build/tmp/c-common.ii> initial
> <constructor 0x7fffe9614e88> chain <type_decl 0x7fffe6833a18 fname_var_t>>>
> arg:1 <integer_cst 0x7fffe480ce70 type <pointer_type
> 0x7fffe666a3f0> constant 0>
> arg:2 <ssa_name 0x7fffe559a240
> type <integer_type 0x7fffea815000 sizetype public unsigned
> type_6 DI size <integer_cst 0x7fffea7f5f48 64> unit-size <integer_cst
> 0x7fffea7f5f60 8>
> align:64 warn_if_not_align:0 symtab:0 alias-set -1
> canonical-type 0x7fffea815000 precision:64 min <integer_cst
> 0x7fffea7f5f78 0> max <integer_cst 0x7fffea7f65c0 18446744073709551615>>
> visited
> def_stmt _6 = ivtmp.4177_35 * 16;
> version:6
> ptr-info 0x7fffe63de020>>
>
More information about the Gcc
mailing list