This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch - GCC Port for Infineon xc16x
Rask Ingemann Lambertsen <rask@sygehus.dk> writes:
>> diff -Naur gcc-4.2-20060722/gcc/config/xc16x/xc16x.h gcc-4.2-20060722.orig/gcc/config/xc16x/xc16x.h
>> --- gcc-4.2-20060722/gcc/config/xc16x/xc16x.h 1970-01-01 05:30:00.000000000 +0530
>> +++ gcc-4.2-20060722.orig/gcc/config/xc16x/xc16x.h 2006-07-26 16:52:59.000000000 +0530
> [cut]
>> +#define FIXED_REGISTERS \
>> + /* r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15*/ \
>> + {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
> [cut]
>> +/* Base register for access to local variables of the function. */
>> +#define FRAME_POINTER_REGNUM 1
>
> You cannot eliminate the frame pointer if it is fixed.
AIUI, it can be eliminated even if it's fixed. The problem is that
gcc won't then reuse the register for other purposes.
>> diff -Naur gcc-4.2-20060722/gcc/config/xc16x/xc16x.md gcc-4.2-20060722.orig/gcc/config/xc16x/xc16x.md
>> --- gcc-4.2-20060722/gcc/config/xc16x/xc16x.md 1970-01-01 05:30:00.000000000 +0530
>> +++ gcc-4.2-20060722.orig/gcc/config/xc16x/xc16x.md 2006-07-26 16:52:59.000000000 +0530
> [cut]
>> +(define_expand "movqi"
>> + [(set (match_operand:QI 0 "general_operand_dst" "")
>> + (match_operand:QI 1 "general_operand_src" ""))]
>> + ""
>> + "
>> + "
>> + )
>> +
>> +(define_insn "*movqi"
>> + [(set (match_operand:QI 0 "general_operand_dst" "=r,<,b,b,m")
>> + (match_operand:QI 1 "general_operand_src" "r>,b,i,m,b"))]
>> + ""
>> + "*
>> + {
>
> Why not omit the expander and just use an insn?
> (define_insn "movqi"
> [(set (match_operand:QI 0 "general_operand_dst" "=r,<,b,b,m")
> (match_operand:QI 1 "general_operand_src" "r>,b,i,m,b"))]
> ""
> {
> ...
> }
> )
Well, standard practice here would be to force one operand to be a
register, as that's what the constraints require. See other ports
for examples. This isn't needed for correctness, but it allows gcc
to optimise the code better; the register allocator will get to see
the intermediate registers.
Richard