From 766781ddc176896220111933d69b8c9434e01ec8 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Thu, 25 Mar 2010 21:56:59 +0000
Subject: [PATCH] Add USE/DEF of ESI to interrupt calls; eliminate duplicate
 PTRIMMED annotations for lea instructions.

---
 SMPInstr.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/SMPInstr.cpp b/SMPInstr.cpp
index 2d030d52..07bc70cc 100644
--- a/SMPInstr.cpp
+++ b/SMPInstr.cpp
@@ -1249,6 +1249,8 @@ void SMPInstr::MDFixupDefUseLists(void) {
 #endif
 			this->MDAddRegDef(R_bx, false);
 			this->MDAddRegUse(R_bx, false);
+			this->MDAddRegDef(R_si, false);
+			this->MDAddRegUse(R_si, false);
 #if 1
 		}
 #endif
@@ -2641,13 +2643,18 @@ void SMPInstr::AnnotateStackConstants(bool UseFP, FILE *AnnotFile) {
 		if (NN_lea == this->SMPcmd.itype) {
 			ESPoffset = this->MDGetImmedUse();
 		}
-		if (UseFP && this->GetFirstUse()->GetOp().is_reg(R_bp)) {
-			qfprintf(AnnotFile,	"%10x %6d PTRIMMEDEBP STACK %d displ %s\n",
-					SMPcmd.ea, SMPcmd.size, ESPoffset, disasm);
-		}
+		// NOTE: Looks like this next line should be "else" because an lea instruction
+		//  looks like it has a memory operand, hence it has already been handled above.
+		//  We are getting duplicate annotations for lea instructions.
 		else {
-			qfprintf(AnnotFile,	"%10x %6d PTRIMMEDESP STACK %d displ %s\n",
-					SMPcmd.ea, SMPcmd.size, ESPoffset, disasm);
+			if (UseFP && this->GetFirstUse()->GetOp().is_reg(R_bp)) {
+				qfprintf(AnnotFile,	"%10x %6d PTRIMMEDEBP STACK %d displ %s\n",
+						SMPcmd.ea, SMPcmd.size, ESPoffset, disasm);
+			}
+			else {
+				qfprintf(AnnotFile,	"%10x %6d PTRIMMEDESP STACK %d displ %s\n",
+						SMPcmd.ea, SMPcmd.size, ESPoffset, disasm);
+			}
 		}
 	}
 
-- 
GitLab