* patch by Christo Crause: combine code paths for avr1 and avrtiny when converting lds/sts to in/out, resolves #36697

git-svn-id: trunk@44163 -
(cherry picked from commit fd4fb5fa19)
This commit is contained in:
florian 2020-02-12 20:43:13 +00:00
parent 32e17c5114
commit b65e3288aa

View File

@ -509,62 +509,34 @@ implementation
end; end;
A_STS: A_STS:
begin begin
{ certain cpu types do not support some instructions, so replace them } if current_settings.cputype in [cpu_avrtiny, cpu_avr1] then
case current_settings.cputype of
cpu_avr1:
begin
with taicpu(curtai).oper[0]^ do 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 if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
begin begin
taicpu(curtai).opcode:=A_OUT; taicpu(curtai).opcode:=A_OUT;
taicpu(curtai).loadconst(0,ref^.offset); taicpu(curtai).loadconst(0,ref^.offset);
end end
else else if current_settings.cputype=cpu_avr1 then
begin begin
remove_instruction; remove_instruction;
result:=false; result:=false;
end; end;
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: A_LDS:
begin begin
{ certain cpu types do not support some instructions, so replace them } if current_settings.cputype in [cpu_avrtiny, cpu_avr1] then
case current_settings.cputype of
cpu_avr1:
begin
with taicpu(curtai).oper[1]^ do 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 if (ref^.base=NR_NO) and (ref^.index=NR_NO) and (ref^.symbol=nil) and (ref^.offset<$40) then
begin begin
taicpu(curtai).opcode:=A_IN; taicpu(curtai).opcode:=A_IN;
taicpu(curtai).loadconst(1,ref^.offset) taicpu(curtai).loadconst(1,ref^.offset)
end end
else else if current_settings.cputype=cpu_avr1 then
begin begin
remove_instruction; remove_instruction;
result:=false; result:=false;
end; end;
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_SBIW,
A_MULS, A_MULS,
A_ICALL, A_ICALL,