On Mon, Feb 25, 2013 at 11:13 AM, Bin.Cheng <amker.ch...@gmail.com> wrote:
> On Mon, Feb 25, 2013 at 5:39 PM, Richard Biener
> <richard.guent...@gmail.com> wrote:
>> On Fri, Feb 22, 2013 at 9:42 AM, Bin.Cheng <amker.ch...@gmail.com> wrote:
>>> Hi,
>>> Function get_address_cost in ivopt computes multiplied address cost
>>> with below code:
>>>
>>> First:
>>>       rat = 1;
>>>       for (i = 2; i <= MAX_RATIO; i++)
>>>     if (multiplier_allowed_in_address_p (i, mem_mode, as))
>>>       {
>>>         rat = i;
>>>         break;
>>>       }
>>>
>>> Then:
>>>       if (rat_p)
>>>         addr = gen_rtx_fmt_ee (MULT, address_mode, addr,
>>>                    gen_int_mode (rat, address_mode));
>>>
>>> What's the purpose of first iteration? It just finds the first allowed
>>> ratio in address, causing the generated ADDR always has the minimal
>>> allowed ratio. Is it right?
>>
>> Looks like so.
>>
>>> For target doesn't support multiplied address, the generated ADDR is:
>>> (MULT reg, 1). The cost generally is equal to address with pure
>>> register. What's the meaning of this cost?
>>
>> Look at its uses.
>
> Thanks, now I understand that it calculates representative cost for
> multiplied address, then uses it later. Doesn't matter which ratio is
> used generally.
>
> Another question about multiplied address is in function
> multiplier_allowed_in_address_p, it constructs rtx like "(MULT reg1,
> ratio)" and let backend determine whether multiplied address is
> allowed. I suspect the code is implemented/tested on x86, since
> machine like ARM only supports multiplied address with non-null base
> register, like "base + reg * index". The code causes multiplied
> address disabled totally for ARM machine.
> Any comments?

Well - enhance it.  Best without the need to construct an RTX in the
first place ;)

Richard.

> Thanks
>
>
> --
> Best Regards.

Reply via email to