arith_idioms.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /* type of variable: 1 = reg-var, 2 = local */
  38. int m_idiom_type;
  39. public:
  40. Idiom18(Function *f) : Idiom(f)
  41. {
  42. }
  43. uint8_t minimum_match_length() {return 4;}
  44. bool match(iICODE picode);
  45. int action();
  46. };
  47. struct Idiom19 : public Idiom
  48. {
  49. protected:
  50. iICODE m_icodes[2];
  51. bool m_is_dec;
  52. public:
  53. Idiom19(Function *f) : Idiom(f)
  54. {
  55. }
  56. uint8_t minimum_match_length() {return 2;}
  57. bool match(iICODE picode);
  58. int action();
  59. };
  60. struct Idiom20 : public Idiom
  61. {
  62. protected:
  63. iICODE m_icodes[4];
  64. condNodeType m_is_dec;
  65. public:
  66. Idiom20(Function *f) : Idiom(f)
  67. {
  68. }
  69. uint8_t minimum_match_length() {return 4;}
  70. bool match(iICODE picode);
  71. int action();
  72. };