This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: register usage



----- Original Message ----- From: "Andrew Haley" <aph@redhat.com>
To: "Petar Bajic" <petar.bajic@micronasnit.com>
Cc: <gcc-help@gcc.gnu.org>
Sent: Wednesday, July 12, 2006 2:48 PM
Subject: Re: register usage



Petar Bajic writes:
> I want to forbid compiler to use condition register for destination in > movz
> instruction
> instruction (if r3 == 0, move r2 to r1) should look like this:
> movz r1, r2, r3 (r3 condition, r2 source, r1 destination register)
> but compiler generates this
> movz r3, r2, r3
> and uses r3 further on. Wich is techincally ok, but I have this problem > with
> overwritting condition and would like to save it.
> How do I tell compiler to generate different register for destination?


Put the condition code register in a different class from the other
registers.

Andrew.


For this, I had to make two new register classes (machine has 32 regs and basicly just one reg class GENERAL_REGS)
I added two new classes: HI_REGS, and LO_REGS to "enum reg_classes" wich are lower and higher 16 regs of GENERAL_REGS.
REG_CLASS_CONTENTS is expanded with { 0xffff0000 } and { 0x0000ffff }
REG_CLASS_NAMES has two more names "HI_REGS" and "LO_REGS"


in machine.c file I modified "reg_class_from_letter" making letter 'j' and 'k' return HI_REGS and LO_REGS

in machine.md I finally wrote a rule that uses j and k regs to distinct input and output....
(define_insn "*movsicc_insn"
[(set (match_operand:SI 0 "register_operand" "=j,j")
(if_then_else:SI (match_operator 1 "comparison_operator" [(match_operand:SI 4 "register_operand" "=k,k") (const_int 0)])
(match_operand:SI 2 "register_operand" "=d,d")
(match_operand:SI 3 "register_operand" "=d,d")))]
""
"..."


and the error is:
../../gcc/libgcc2.c:785: internal compiler error: in copy_to_mode_reg, at explow.c:581


what else do I have to do for this to work?




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]