mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-27 01:54:41 +01:00
+ support to parse hi8/lo8(...) in inline assembler
git-svn-id: trunk@18009 -
This commit is contained in:
parent
e18d5e1f61
commit
98d3007580
@ -324,6 +324,8 @@ Unit raavrgas;
|
|||||||
hl : tasmlabel;
|
hl : tasmlabel;
|
||||||
ofs : longint;
|
ofs : longint;
|
||||||
registerset : tcpuregisterset;
|
registerset : tcpuregisterset;
|
||||||
|
tempstr : string;
|
||||||
|
tempsymtyp : tasmsymtype;
|
||||||
Begin
|
Begin
|
||||||
expr:='';
|
expr:='';
|
||||||
case actasmtoken of
|
case actasmtoken of
|
||||||
@ -355,16 +357,43 @@ Unit raavrgas;
|
|||||||
|
|
||||||
AS_ID: { A constant expression, or a Variable ref. }
|
AS_ID: { A constant expression, or a Variable ref. }
|
||||||
Begin
|
Begin
|
||||||
|
if (actasmpattern='LO8') or (actasmpattern='HI8') then
|
||||||
|
begin
|
||||||
|
{ Low or High part of a constant (or constant
|
||||||
|
memory location) }
|
||||||
|
oper.InitRef;
|
||||||
|
if actasmpattern='LO8' then
|
||||||
|
oper.opr.ref.refaddr:=addr_lo8
|
||||||
|
else
|
||||||
|
oper.opr.ref.refaddr:=addr_hi8;
|
||||||
|
Consume(actasmtoken);
|
||||||
|
Consume(AS_LPAREN);
|
||||||
|
BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
|
||||||
|
if not assigned(oper.opr.ref.symbol) then
|
||||||
|
oper.opr.ref.symbol:=current_asmdata.RefAsmSymbol(tempstr)
|
||||||
|
else
|
||||||
|
Message(asmr_e_cant_have_multiple_relocatable_symbols);
|
||||||
|
case oper.opr.typ of
|
||||||
|
OPR_CONSTANT :
|
||||||
|
inc(oper.opr.val,l);
|
||||||
|
OPR_LOCAL :
|
||||||
|
inc(oper.opr.localsymofs,l);
|
||||||
|
OPR_REFERENCE :
|
||||||
|
inc(oper.opr.ref.offset,l);
|
||||||
|
else
|
||||||
|
internalerror(200309202);
|
||||||
|
end;
|
||||||
|
Consume(AS_RPAREN);
|
||||||
|
end
|
||||||
{ Local Label ? }
|
{ Local Label ? }
|
||||||
if is_locallabel(actasmpattern) then
|
else if is_locallabel(actasmpattern) then
|
||||||
begin
|
begin
|
||||||
CreateLocalLabel(actasmpattern,hl,false);
|
CreateLocalLabel(actasmpattern,hl,false);
|
||||||
Consume(AS_ID);
|
Consume(AS_ID);
|
||||||
AddLabelOperand(hl);
|
AddLabelOperand(hl);
|
||||||
end
|
end
|
||||||
else
|
{ Check for label }
|
||||||
{ Check for label }
|
else if SearchLabel(actasmpattern,hl,false) then
|
||||||
if SearchLabel(actasmpattern,hl,false) then
|
|
||||||
begin
|
begin
|
||||||
Consume(AS_ID);
|
Consume(AS_ID);
|
||||||
AddLabelOperand(hl);
|
AddLabelOperand(hl);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user