hlcgcpu.pas 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {
  2. Copyright (c) 1998-2010 by Florian Klaempfl and Jonas Maebe
  3. Member of the Free Pascal development team
  4. This unit contains routines to create a pass-through high-level code
  5. generator. This is used by most regular code generators.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit hlcgcpu;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. symtype,
  24. aasmdata,
  25. symdef,
  26. cgbase,cgutils,
  27. hlcgobj, hlcg2ll;
  28. type
  29. thlcgxtensa = class(thlcg2ll)
  30. procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override;
  31. procedure record_generated_code_for_procdef(pd: tprocdef; code, data: TAsmList);override;
  32. end;
  33. implementation
  34. uses
  35. verbose,globtype,fmodule,
  36. aasmbase,aasmtai,
  37. symconst,symsym,defutil,
  38. cpubase,aasmcpu,parabase,
  39. cgobj,cgcpu;
  40. procedure create_hlcodegen_cpu;
  41. begin
  42. hlcg:=thlcgxtensa.create;
  43. create_codegen;
  44. end;
  45. procedure thlcgxtensa.g_intf_wrapper(list : TAsmList; procdef : tprocdef;
  46. const labelname : string; ioffset : longint);
  47. begin
  48. end;
  49. procedure thlcgxtensa.record_generated_code_for_procdef(pd : tprocdef; code,
  50. data : TAsmList);
  51. var
  52. alt : TAsmListType;
  53. begin
  54. if not(po_assembler in pd.procoptions) then
  55. alt:=al_procedures
  56. else
  57. alt:=al_pure_assembler;
  58. { Xtensa needs the data before the subroutine }
  59. if assigned(data) and
  60. (not data.empty) then
  61. begin
  62. data.Insert(tai_align.Create(4));
  63. current_asmdata.asmlists[alt].concatlist(data);
  64. end;
  65. inherited record_generated_code_for_procdef(pd,code,nil);
  66. end;
  67. begin
  68. chlcgobj:=thlcgxtensa;
  69. create_hlcodegen:=@create_hlcodegen_cpu;
  70. end.