From 2d0f49f8f802292f554b4ba8369f11e05cff933c Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Tue, 11 Mar 2008 17:06:17 +0000
Subject: [PATCH] Permit mmStrata instrumentation of stack allocation
 instructions; remove unsafe assertion.

---
 SMPInstr.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/SMPInstr.cpp b/SMPInstr.cpp
index 22301dea..508470e3 100644
--- a/SMPInstr.cpp
+++ b/SMPInstr.cpp
@@ -667,11 +667,13 @@ void SMPInstr::MDFixupDefUseLists(void) {
 		}
 	} // end else if (7 == OptType)
 
-	// Next, add the flags register to the DEFs and USEs for those instructions that
-	//  are marked as defining or using flags.
+#if 0  // Not true for LOOP instructions that use only the ECX counter register.
 	if (this->type == COND_BRANCH) {
 		assert(SMPUsesFlags[this->SMPcmd.itype]);
 	}
+#endif
+	// Next, add the flags register to the DEFs and USEs for those instructions that
+	//  are marked as defining or using flags.
 	if (!this->DefsFlags && SMPDefsFlags[this->SMPcmd.itype]) {
 		this->MDAddRegDef(X86_FLAGS_REG, false);
 		this->DefsFlags = true;
@@ -922,11 +924,14 @@ void SMPInstr::EmitAnnotations(bool UseFP, bool AllocSeen, FILE *AnnotFile) {
 				SDTInstrumentation = true;
 				break;  // treat as category 0
 			}
-			if (SecondSrcOperandNum) { // treat as category 1
+			if (SecondSrcOperandNum && !this->MDIsFrameAllocInstr()) { // treat as category 1
 				qfprintf(AnnotFile, "%10x %6d INSTR LOCAL %s %s \n",
 						addr, -1, OptExplanation[OptType], disasm);
 				++AnnotationCount[OptType];
 			}
+			else {
+				SDTInstrumentation = true;
+			}
 			break;
 		}
 
-- 
GitLab