aoptcpu.pas 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {
  2. Copyright (c) 1998-2002 by Jonas Maebe, member of the Free Pascal
  3. Development Team
  4. This unit implements the RiscV64 optimizer object
  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 aoptcpu;
  19. interface
  20. {$I fpcdefs.inc}
  21. {$ifdef EXTDEBUG}
  22. {$define DEBUG_AOPTCPU}
  23. {$endif EXTDEBUG}
  24. uses
  25. cpubase,
  26. globals, globtype,
  27. cgbase,
  28. aoptobj, aoptcpub, aopt, aoptcpurv,
  29. aasmtai, aasmcpu;
  30. type
  31. TCpuAsmOptimizer = class(TRVCpuAsmOptimizer)
  32. { uses the same constructor as TAopObj }
  33. function PeepHoleOptPass1Cpu(var p: tai): boolean; override;
  34. function PostPeepHoleOptsCpu(var p: tai): boolean; override;
  35. end;
  36. implementation
  37. uses
  38. cutils;
  39. function TCpuAsmOptimizer.PeepHoleOptPass1Cpu(var p: tai): boolean;
  40. var
  41. next1, next2: tai;
  42. l1, l2, shlcount: longint;
  43. begin
  44. result := inherited PeepHoleOptPass1Cpu(p);
  45. if result then
  46. exit;
  47. case p.typ of
  48. ait_instruction:
  49. begin
  50. {case taicpu(p).opcode of
  51. end;}
  52. end;
  53. else
  54. ;
  55. end;
  56. end;
  57. function TCpuAsmOptimizer.PostPeepHoleOptsCpu(var p: tai): boolean;
  58. var
  59. next1: tai;
  60. begin
  61. result := inherited PostPeepHoleOptsCpu(p);
  62. if result then
  63. exit;
  64. case p.typ of
  65. ait_instruction:
  66. begin
  67. end;
  68. else
  69. ;
  70. end;
  71. end;
  72. begin
  73. casmoptimizer := TCpuAsmOptimizer;
  74. end.