nwasmbas.pas 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {
  2. Copyright (c) 2021 by Nikolay Nikolov
  3. This unit implements code generation for some basic nodes on the
  4. WebAssembly target.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit nwasmbas;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. nbas,ncgbas;
  23. type
  24. { twasmblocknode }
  25. twasmblocknode=class(tcgblocknode)
  26. procedure pass_generate_code; override;
  27. end;
  28. implementation
  29. uses
  30. aasmdata,aasmcpu,
  31. cpubase,
  32. hlcgobj,hlcgcpu,
  33. node;
  34. { twasmblocknode }
  35. procedure twasmblocknode.pass_generate_code;
  36. begin
  37. if nf_block_with_exit in flags then
  38. begin
  39. current_asmdata.CurrAsmList.concat(taicpu.op_none(a_block));
  40. end;
  41. inherited pass_generate_code;
  42. if nf_block_with_exit in flags then
  43. begin
  44. current_asmdata.CurrAsmList.concat(taicpu.op_none(a_end_block));
  45. end;
  46. end;
  47. begin
  48. cblocknode:=twasmblocknode;
  49. end.