This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Rename/export combine_insn_cost as insn_rtx_cost
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Jul 2004 20:13:39 -0700
- Subject: Re: [PATCH] Rename/export combine_insn_cost as insn_rtx_cost
- References: <Pine.LNX.4.44.0407161948410.11096-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
>> extern void foo(void);
>>
>> void bar(int n) { if(n) foo(); }
>
>
> The problem is two-fold. The first is that the "then" block in this
> function gets extened from just the single "call" instruction at
> .26.postreload, to include the following additional instruction by
> .28.flow2.
>
> (insn 33 32 21 1 (set (reg:DI 1 r1)
> (reg:DI 34 r35)) 5 {*movdi_internal} (nil)
> (expr_list:REG_DEAD (reg:DI 34 r35)
> (nil)))
>
> I'm guessing that this something to do with the IA-64's ABI, even
> though the function doesn't return a value?
Right, that's the ABI-required reload of the global pointer.
> In theory, this is still manageable, if-conversion can make both
> instructions conditional on the same condition, provided that the
> condition isn't modified by the first instruction. And there's
> the rub...
>
> ifcvt.c's cond_exec_process_insns calls modified_in_p to check
> whether "(eq (reg:BI 262 p6 [340]) (const_int 0 [0x0]))" is
> modified
[...]
> /* We'd like to test call_used_regs here, but rtlanal.c can't
> reference that variable due to its use in genattrtab. So
> we'll just be more conservative.
[...]
> So rather than use call_used_regs to check whether "p6" is clobbered
> by the function call, or can be used as an EPIC qualifying predicate,
> we assume the worst. I've no idea whether on IA-64 "p6" is call-saved
> or not, but the combination of above events block the transformation.
>
> Without knowing anything more about IA-64, isn't there some way of
> untangling rtlanal.c from the gen*.c programs, such that rtx_set_p
> can use call_used_regs. Perhaps an IN_GENATTRTAB macro, or linking
> a dummy call_used_regs to genattrtab.c that's initialized to true
> for all hard registers??
My immediate reaction to the above comment was 'what on earth is
genattrtab doing using rtlanal.c?' and then I went and looked and
... it isn't! rtlanal.o is not linked into genattrtab, or any other
gen* program, and egrep 'reg_set(_between)?_p' gen*.[ch] returns
nothing. So I think we could just go ahead and use call_used_regs
there.
Unfortunately, p6 *is* call-clobbered on ia64. HP's acc (which can do
this transformation) uses the call-saved p1 instead. But if-conversion
happens after register allocation, so there would be no way to get the
register allocator to do that, unless I'm missing something?
zw