narmmat.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. implementation
  28. uses
  29. globtype,systems,
  30. cutils,verbose,globals,
  31. symconst,symdef,
  32. aasmbase,aasmcpu,aasmtai,
  33. defutil,
  34. cgbase,cgobj,pass_1,pass_2,
  35. ncon,
  36. cpubase,cpuinfo,
  37. ncgutil,cgcpu,cg64f32,rgobj;
  38. {*****************************************************************************
  39. TARMNOTNODE
  40. *****************************************************************************}
  41. procedure tarmnotnode.second_boolean;
  42. var
  43. hl : tasmlabel;
  44. ins : taicpu;
  45. begin
  46. { if the location is LOC_JUMP, we do the secondpass after the
  47. labels are allocated
  48. }
  49. if left.expectloc=LOC_JUMP then
  50. begin
  51. hl:=truelabel;
  52. truelabel:=falselabel;
  53. falselabel:=hl;
  54. secondpass(left);
  55. maketojumpbool(exprasmlist,left,lr_load_regvars);
  56. hl:=truelabel;
  57. truelabel:=falselabel;
  58. falselabel:=hl;
  59. location.loc:=LOC_JUMP;
  60. end
  61. else
  62. begin
  63. secondpass(left);
  64. case left.location.loc of
  65. LOC_FLAGS :
  66. begin
  67. location_copy(location,left.location);
  68. inverse_flags(location.resflags);
  69. end;
  70. LOC_REGISTER, LOC_CREGISTER, LOC_REFERENCE, LOC_CREFERENCE :
  71. begin
  72. location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true);
  73. ins:=taicpu.op_reg_reg(A_MVN,left.location.register,left.location.register);
  74. ins.oppostfix:=PF_S;
  75. exprasmlist.concat(ins);
  76. location_release(exprasmlist,left.location);
  77. location_reset(location,LOC_FLAGS,OS_NO);
  78. location.resflags:=F_EQ;
  79. end;
  80. else
  81. internalerror(2003042401);
  82. end;
  83. end;
  84. end;
  85. begin
  86. cnotnode:=tarmnotnode;
  87. end.
  88. {
  89. $Log$
  90. Revision 1.4 2003-11-02 14:30:03 florian
  91. * fixed ARM for new reg. allocation scheme
  92. Revision 1.3 2003/08/27 00:27:56 florian
  93. + same procedure as very day: today's work on arm
  94. }