hlcgcpu.pas 2.6 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. aasmdata,
  24. symdef,
  25. hlcg2ll;
  26. type
  27. thlcgcpu = class(thlcg2ll)
  28. procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override;
  29. end;
  30. procedure create_hlcodegen;
  31. implementation
  32. uses
  33. hlcgobj,
  34. aasmbase,aasmtai,
  35. cgcpu,
  36. symconst,
  37. verbose,fmodule,cutils;
  38. procedure thlcgcpu.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);
  39. var
  40. make_global: Boolean;
  41. begin
  42. if not(procdef.proctypeoption in [potype_function,potype_procedure]) then
  43. Internalerror(200006137);
  44. if not assigned(procdef.struct) or
  45. (procdef.procoptions*[po_classmethod, po_staticmethod,
  46. po_methodpointer, po_interrupt, po_iocheck]<>[]) then
  47. Internalerror(200006138);
  48. if procdef.owner.symtabletype<>ObjectSymtable then
  49. Internalerror(200109191);
  50. make_global:=false;
  51. if (not current_module.is_unit) or
  52. create_smartlink or
  53. (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
  54. make_global:=true;
  55. if make_global then
  56. List.concat(Tai_symbol.Createname_global(labelname,AT_FUNCTION,0,procdef))
  57. else
  58. List.concat(Tai_symbol.Createname_hidden(labelname,AT_FUNCTION,0,procdef));
  59. list.Concat(tai_comment.Create(strpnew('WARNING! not implemented: g_intf_wrapper')));
  60. end;
  61. procedure create_hlcodegen;
  62. begin
  63. hlcg:=thlcgcpu.create;
  64. create_codegen;
  65. end;
  66. begin
  67. chlcgobj:=thlcgcpu;
  68. end.