arith_idioms.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include <vector>
  3. #include "idiom.h"
  4. #include "icode.h"
  5. #include <deque>
  6. struct Idiom5 : public Idiom
  7. {
  8. protected:
  9. iICODE m_icodes[2];
  10. public:
  11. virtual ~Idiom5() {}
  12. Idiom5(Function *f) : Idiom(f)
  13. {
  14. }
  15. uint8_t minimum_match_length() {return 2;}
  16. bool match(iICODE pIcode);
  17. int action();
  18. };
  19. struct Idiom6 : public Idiom
  20. {
  21. protected:
  22. iICODE m_icodes[2];
  23. public:
  24. virtual ~Idiom6() {}
  25. Idiom6(Function *f) : Idiom(f)
  26. {
  27. }
  28. uint8_t minimum_match_length() {return 2;}
  29. bool match(iICODE pIcode);
  30. int action();
  31. };
  32. struct Idiom18 : public Idiom
  33. {
  34. protected:
  35. iICODE m_icodes[4];
  36. bool m_is_dec;
  37. public:
  38. Idiom18(Function *f) : Idiom(f)
  39. {
  40. }
  41. uint8_t minimum_match_length() {return 4;}
  42. bool match(iICODE picode);
  43. int action();
  44. };
  45. struct Idiom19 : public Idiom
  46. {
  47. protected:
  48. iICODE m_icodes[2];
  49. bool m_is_dec;
  50. public:
  51. Idiom19(Function *f) : Idiom(f)
  52. {
  53. }
  54. uint8_t minimum_match_length() {return 2;}
  55. bool match(iICODE picode);
  56. int action();
  57. };
  58. struct Idiom20 : public Idiom
  59. {
  60. protected:
  61. iICODE m_icodes[4];
  62. bool m_is_dec;
  63. public:
  64. Idiom20(Function *f) : Idiom(f)
  65. {
  66. }
  67. uint8_t minimum_match_length() {return 4;}
  68. bool match(iICODE picode);
  69. int action();
  70. };