Преглед на файлове

* group tai_local directives, so that they are output as a single directive with comma separated types

git-svn-id: branches/wasm@46714 -
nickysn преди 5 години
родител
ревизия
35e83d5524
променени са 3 файла, в които са добавени 20 реда и са изтрити 7 реда
  1. 6 7
      compiler/aggas.pas
  2. 2 0
      compiler/wasm32/aasmcpu.pas
  3. 12 0
      compiler/wasm32/cpupi.pas

+ 6 - 7
compiler/aggas.pas

@@ -1587,14 +1587,13 @@ implementation
 {$ifdef WASM}
            ait_local:
              begin
-               writer.AsmWrite(#9'.local'#9);
+               if tai_local(hp).first then
+                 writer.AsmWrite(#9'.local'#9)
+               else
+                 writer.AsmWrite(', ');
                writer.AsmWrite(gas_wasm_basic_type_str[tai_local(hp).bastyp]);
-               if tai_local(hp).name<>'' then
-                 begin
-                   writer.AsmWrite(#9+asminfo^.comment);
-                   writer.AsmWrite(tai_local(hp).name);
-                 end;
-               writer.AsmLn;
+               if tai_local(hp).last then
+                 writer.AsmLn;
              end;
            ait_functype:
              WriteFuncType(tai_functype(hp));

+ 2 - 0
compiler/wasm32/aasmcpu.pas

@@ -105,6 +105,8 @@ uses
       tai_local = class(tai)
         bastyp: TWasmBasicType;
         name : string;
+        first: boolean;
+        last: boolean;
         constructor create(abasictype: TWasmBasicType; const aname: string = '');
       end;
 

+ 12 - 0
compiler/wasm32/cpupi.pas

@@ -71,6 +71,7 @@ implementation
       var
        templist : TAsmList;
        l : TWasmLocal;
+       first_tai_local, last_tai_local: tai_local;
       begin
         templist := TAsmList.create;
         l := ttgwasm(tg).localvars.first;
@@ -81,6 +82,17 @@ implementation
         aktproccode.insertListBefore(findfirst_tai_local(aktproccode),templist);
         templist.Free;
 
+        first_tai_local:=findfirst_tai_local(aktproccode);
+        if assigned(first_tai_local) then
+          begin
+            first_tai_local.first:=true;
+            { also find the last tai_local in the group }
+            last_tai_local:=first_tai_local;
+            while assigned(last_tai_local.Next) and (tai(last_tai_local.Next).typ=ait_local) do
+              last_tai_local:=tai_local(last_tai_local.Next);
+            last_tai_local.last:=true;
+          end;
+
         inherited postprocess_code;
       end;