* fixed check to determine whether a record parameter can be subscripted

directly in inline assembly: that's only possible if it's a register
    parameter where the address of the record was passed (rather than the
    record itself)

git-svn-id: trunk@35424 -
This commit is contained in:
Jonas Maebe 2017-02-11 19:57:08 +00:00
parent dc500f7276
commit 4d9617da97
9 changed files with 27 additions and 18 deletions

View File

@ -58,7 +58,7 @@ Unit racpugas;
symconst,symsym,
procinfo,
rabase,rautils,
cgbase,cgutils;
cgbase,cgutils,paramgr;
function taarch64attreader.is_register(const s:string):boolean;
@ -609,7 +609,8 @@ Unit racpugas;
if hasdot and
(not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -68,7 +68,7 @@ Unit raarmgas;
symconst,symsym,
procinfo,
rabase,rautils,
cgbase,cgutils;
cgbase,cgutils,paramgr;
function tarmunifiedattreader.is_unified: boolean;
@ -636,7 +636,8 @@ Unit raarmgas;
if hasdot and
(not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -59,7 +59,7 @@ Unit raavrgas;
procinfo,
itcpugas,
rabase,rautils,
cgbase,cgutils,cgobj
cgbase,cgutils,cgobj,paramgr
;
@ -260,7 +260,8 @@ Unit raavrgas;
if hasdot and
(not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -60,7 +60,7 @@ Interface
rabase,
rgbase,
itcpugas,
cgobj
cgobj,paramgr
;
@ -169,7 +169,8 @@ Interface
if hasdot and
(not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -56,7 +56,7 @@ Unit rappcgas;
{ parser }
procinfo,
rabase,rautils,
cgbase,cgobj,cgppc
cgbase,cgobj,cgppc,paramgr
;
procedure tppcattreader.ReadSym(oper : tppcoperand);
@ -341,7 +341,8 @@ Unit rappcgas;
if hasdot and
(not oper.hastype) and
(tabstractvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -58,7 +58,7 @@ uses
{ parser }
procinfo,
rabase, rautils,
cgbase, cgobj, cgppc
cgbase, cgobj, cgppc, paramgr
;
procedure tppcattreader.ReadSym(oper: tppcoperand);
@ -352,7 +352,8 @@ var
(not oper.hastype) and
(tabstractvarsym(oper.opr.localsym).owner.symtabletype =
parasymtable) and
(current_procinfo.procdef.proccalloption <> pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs, l)
end;

View File

@ -57,7 +57,7 @@ Interface
scanner,
procinfo,
rabase,rautils,
cgobj
cgobj,paramgr
;
@ -222,7 +222,8 @@ Interface
if hasdot and
(not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l)
end;

View File

@ -68,7 +68,7 @@ Implementation
scanner,
procinfo,
itcpugas,
rabase,
rabase,paramgr,
cgbase
;
@ -461,7 +461,8 @@ Implementation
if hasdot and
(not oper.hastype) and
(oper.opr.localsym.owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l);
inc(oper.opr.localconstoffset,l);

View File

@ -91,7 +91,7 @@ Unit Rax86int;
{ register allocator }
rabase,rautils,itx86int,
{ codegen }
cgbase,cgobj,procinfo
cgbase,cgobj,procinfo,paramgr
;
type
@ -1722,7 +1722,8 @@ Unit Rax86int;
and when the parameter is in a register (delphi compatible) }
if (not oper.hastype) and
(oper.opr.localsym.owner.symtabletype=parasymtable) and
(current_procinfo.procdef.proccalloption<>pocall_register) then
((oper.opr.localsym.localloc.loc<>LOC_REGISTER) or
not paramanager.push_addr_param(oper.opr.localsym.varspez,oper.opr.localsym.vardef,current_procinfo.procdef.proccalloption)) then
Message(asmr_e_cannot_access_field_directly_for_parameters);
oper.opr.localforceref:=true;