* 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, symconst,symsym,
procinfo, procinfo,
rabase,rautils, rabase,rautils,
cgbase,cgutils; cgbase,cgutils,paramgr;
function taarch64attreader.is_register(const s:string):boolean; function taarch64attreader.is_register(const s:string):boolean;
@ -609,7 +609,8 @@ Unit racpugas;
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -68,7 +68,7 @@ Unit raarmgas;
symconst,symsym, symconst,symsym,
procinfo, procinfo,
rabase,rautils, rabase,rautils,
cgbase,cgutils; cgbase,cgutils,paramgr;
function tarmunifiedattreader.is_unified: boolean; function tarmunifiedattreader.is_unified: boolean;
@ -636,7 +636,8 @@ Unit raarmgas;
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -59,7 +59,7 @@ Unit raavrgas;
procinfo, procinfo,
itcpugas, itcpugas,
rabase,rautils, rabase,rautils,
cgbase,cgutils,cgobj cgbase,cgutils,cgobj,paramgr
; ;
@ -260,7 +260,8 @@ Unit raavrgas;
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -60,7 +60,7 @@ Interface
rabase, rabase,
rgbase, rgbase,
itcpugas, itcpugas,
cgobj cgobj,paramgr
; ;
@ -169,7 +169,8 @@ Interface
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -56,7 +56,7 @@ Unit rappcgas;
{ parser } { parser }
procinfo, procinfo,
rabase,rautils, rabase,rautils,
cgbase,cgobj,cgppc cgbase,cgobj,cgppc,paramgr
; ;
procedure tppcattreader.ReadSym(oper : tppcoperand); procedure tppcattreader.ReadSym(oper : tppcoperand);
@ -341,7 +341,8 @@ Unit rappcgas;
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -58,7 +58,7 @@ uses
{ parser } { parser }
procinfo, procinfo,
rabase, rautils, rabase, rautils,
cgbase, cgobj, cgppc cgbase, cgobj, cgppc, paramgr
; ;
procedure tppcattreader.ReadSym(oper: tppcoperand); procedure tppcattreader.ReadSym(oper: tppcoperand);
@ -352,7 +352,8 @@ var
(not oper.hastype) and (not oper.hastype) and
(tabstractvarsym(oper.opr.localsym).owner.symtabletype = (tabstractvarsym(oper.opr.localsym).owner.symtabletype =
parasymtable) and 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs, l) inc(oper.opr.localsymofs, l)
end; end;

View File

@ -57,7 +57,7 @@ Interface
scanner, scanner,
procinfo, procinfo,
rabase,rautils, rabase,rautils,
cgobj cgobj,paramgr
; ;
@ -222,7 +222,8 @@ Interface
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(tabstractnormalvarsym(oper.opr.localsym).owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l) inc(oper.opr.localsymofs,l)
end; end;

View File

@ -68,7 +68,7 @@ Implementation
scanner, scanner,
procinfo, procinfo,
itcpugas, itcpugas,
rabase, rabase,paramgr,
cgbase cgbase
; ;
@ -461,7 +461,8 @@ Implementation
if hasdot and if hasdot and
(not oper.hastype) and (not oper.hastype) and
(oper.opr.localsym.owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
inc(oper.opr.localsymofs,l); inc(oper.opr.localsymofs,l);
inc(oper.opr.localconstoffset,l); inc(oper.opr.localconstoffset,l);

View File

@ -91,7 +91,7 @@ Unit Rax86int;
{ register allocator } { register allocator }
rabase,rautils,itx86int, rabase,rautils,itx86int,
{ codegen } { codegen }
cgbase,cgobj,procinfo cgbase,cgobj,procinfo,paramgr
; ;
type type
@ -1722,7 +1722,8 @@ Unit Rax86int;
and when the parameter is in a register (delphi compatible) } and when the parameter is in a register (delphi compatible) }
if (not oper.hastype) and if (not oper.hastype) and
(oper.opr.localsym.owner.symtabletype=parasymtable) 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); Message(asmr_e_cannot_access_field_directly_for_parameters);
oper.opr.localforceref:=true; oper.opr.localforceref:=true;