From 09f3e6c44907f90dfeaefba73be6c86c4de3b6e0 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Wed, 16 Apr 2008 17:17:11 +0000
Subject: [PATCH] Speed up SetImmedTypes() by avoiding unnecessary DEF
 propagation.

---
 SMPInstr.cpp | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/SMPInstr.cpp b/SMPInstr.cpp
index 8670a60f..33b489f4 100644
--- a/SMPInstr.cpp
+++ b/SMPInstr.cpp
@@ -288,6 +288,7 @@ void SMPInstr::Dump(void) {
 #if SMP_VERBOSE_DUMP
 	this->PrintOperands();
 #endif
+	msg("\n");
 	return;
 } // end of SMPInstr::Dump()
 
@@ -957,7 +958,6 @@ void SMPInstr::SetImmedTypes(bool UseFP) {
 	op_t UseOp;
 	op_t DefOp;
 	uval_t ImmVal;
-	int SSANum;
 	bool DebugFlag = false;
 #if SMP_VERBOSE_DEBUG_BUILT_RTL
 	DebugFlag |= (0 == strncmp("__libc_csu_fini", this->BasicBlock->GetFunc()->GetFuncName(), 15));
@@ -1024,45 +1024,21 @@ void SMPInstr::SetImmedTypes(bool UseFP) {
 			if (DefOp.is_reg(X86_FLAGS_REG)) {
 				if (DebugFlag) msg("Setting flags reg DEF to NUMERIC\n");
 				CurrDef = this->SetDefType(DefOp, NUMERIC);
-				if (this->BasicBlock->IsLocalName(DefOp)) {
-					(void) this->BasicBlock->PropagateLocalDefType(DefOp, NUMERIC, this->GetAddr());
-				}
-				else { // global name
-					this->BasicBlock->GetFunc()->ResetProcessedBlocks(); // set Processed to false
-					(void) this->BasicBlock->PropagateGlobalDefType(DefOp, NUMERIC, CurrDef->GetSSANum());
-				}
+				// No need to propagate this DEF type, as all flags will become NUMERIC.
 			}
 #if 1
 			else if (DefOp.is_reg(R_sp) || (DefOp.is_reg(R_bp) && UseFP)) {
 				if (DebugFlag) msg("Setting reg DEF to STACKPTR\n");
 				CurrDef = this->SetDefType(DefOp, STACKPTR);
 				assert(CurrDef != this->Defs.GetLastRef());
-				SSANum = CurrDef->GetSSANum();
-#if 0
-				if (DebugFlag) this->BasicBlock->Dump();
-#endif
-				if (this->BasicBlock->IsLocalName(DefOp)) {
-					if (DebugFlag) msg("Name was local\n");
-					(void) this->BasicBlock->PropagateLocalDefType(DefOp, STACKPTR, this->GetAddr());
-				}
-				else { // global name
-					if (DebugFlag) msg("Name was global\n");
-					this->BasicBlock->GetFunc()->ResetProcessedBlocks(); // set Processed to false
-					(void) this->BasicBlock->PropagateGlobalDefType(DefOp, STACKPTR, SSANum);
-				}
+				// No need to propagate; all stack and frame pointers will become STACKPTR.
 			}
 #endif
 		}
 		else if ((o_fpreg == DefOp.type) || (o_mmxreg == DefOp.type) || (o_xmmreg == DefOp.type)) {
 			if (DebugFlag) msg("Setting floating point reg DEF to NUMERIC\n");
 			CurrDef = this->SetDefType(DefOp, NUMERIC);
-			if (this->BasicBlock->IsLocalName(DefOp)) {
-				(void) this->BasicBlock->PropagateLocalDefType(DefOp, NUMERIC, this->GetAddr());
-			}
-			else { // global name
-				this->BasicBlock->GetFunc()->ResetProcessedBlocks(); // set Processed to false
-				(void) this->BasicBlock->PropagateGlobalDefType(DefOp, NUMERIC, CurrDef->GetSSANum());
-			}
+			// No need to propagate; all FP reg uses will become NUMERIC anyway.
 		}
 #if 0  // could these registers have pointers in them?
 		else if ((o_trreg == DefOp.type) || (o_dbreg == DefOp.type) || (o_crreg == DefOp.type)) {
-- 
GitLab