Browse Source

* 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 -

Jonas Maebe 8 years ago
parent
commit
4d9617da97

+ 3 - 2
compiler/aarch64/racpugas.pas

@@ -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;

+ 3 - 2
compiler/arm/raarmgas.pas

@@ -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;

+ 3 - 2
compiler/avr/raavrgas.pas

@@ -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;

+ 3 - 2
compiler/mips/racpugas.pas

@@ -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;

+ 3 - 2
compiler/powerpc/rappcgas.pas

@@ -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;

+ 3 - 2
compiler/powerpc64/rappcgas.pas

@@ -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;

+ 3 - 2
compiler/sparc/racpugas.pas

@@ -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;

+ 3 - 2
compiler/x86/rax86att.pas

@@ -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);

+ 3 - 2
compiler/x86/rax86int.pas

@@ -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;