mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 07:10:20 +02:00
* AVR: for avr1 lds/sts must be converted to in/out as well if possible
git-svn-id: trunk@44138 -
(cherry picked from commit 84cfa8d9b0
)
This commit is contained in:
parent
a589637b1d
commit
438c971460
@ -508,33 +508,61 @@ implementation
|
||||
end;
|
||||
A_STS:
|
||||
begin
|
||||
if current_settings.cputype=cpu_avr1 then
|
||||
begin
|
||||
remove_instruction;
|
||||
result:=false;
|
||||
end
|
||||
else if current_settings.cputype=cpu_avrtiny then
|
||||
with taicpu(curtai).oper[0]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_OUT;
|
||||
taicpu(curtai).loadconst(0,ref^.offset);
|
||||
end;
|
||||
{ certain cpu types do not support some instructions, so replace them }
|
||||
case current_settings.cputype of
|
||||
cpu_avr1:
|
||||
begin
|
||||
with taicpu(curtai).oper[0]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_OUT;
|
||||
taicpu(curtai).loadconst(0,ref^.offset);
|
||||
end
|
||||
else
|
||||
begin
|
||||
remove_instruction;
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
cpu_avrtiny:
|
||||
begin
|
||||
with taicpu(curtai).oper[0]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_OUT;
|
||||
taicpu(curtai).loadconst(0,ref^.offset);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
A_LDS:
|
||||
begin
|
||||
if current_settings.cputype=cpu_avr1 then
|
||||
begin
|
||||
remove_instruction;
|
||||
result:=false;
|
||||
end
|
||||
else if current_settings.cputype=cpu_avrtiny then
|
||||
with taicpu(curtai).oper[1]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_IN;
|
||||
taicpu(curtai).loadconst(1,ref^.offset)
|
||||
end;
|
||||
{ certain cpu types do not support some instructions, so replace them }
|
||||
case current_settings.cputype of
|
||||
cpu_avr1:
|
||||
begin
|
||||
with taicpu(curtai).oper[1]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_IN;
|
||||
taicpu(curtai).loadconst(1,ref^.offset)
|
||||
end
|
||||
else
|
||||
begin
|
||||
remove_instruction;
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
cpu_avrtiny:
|
||||
begin
|
||||
with taicpu(curtai).oper[1]^ do
|
||||
if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
|
||||
begin
|
||||
taicpu(curtai).opcode:=A_IN;
|
||||
taicpu(curtai).loadconst(1,ref^.offset)
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
A_SBIW,
|
||||
A_MULS,
|
||||
@ -548,6 +576,7 @@ implementation
|
||||
A_POP,
|
||||
A_PUSH:
|
||||
begin
|
||||
{ certain cpu types do not support some instructions, so replace them }
|
||||
if current_settings.cputype=cpu_avr1 then
|
||||
begin
|
||||
remove_instruction;
|
||||
|
Loading…
Reference in New Issue
Block a user