ni86mem.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate i386/i8086 assembler for memory related nodes
  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 ni86mem;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globtype,
  22. cgbase,cpuinfo,cpubase,
  23. node,nmem,ncgmem,nx86mem;
  24. type
  25. ti86addrnode = class(tcgaddrnode)
  26. protected
  27. procedure set_absvarsym_resultdef; virtual; abstract;
  28. function typecheck_non_proc(realsource: tnode; out res: tnode): boolean; override;
  29. end;
  30. implementation
  31. uses
  32. cutils,verbose,
  33. aasmtai,aasmdata,
  34. cgutils,cgobj,
  35. nld,
  36. symconst,symdef,symcpu;
  37. {*****************************************************************************
  38. TI86ADDRNODE
  39. *****************************************************************************}
  40. function ti86addrnode.typecheck_non_proc(realsource: tnode; out res: tnode): boolean;
  41. begin
  42. res:=nil;
  43. { if we are getting the address of an absolute sym, check whether it's
  44. a near or a far pointer }
  45. if (realsource.nodetype=loadn) and
  46. ((tloadnode(realsource).symtableentry.typ=absolutevarsym) and
  47. tcpuabsolutevarsym(tloadnode(realsource).symtableentry).absseg) then
  48. begin
  49. set_absvarsym_resultdef;
  50. result:=true;
  51. end
  52. else
  53. result:=inherited;
  54. end;
  55. end.