From 4af00900c78d86ba20a3cc8c8f6d50039028eb23 Mon Sep 17 00:00:00 2001 From: jdh8d <jdh8d@git.zephyr-software.com> Date: Mon, 1 Feb 2016 15:10:39 +0000 Subject: [PATCH] revised stars_irdb_op_t::SetMem* functions to assert if called in the wrong way. Former-commit-id: 5d9b4d4244b627177a182caf9bf664003111586c --- include/interfaces/irdb/STARSOp.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/include/interfaces/irdb/STARSOp.h b/include/interfaces/irdb/STARSOp.h index 7b08eeaa..56a516a3 100644 --- a/include/interfaces/irdb/STARSOp.h +++ b/include/interfaces/irdb/STARSOp.h @@ -162,8 +162,14 @@ class STARS_IRDB_op_t : public STARS_op_t virtual void SetNotVisible(void) { assert(OpType!=op_Void); visible=0; } // Set operand to type that is implicit, not explicit in disasm - virtual void SetTypeToMemDisplacement(void) { OpType=op_Mem; } // change type during stack normalization - virtual void SetTypeToMemNoDisplacement(void) { }; // change type during stack normalization + + // this is used to change the type of a memory operand during stack normalization + virtual void SetTypeToMemDisplacement(void) { assert(IsMemDisplacementOp()); } // SetAddr(non-zero) should already be called, which implicitly does this. + + // this is used to change the type of a memory operand during stack normalization + virtual void SetTypeToMemNoDisplacement(void) { assert(OpType==op_Mem && operand.mem.base==0); } // SetAddr(0) should already have been called + + virtual void CleanOpndEncoding(void) { }; // Get rid of unnecessary SIB byte encodings, etc. // Query methods @@ -192,17 +198,6 @@ class STARS_IRDB_op_t : public STARS_op_t virtual bool MatchesReg(uint16_t RegNum) const { return OpType==op_Reg && RegNum == operand.reg.RegNum; -#if 0 - switch(OpType) - { - case op_Reg: - return RegNum == operand.reg.RegNum; - case op_Mem: - return RegNum == operand.mem.base; - default: - return false; - } -#endif } virtual bool IsNearPointer(void) const { return OpType==op_Addr; } virtual bool IsFarPointer(void) const { return false; } -- GitLab