瀏覽代碼

+ first attempt at writing the .local WASM directive

git-svn-id: branches/wasm@46709 -
nickysn 4 年之前
父節點
當前提交
f95d35340c
共有 2 個文件被更改,包括 13 次插入1 次删除
  1. 11 1
      compiler/aggas.pas
  2. 2 0
      compiler/wasm32/itcpugas.pas

+ 11 - 1
compiler/aggas.pas

@@ -118,6 +118,9 @@ implementation
 {$ifdef m68k}
       cpuinfo,aasmcpu,
 {$endif m68k}
+{$ifdef wasm}
+      aasmcpu,
+{$endif wasm}
       cpubase,objcasm;
 
     const
@@ -1552,7 +1555,14 @@ implementation
 {$ifdef WASM}
            ait_local:
              begin
-               writer.AsmWriteLn(asminfo^.comment+'TODO: ait_local');
+               writer.AsmWrite(#9'.local'#9);
+               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;
              end;
            ait_importexport:
              begin

+ 2 - 0
compiler/wasm32/itcpugas.pas

@@ -84,6 +84,8 @@ interface
       'grow_memory', 'current_memory'
     );
 
+    gas_wasm_basic_type_str : array [TWasmBasicType] of string = ('i32','i64','f32','f64');
+
     function gas_regname(r:Tregister):string;