From 2100f6c2d6876edb14b6f6bd57e0e8b3777d5519 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Fri, 2 May 2008 14:30:49 +0000
Subject: [PATCH] Increase POINTER type propagation.

---
 SMPInstr.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/SMPInstr.cpp b/SMPInstr.cpp
index 9077ae07..8e30f045 100644
--- a/SMPInstr.cpp
+++ b/SMPInstr.cpp
@@ -778,6 +778,7 @@ void SMPInstr::MDFixupDefUseLists(void) {
 	ea_t displacement;
 	bool UseFP = true;
 	bool HasIndexReg = false;
+	bool SingleAddressReg = false;
 	bool leaInst = (NN_lea == this->SMPcmd.itype);
 	bool DebugFlag = (this->GetAddr() == 0x804837b);
 	if (DebugFlag) {
@@ -796,6 +797,8 @@ void SMPInstr::MDFixupDefUseLists(void) {
 		op_t Opnd = SMPcmd.Operands[OpNum];
 		if ((Opnd.type == o_phrase) || (Opnd.type == o_displ) || (Opnd.type == o_mem)) {
 			MDExtractAddressFields(Opnd, BaseReg, IndexReg, ScaleFactor, displacement);
+			SingleAddressReg = ((0 == displacement) 
+				&& ((R_none == BaseReg) || (R_none == IndexReg)));
 			if (R_none != IndexReg) { 
 				op_t IndexOpnd = Opnd; // Init to current operand field values
 				IndexOpnd.type = o_reg; // Change type and reg fields
@@ -836,9 +839,10 @@ void SMPInstr::MDFixupDefUseLists(void) {
 				// We cannot be sure that a register is truly a base register unless
 				//  there is also an index register. E.g. with reg+displacement, we
 				//  could have memaddr+indexreg or basereg+offset, depending on what
-				//  the displacement is.
+				//  the displacement is. The exception is if there is no offset and only
+				//  one addressing register, e.g. mov eax,[ebx].
 				if (BaseOpnd.is_reg(R_sp) || (UseFP && BaseOpnd.is_reg(R_bp))
-					|| leaInst || (!HasIndexReg)) {
+					|| leaInst || (!HasIndexReg && !SingleAddressReg)) {
 					;
 				}
 				else {
-- 
GitLab