narmmat.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate ARM assembler for math 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 by
  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 narmmat;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,nmat,ncgmat;
  23. type
  24. tarmnotnode = class(tcgnotnode)
  25. procedure second_boolean;override;
  26. end;
  27. tarmunaryminusnode = class(tcgunaryminusnode)
  28. procedure second_float;override;
  29. end;
  30. implementation
  31. uses
  32. globtype,systems,
  33. cutils,verbose,globals,
  34. symconst,symdef,
  35. aasmbase,aasmcpu,aasmtai,
  36. defutil,
  37. cgbase,cgobj,cgutils,
  38. pass_1,pass_2,
  39. ncon,
  40. cpubase,cpuinfo,
  41. ncgutil,cgcpu,cg64f32,rgobj;
  42. {*****************************************************************************
  43. TARMNOTNODE
  44. *****************************************************************************}
  45. procedure tarmnotnode.second_boolean;
  46. var
  47. hl : tasmlabel;
  48. ins : taicpu;
  49. begin
  50. { if the location is LOC_JUMP, we do the secondpass after the
  51. labels are allocated
  52. }
  53. if left.expectloc=LOC_JUMP then
  54. begin
  55. hl:=truelabel;
  56. truelabel:=falselabel;
  57. falselabel:=hl;
  58. secondpass(left);
  59. maketojumpbool(exprasmlist,left,lr_load_regvars);
  60. hl:=truelabel;
  61. truelabel:=falselabel;
  62. falselabel:=hl;
  63. location.loc:=LOC_JUMP;
  64. end
  65. else
  66. begin
  67. secondpass(left);
  68. case left.location.loc of
  69. LOC_FLAGS :
  70. begin
  71. location_copy(location,left.location);
  72. inverse_flags(location.resflags);
  73. end;
  74. LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE :
  75. begin
  76. location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true);
  77. exprasmlist.concat(taicpu.op_reg_const(A_CMP,left.location.register,0));
  78. location_reset(location,LOC_FLAGS,OS_NO);
  79. location.resflags:=F_EQ;
  80. end;
  81. else
  82. internalerror(2003042401);
  83. end;
  84. end;
  85. end;
  86. {*****************************************************************************
  87. TARMUNARYMINUSNODE
  88. *****************************************************************************}
  89. procedure tarmunaryminusnode.second_float;
  90. begin
  91. secondpass(left);
  92. location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
  93. location_force_fpureg(exprasmlist,left.location,false);
  94. location:=left.location;
  95. exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF,
  96. location.register,left.location.register,0),
  97. cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
  98. end;
  99. begin
  100. cnotnode:=tarmnotnode;
  101. cunaryminusnode:=tarmunaryminusnode;
  102. end.
  103. {
  104. $Log$
  105. Revision 1.9 2004-11-01 17:41:28 florian
  106. * fixed arm compilation with cgutils
  107. * ...
  108. Revision 1.8 2004/10/24 07:54:25 florian
  109. * fixed compilation of arm compiler
  110. Revision 1.7 2004/06/20 08:55:31 florian
  111. * logs truncated
  112. Revision 1.6 2004/03/13 18:45:40 florian
  113. * floating compares fixed
  114. * unary minus for floats fixed
  115. Revision 1.5 2004/01/28 15:36:47 florian
  116. * fixed another couple of arm bugs
  117. }