nllvmutil.pas 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. {
  2. Copyright (c) 20011 by Jonas Maebe
  3. LLVM version of some node tree helper routines
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit nllvmutil;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globtype,
  22. aasmdata,ngenutil,
  23. symtype,symconst,symsym,symdef;
  24. type
  25. tllvmnodeutils = class(tnodeutils)
  26. strict protected
  27. class procedure insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint); override;
  28. public
  29. class procedure InsertInitFinalTable; override;
  30. class procedure InsertWideInitsTablesTable; override;
  31. class procedure InsertWideInits; override;
  32. class procedure InsertResourceTablesTable; override;
  33. class procedure InsertResourceInfo(ResourcesUsed : boolean); override;
  34. class procedure InsertMemorySizes; override;
  35. class procedure InsertObjectInfo; override;
  36. end;
  37. implementation
  38. uses
  39. verbose,cutils,globals,fmodule,systems,
  40. aasmbase,aasmtai,cpubase,llvmbase,aasmllvm,
  41. symbase,symtable,defutil,
  42. llvmtype;
  43. class procedure tllvmnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint);
  44. var
  45. asmsym: tasmsymbol;
  46. field1, field2: tsym;
  47. begin
  48. if sym.globalasmsym then
  49. asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_GLOBAL,AT_DATA)
  50. else
  51. asmsym:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_LOCAL,AT_DATA);
  52. if not(vo_is_thread_var in sym.varoptions) then
  53. list.concat(taillvmdecl.createdef(asmsym,sym.vardef,nil,sec_data,varalign))
  54. else if tf_section_threadvars in target_info.flags then
  55. list.concat(taillvmdecl.createtls(asmsym,sym.vardef,varalign))
  56. else
  57. list.concat(taillvmdecl.createdef(asmsym,
  58. get_threadvar_record(sym.vardef,field1,field2),
  59. nil,sec_data,varalign));
  60. end;
  61. class procedure tllvmnodeutils.InsertInitFinalTable;
  62. begin
  63. { todo }
  64. end;
  65. class procedure tllvmnodeutils.InsertWideInitsTablesTable;
  66. begin
  67. { not required }
  68. end;
  69. class procedure tllvmnodeutils.InsertWideInits;
  70. begin
  71. { not required }
  72. end;
  73. class procedure tllvmnodeutils.InsertResourceTablesTable;
  74. begin
  75. { not supported }
  76. end;
  77. class procedure tllvmnodeutils.InsertResourceInfo(ResourcesUsed: boolean);
  78. begin
  79. { not supported }
  80. end;
  81. class procedure tllvmnodeutils.InsertMemorySizes;
  82. begin
  83. { not required }
  84. end;
  85. class procedure tllvmnodeutils.InsertObjectInfo;
  86. begin
  87. inherited;
  88. { add "type xx = .." statements for all used recorddefs }
  89. with TLLVMTypeInfo.Create do
  90. begin
  91. inserttypeinfo;
  92. free;
  93. end;
  94. end;
  95. begin
  96. cnodeutils:=tllvmnodeutils;
  97. end.