nppcld.pas 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate ppc assembler for nodes that handle loads and assignments
  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 nppcld;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. node,ncgld;
  22. type
  23. tppcloadnode = class(tcgloadnode)
  24. procedure pass_2; override;
  25. end;
  26. implementation
  27. uses
  28. verbose,
  29. systems,
  30. globtype,globals,defutil,
  31. cpubase, aasmbase, aasmtai,
  32. cgutils,cgbase,cgobj,cgcpu,
  33. symconst,symsym,
  34. procinfo,
  35. nld;
  36. procedure tppcloadnode.pass_2;
  37. var
  38. l : tasmsymbol;
  39. ref : treference;
  40. symname: string;
  41. begin
  42. symname := '';
  43. case target_info.system of
  44. system_powerpc_darwin:
  45. begin
  46. case symtableentry.typ of
  47. procsym:
  48. begin
  49. if (po_external in tprocsym(symtableentry).procdef[1].procoptions) then
  50. symname := tprocsym(symtableentry).procdef[1].mangledname;
  51. end;
  52. globalvarsym:
  53. begin
  54. if ([vo_is_dll_var,vo_is_external] * tglobalvarsym(symtableentry).varoptions <> []) then
  55. symname := tglobalvarsym(symtableentry).mangledname;
  56. end;
  57. end;
  58. end;
  59. end;
  60. if (symname = '') then
  61. inherited pass_2
  62. else
  63. begin
  64. location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
  65. reference_reset_base(location.reference,cg.getaddressregister(exprasmlist),0);
  66. location.reference.base := tcgppc(cg).g_darwin_indirect_sym_load(exprasmlist,symname);
  67. end;
  68. end;
  69. begin
  70. cloadnode:=tppcloadnode;
  71. end.