nppccal.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. Implements the PowerPC specific part of call nodes
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published bymethodpointer
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit nppccal;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. symdef,node,ncal,ncgcal;
  23. type
  24. tppccallnode = class(tcgcallnode)
  25. function pass_1 : tnode;override;
  26. procedure load_framepointer;override;
  27. end;
  28. implementation
  29. uses
  30. globtype,systems,
  31. cutils,verbose,globals,
  32. symconst,symbase,symsym,symtable,defutil,paramgr,
  33. {$ifdef GDB}
  34. {$ifdef delphi}
  35. sysutils,
  36. {$else}
  37. strings,
  38. {$endif}
  39. gdb,
  40. {$endif GDB}
  41. cginfo,cgbase,pass_2,
  42. cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
  43. nmem,nld,ncnv,
  44. ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpupi;
  45. function tppccallnode.pass_1 : tnode;
  46. begin
  47. result:=inherited pass_1;
  48. if assigned(result) then
  49. exit;
  50. if procdefinition is tprocdef then
  51. begin
  52. if tprocdef(procdefinition).parast.datasize>tppcprocinfo(procinfo).maxpushedparasize then
  53. tppcprocinfo(procinfo).maxpushedparasize:=tprocdef(procdefinition).parast.datasize
  54. end
  55. else
  56. begin
  57. {!!!!}
  58. end;
  59. end;
  60. procedure tppccallnode.load_framepointer;
  61. begin
  62. {
  63. if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
  64. begin
  65. reference_reset_base(href,procinfo^.framepointer,procinfo^.framepointer_offset);
  66. cg.a_param_ref(exprasmlist,OS_ADDR,href,paramanager.getframepointerloc(procinfo.procdef));
  67. end
  68. { this is only true if the difference is one !!
  69. but it cannot be more !! }
  70. else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
  71. begin
  72. cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,paramanager.getframepointerloc(procinfo.procdef));
  73. end
  74. else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
  75. begin
  76. hregister:=rg.getregisterint(exprasmlist);
  77. reference_reset_base(href,procinfo^.framepointer,procinfo^.framepointer_offset);
  78. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
  79. for i:=(tprocdef(procdefinition).parast.symtablelevel) to lexlevel-1 do
  80. begin
  81. {we should get the correct frame_pointer_offset at each level
  82. how can we do this !!! }
  83. reference_reset_base(href,hregister,procinfo^.framepointer_offset);
  84. cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
  85. end;
  86. cg.a_param_reg(exprasmlist,OS_ADDR,hregister,-1);
  87. rg.ungetregisterint(exprasmlist,hregister);
  88. end
  89. else
  90. internalerror(2002081303);
  91. }
  92. end;
  93. begin
  94. ccallnode:=tppccallnode;
  95. end.
  96. {
  97. $Log$
  98. Revision 1.4 2002-12-05 14:28:12 florian
  99. * some variant <-> dyn. array stuff
  100. Revision 1.3 2002/11/25 17:43:28 peter
  101. * splitted defbase in defutil,symutil,defcmp
  102. * merged isconvertable and is_equal into compare_defs(_ext)
  103. * made operator search faster by walking the list only once
  104. Revision 1.2 2002/08/17 09:23:49 florian
  105. * first part of procinfo rewrite
  106. Revision 1.1 2002/08/13 21:40:59 florian
  107. * more fixes for ppc calling conventions
  108. }