cga.pas 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {******************************************************************************
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  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. unit cga;
  17. {$INCLUDE fpcdefs.inc}
  18. interface
  19. uses
  20. cpuinfo,cpubase,cginfo,
  21. symconst,symtype,symdef,aasmbase,aasmtai,aasmcpu;
  22. function def_opsize(p1:tdef):topsize;
  23. function def_getreg(p1:tdef):tregister;
  24. procedure emitjmp(c:tasmcond;var l:tasmlabel);
  25. implementation
  26. uses
  27. cutils,
  28. systems,globals,verbose,
  29. cgbase,cgobj,tgobj,rgobj,rgcpu;
  30. {*****************************************************************************
  31. Helpers
  32. *****************************************************************************}
  33. function def_opsize(p1:tdef):topsize;
  34. begin
  35. case p1.size of
  36. 1:def_opsize:=S_B;
  37. 2:def_opsize:=S_W;
  38. 4:def_opsize:=S_L;
  39. 8:def_opsize:=S_L;
  40. else
  41. InternalError(130820001);
  42. end;
  43. end;
  44. function def_getreg(p1:tdef):tregister;
  45. begin
  46. with rg do
  47. def_getreg:=makeregsize(getregisterint(exprasmlist),int_cgsize(p1.size));
  48. end;
  49. {*****************************************************************************
  50. Emit Assembler
  51. *****************************************************************************}
  52. procedure emitjmp(c:tasmcond;var l:tasmlabel);
  53. var
  54. ai:taicpu;
  55. begin
  56. if c=C_None
  57. then
  58. ai:= Taicpu.Op_sym(A_JMPL,S_NO,l)
  59. else
  60. begin
  61. ai:=Taicpu.Op_sym(A_JMPL,S_NO,l);
  62. ai.SetCondition(c);
  63. end;
  64. ai.is_jmp:=true;
  65. exprasmList.concat(ai);
  66. end;
  67. end.
  68. {
  69. $Log$
  70. Revision 1.6 2002-12-25 20:59:49 mazen
  71. - many emitXXX removed from cga.pas in order to remove that file.
  72. Revision 1.5 2002/11/10 19:07:46 mazen
  73. * SPARC calling mechanism almost OK (as in GCC./mppcsparc )
  74. Revision 1.4 2002/11/06 11:31:24 mazen
  75. * op_reg_reg_reg don't need any more a TOpSize parameter
  76. Revision 1.3 2002/10/22 13:43:01 mazen
  77. - cga.pas redueced to an empty unit
  78. Revision 1.2 2002/10/13 19:47:34 mazen
  79. - logs removed
  80. Revision 1.1 2002/08/22 08:30:50 mazen
  81. first insertion 2002\08\22
  82. }