2
0

optbase.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by the Free Pascal development team
  4. This routine contains the basic tables and information
  5. for the generic optimizers and cpu specific optimizations.
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. {# This unit should define cpu specific information which is required
  20. for the optimizers.
  21. }
  22. unit optbase;
  23. interface
  24. uses cpuinfo, cpubase;
  25. {*****************************************************************************
  26. Opcode propeties (needed for optimizer)
  27. *****************************************************************************}
  28. {$ifndef NOOPT}
  29. Type
  30. {What an instruction can change}
  31. TInsChange = (Ch_None,
  32. {Read from a register}
  33. Ch_REAX, Ch_RECX, Ch_REDX, Ch_REBX, Ch_RESP, Ch_REBP, Ch_RESI, Ch_REDI,
  34. {write from a register}
  35. Ch_WEAX, Ch_WECX, Ch_WEDX, Ch_WEBX, Ch_WESP, Ch_WEBP, Ch_WESI, Ch_WEDI,
  36. {read and write from/to a register}
  37. Ch_RWEAX, Ch_RWECX, Ch_RWEDX, Ch_RWEBX, Ch_RWESP, Ch_RWEBP, Ch_RWESI, Ch_RWEDI,
  38. {modify the contents of a register with the purpose of using
  39. this changed content afterwards (add/sub/..., but e.g. not rep
  40. or movsd)}
  41. Ch_MEAX, Ch_MECX, Ch_MEDX, Ch_MEBX, Ch_MESP, Ch_MEBP, Ch_MESI, Ch_MEDI,
  42. Ch_CDirFlag {clear direction flag}, Ch_SDirFlag {set dir flag},
  43. Ch_RFlags, Ch_WFlags, Ch_RWFlags, Ch_FPU,
  44. Ch_Rop1, Ch_Wop1, Ch_RWop1,Ch_Mop1,
  45. Ch_Rop2, Ch_Wop2, Ch_RWop2,Ch_Mop2,
  46. Ch_Rop3, Ch_WOp3, Ch_RWOp3,Ch_Mop3,
  47. Ch_WMemEDI,
  48. Ch_All
  49. );
  50. const
  51. MaxCh = 3; { Max things a instruction can change }
  52. type
  53. TInsProp = packed record
  54. Ch : Array[1..MaxCh] of TInsChange;
  55. end;
  56. const
  57. InsProp : array[tasmop] of TInsProp =
  58. {$i i386prop.inc}
  59. {$endif NOOPT}
  60. implementation
  61. end.
  62. {
  63. $Log$
  64. Revision 1.2 2002-05-12 16:53:18 peter
  65. * moved entry and exitcode to ncgutil and cgobj
  66. * foreach gets extra argument for passing local data to the
  67. iterator function
  68. * -CR checks also class typecasts at runtime by changing them
  69. into as
  70. * fixed compiler to cycle with the -CR option
  71. * fixed stabs with elf writer, finally the global variables can
  72. be watched
  73. * removed a lot of routines from cga unit and replaced them by
  74. calls to cgobj
  75. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  76. u32bit then the other is typecasted also to u32bit without giving
  77. a rangecheck warning/error.
  78. * fixed pascal calling method with reversing also the high tree in
  79. the parast, detected by tcalcst3 test
  80. Revision 1.1 2002/04/20 21:50:14 carl
  81. + optimization cpu specific information base file
  82. }