n8086cnv.pas 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. Generate code for i8086 assembler for type converting 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 n8086cnv;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. node,ncgcnv,nx86cnv,defutil,defcmp;
  22. type
  23. { t8086typeconvnode }
  24. t8086typeconvnode = class(tx86typeconvnode)
  25. protected
  26. function typecheck_proc_to_procvar: tnode;override;
  27. procedure second_proc_to_procvar;override;
  28. end;
  29. implementation
  30. uses
  31. verbose,systems,globals,globtype,
  32. aasmbase,aasmtai,aasmdata,aasmcpu,
  33. symconst,symdef,symcpu,
  34. cgbase,cga,procinfo,pass_1,pass_2,
  35. ncon,ncal,ncnv,
  36. cpubase,cpuinfo,
  37. cgutils,cgobj,hlcgobj,cgx86,ncgutil,
  38. tgobj;
  39. function t8086typeconvnode.typecheck_proc_to_procvar: tnode;
  40. begin
  41. if (current_settings.x86memorymodel in x86_far_code_models) and
  42. not is_proc_far(tabstractprocdef(left.resultdef)) then
  43. CGMessage1(type_e_procedure_must_be_far,left.resultdef.GetTypeName);
  44. Result:=inherited typecheck_proc_to_procvar;
  45. end;
  46. procedure t8086typeconvnode.second_proc_to_procvar;
  47. begin
  48. if is_proc_far(tabstractprocdef(resultdef))<>
  49. (current_settings.x86memorymodel in x86_far_code_models) then
  50. internalerror(2014041302);
  51. if is_proc_far(tabstractprocdef(left.resultdef))<>
  52. (current_settings.x86memorymodel in x86_far_code_models) then
  53. internalerror(2014041303);
  54. inherited;
  55. end;
  56. begin
  57. ctypeconvnode:=t8086typeconvnode
  58. end.