mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 22:07:12 +01:00
handle correctly "reg+const" operands in avr assembler, fixes issue #32016
git-svn-id: trunk@37328 -
This commit is contained in:
parent
b3f7bce3a6
commit
1c69ae6a15
@ -104,7 +104,7 @@ unit agavrgas;
|
||||
NR_R30:
|
||||
s:=s+'Z';
|
||||
else
|
||||
s:=gas_regname(base);
|
||||
s:=s+gas_regname(base);
|
||||
end;
|
||||
if addressmode=AM_POSTINCREMENT then
|
||||
s:=s+'+';
|
||||
@ -112,7 +112,7 @@ unit agavrgas;
|
||||
if offset>0 then
|
||||
s:=s+'+'+tostr(offset)
|
||||
else if offset<0 then
|
||||
s:=s+tostr(offset)
|
||||
s:=s+tostr(offset);
|
||||
end
|
||||
else if assigned(symbol) or (offset<>0) then
|
||||
begin
|
||||
@ -157,9 +157,8 @@ unit agavrgas;
|
||||
begin
|
||||
hs:=ReplaceForbiddenAsmSymbolChars(o.ref^.symbol.name);
|
||||
if o.ref^.offset>0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else
|
||||
if o.ref^.offset<0 then
|
||||
hs:=hs+'+'+tostr(o.ref^.offset)
|
||||
else if o.ref^.offset<0 then
|
||||
hs:=hs+tostr(o.ref^.offset);
|
||||
getopstr:=hs;
|
||||
end
|
||||
|
||||
@ -514,9 +514,19 @@ Unit raavrgas;
|
||||
oper.opr.typ:=OPR_REFERENCE;
|
||||
|
||||
reference_reset_base(oper.opr.ref,tempreg,0,1,[]);
|
||||
oper.opr.ref.addressmode:=AM_POSTINCREMENT;
|
||||
|
||||
consume(AS_PLUS);
|
||||
{ add a constant expression? }
|
||||
if actasmtoken=AS_PLUS then
|
||||
begin
|
||||
consume(AS_PLUS);
|
||||
if actasmtoken in [AS_INTNUM,AS_ID] then
|
||||
begin
|
||||
l:=BuildConstExpression(true,false);
|
||||
inc(oper.opr.ref.offset,l);
|
||||
end
|
||||
else
|
||||
oper.opr.ref.addressmode:=AM_POSTINCREMENT;
|
||||
end;
|
||||
end
|
||||
else if (actasmtoken in [AS_END,AS_SEPARATOR,AS_COMMA]) then
|
||||
Begin
|
||||
|
||||
@ -7,6 +7,7 @@ procedure test(out x: byte); assembler; nostackframe;
|
||||
asm
|
||||
movw R30, R24
|
||||
st Z, R1
|
||||
ldd r22, z+3
|
||||
end;
|
||||
|
||||
var a8: byte;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user