Ilya Enkovich | 28 Jun 2012 17:23
Picon

The problem with force_gimple_operand and &TARGET_MEM_REF

Hello,

I faced a problem with usage of force_gimple_operand function for
specific tree. I have a TARGET_MEM_REF tree node whose address I want
to pass as argument to the function call. I use build_fold_addr_expr
to get address tree and then pass it to force_gimple_operand which
generates strange sequence of statements.

Original mem ref: MEM[base: arr_5, index: ivtmp.130_22, step: 8, offset: 0B]

build_fold_addr_expr result: &MEM[base: dirlist_5, index:
ivtmp.130_22, step: 8, offset: 0B]

force_gimple_operand result:
D.5638_65 = MEM[base: dirlist_5, index: ivtmp.130_22, step: 8, offset: 0B];
D.5639_66 = D.5638_65;
D.5640_67 = D.5639_66;
D.5642_68 = D.5640_67;
D.5641_69 = &D.5642_68;

Code produced by force_gimple_operand is incorrect, has changed
semantics compared to original tree and fails later at gimple
verification.

Do I use wrong interfaces?

Thanks
Ilya

(Continue reading)

Richard Guenther | 29 Jun 2012 10:37
Picon

Re: The problem with force_gimple_operand and &TARGET_MEM_REF

On Thu, Jun 28, 2012 at 5:23 PM, Ilya Enkovich <enkovich.gnu <at> gmail.com> wrote:
> Hello,
>
> I faced a problem with usage of force_gimple_operand function for
> specific tree. I have a TARGET_MEM_REF tree node whose address I want
> to pass as argument to the function call. I use build_fold_addr_expr
> to get address tree and then pass it to force_gimple_operand which
> generates strange sequence of statements.
>
> Original mem ref: MEM[base: arr_5, index: ivtmp.130_22, step: 8, offset: 0B]
>
> build_fold_addr_expr result: &MEM[base: dirlist_5, index:
> ivtmp.130_22, step: 8, offset: 0B]
>
> force_gimple_operand result:
> D.5638_65 = MEM[base: dirlist_5, index: ivtmp.130_22, step: 8, offset: 0B];
> D.5639_66 = D.5638_65;
> D.5640_67 = D.5639_66;
> D.5642_68 = D.5640_67;
> D.5641_69 = &D.5642_68;
>
> Code produced by force_gimple_operand is incorrect, has changed
> semantics compared to original tree and fails later at gimple
> verification.
>
> Do I use wrong interfaces?

You cannot take the address of a TARGET_MEM_REF.

Richard.
(Continue reading)

Ilya Enkovich | 29 Jun 2012 13:34
Picon

Re: The problem with force_gimple_operand and &TARGET_MEM_REF

2012/6/29 Richard Guenther <richard.guenther <at> gmail.com>:
> On Thu, Jun 28, 2012 at 5:23 PM, Ilya Enkovich <enkovich.gnu <at> gmail.com> wrote:
>> Hello,
>>
>> I faced a problem with usage of force_gimple_operand function for
>> specific tree. I have a TARGET_MEM_REF tree node whose address I want
>> to pass as argument to the function call. I use build_fold_addr_expr
>> to get address tree and then pass it to force_gimple_operand which
>> generates strange sequence of statements.
>>
>> Original mem ref: MEM[base: arr_5, index: ivtmp.130_22, step: 8, offset: 0B]
>>
>> build_fold_addr_expr result: &MEM[base: dirlist_5, index:
>> ivtmp.130_22, step: 8, offset: 0B]
>>
>> force_gimple_operand result:
>> D.5638_65 = MEM[base: dirlist_5, index: ivtmp.130_22, step: 8, offset: 0B];
>> D.5639_66 = D.5638_65;
>> D.5640_67 = D.5639_66;
>> D.5642_68 = D.5640_67;
>> D.5641_69 = &D.5642_68;
>>
>> Code produced by force_gimple_operand is incorrect, has changed
>> semantics compared to original tree and fails later at gimple
>> verification.
>>
>> Do I use wrong interfaces?
>
> You cannot take the address of a TARGET_MEM_REF.
>
(Continue reading)


Gmane