Hello,
I am a newbie in LCC, I wonder if anybody can help me out with a
problem which I think is quite fundamental. I understand that LCC=92s
ADDI is a 3 operand operation in the form
%c =3D %0 + %1
My target machine can only handle a 2 operand ADD operation (ie ADD a,
b),
a =3D a + b
I inspected the x86.md machine description from the LCC installation
and discovered they use a rule similar to
reg: ADDI4 (reg,reg) =93?mov %c,%0\nadd %c,%1\n=94
This works if the first operand is the same as the destination
register, however, this will not work if the destination register is
the same as the second operand. I notice this problem when I tried to
do the following C operation
hr =3D k + hr
(where hr and k are locals)
What do I need to do to ensure LCC will swap the operands if the
destination register is the same as the second operand instead of the
first? I tried messing around with the function target(), however it
look as if the registers are not assigned at that point yet. I tried
to swap kids[0] and kids[1] in the function clobber(), however, that
produce a move to the same register
mov a,a
add a,b
I would very much appreciate any suggestions. Thank you.
peter


|