This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
New gcc port (ATMEL AVR) and question
- To: egcs at egcs dot cygnus dot com
- Subject: New gcc port (ATMEL AVR) and question
- From: Denis Chertykov <denis at medo dot fov dot uni-mb dot si>
- Date: Sun, 27 Dec 1998 19:55:10 +0000 (UTC)
Hello !
I'm write the gcc port for ATMEL AVR at90s8515 micro controller.
at90s8515 have 512 bytes RAM and 8Kb embedded flash program memory.
My work pretty down (avr-gcc (with some hacks) can properly compile
vsprintf (I'm get it from Linux kernel) and fp-bit.c)
Are anybody interested ?
But I have a problem.
ATMEL AVR at90s8515 have 32 8bit registers (r0,r1,r2...r31).
The 26:27 28:29 30:31 registers pair can be 16bit pointers.
Pointer names:
26:27 - X
28:29 - Y
30:31 - Z
Y and Z pointers can be used with small displacement (<=63) but X not.
I'm define:
POINTER_REGS - register class containing X,Y and Z.
BASE_POINTER_REGS - register class containing Y and Z.
And then:
#define BASE_REG_CLASS POINTER_REGS /* X,Y,Z */
#define INDEX_REG_CLASS NO_REGS /* no index registers */
GO_IF_LEGITIMATE_ADDRESS macro in strict mode disable to using
X pointer with displacement -
(plus:HI (reg:HI 26 r26) (const_int any-number)) - not allowed.
movqi,movhi,movsi looks like:
(define_expand "movqi"
[(set (match_operand:QI 0 "nonimmediate_operand" "")
(match_operand:QI 1 "general_operand" ""))]
""
"
{
/* Don't generate memory->memory moves, go through a register */
if (!(push_operand (operands[0],QImode)
&& memory_operand (operands[1], QImode)))
if ((reload_in_progress | reload_completed) == 0
&& GET_CODE (operands[0]) == MEM
&& (GET_CODE (operands[1]) == MEM || CONSTANT_P(operands[1])))
operands[1] = force_reg(QImode, operands[1]);
}")
(define_insn "*movqi_insn"
[(set (match_operand:QI 0 "general_operand" "=r,!r,d,m,r")
(match_operand:QI 1 "general_operand" "r,!L,i,r,m"))]
"(register_operand (operands[0],QImode)
|| register_operand (operands[1], QImode))"
"@
mov %0,%1
clr %0
ldi %0,low(%1)
st%K0 %0,%1
ld%K1 %0,%1"
[(set_attr "length" "1,1,1,2,2")
(set_attr "cc" "none,clobber,none,none,none")])
In the simple tests this work.
But in some cases (in difficult tests - `fp-bit.c') compiler produce
the pattern (inside the movM insn) like:
(mem:ANY-MODE (plus:HI (reg:HI 26 r26)
(const_int some-number-lower-then-63))
I'm confused. May be something wrong ?
IMHO: reload do this, but why ?
Denis.