Browse Source

+ write the end_function directive

git-svn-id: branches/wasm@46838 -
nickysn 4 years ago
parent
commit
fc96ad5afd
3 changed files with 9 additions and 2 deletions
  1. 6 2
      compiler/aasmtai.pas
  2. 2 0
      compiler/aggas.pas
  3. 1 0
      compiler/wasm32/hlcgcpu.pas

+ 6 - 2
compiler/aasmtai.pas

@@ -407,7 +407,9 @@ interface
         { for the OMF object format }
         asd_omf_linnum_line,
         { RISC-V }
-        asd_option
+        asd_option,
+        { WebAssembly }
+        asd_end_function
       );
 
       TAsmSehDirective=(
@@ -452,7 +454,9 @@ interface
         { for the OMF object format }
         'omf_line',
         { RISC-V }
-        'option'
+        'option',
+        { WebAssembly }
+        'end_function'
       );
       sehdirectivestr : array[TAsmSehDirective] of string[16]=(
         '.seh_proc','.seh_endproc',

+ 2 - 0
compiler/aggas.pas

@@ -1806,6 +1806,8 @@ implementation
         name has to be translated as well }
       if dir=asd_cpu then
         writer.AsmWrite(asminfo^.comment+' CPU ')
+      else if dir=asd_end_function then
+        writer.AsmWrite(#9#9+directivestr[dir])
       else
         writer.AsmWrite('.'+directivestr[dir]+' ');
     end;

+ 1 - 0
compiler/wasm32/hlcgcpu.pas

@@ -1707,6 +1707,7 @@ implementation
       list.Concat(taicpu.op_sym(a_set_global,current_asmdata.RefAsmSymbol(STACK_POINTER_SYM,AT_LABEL)));
 
       list.concat(taicpu.op_none(a_return));
+      list.concat(tai_directive.Create(asd_end_function,''));
     end;
 
   procedure thlcgwasm.gen_load_return_value(list: TAsmList);