aoptcpu.pas 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. {$define DEBUG_AOPTCPU}
  22. uses
  23. cpubase,
  24. globals, globtype,
  25. cgbase,
  26. aoptobj, aoptcpub, aopt, aoptcpurv,
  27. aasmtai, aasmcpu;
  28. type
  29. TCpuAsmOptimizer = class(TRVCpuAsmOptimizer)
  30. { uses the same constructor as TAopObj }
  31. function PeepHoleOptPass1Cpu(var p: tai): boolean; override;
  32. function PostPeepHoleOptsCpu(var p: tai): boolean; override;
  33. end;
  34. implementation
  35. uses
  36. cutils;
  37. function TCpuAsmOptimizer.PeepHoleOptPass1Cpu(var p: tai): boolean;
  38. var
  39. next1, next2: tai;
  40. l1, l2, shlcount: longint;
  41. begin
  42. result := inherited PeepHoleOptPass1Cpu(p);
  43. if result then
  44. exit;
  45. case p.typ of
  46. ait_instruction:
  47. begin
  48. {case taicpu(p).opcode of
  49. end;}
  50. end;
  51. else
  52. ;
  53. end;
  54. end;
  55. function TCpuAsmOptimizer.PostPeepHoleOptsCpu(var p: tai): boolean;
  56. var
  57. next1: tai;
  58. begin
  59. result := inherited PostPeepHoleOptsCpu(p);
  60. if result then
  61. exit;
  62. case p.typ of
  63. ait_instruction:
  64. begin
  65. end;
  66. else
  67. ;
  68. end;
  69. end;
  70. begin
  71. casmoptimizer := TCpuAsmOptimizer;
  72. end.