From 2bc7c21c3d54d3be9e85eb839edfb58180d4b5ea Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Wed, 10 Jun 2015 15:16:31 +0000
Subject: [PATCH] Code cleanup and reduction of debugging output.

Former-commit-id: 1ce9ecf1bad4334ddfb18f01e7802fc73bd357ba
---
 src/base/SMPBasicBlock.cpp | 58 +++++++++++++++++++++++++-------------
 src/base/SMPFunction.cpp   |  4 +++
 src/base/SMPInstr.cpp      | 58 ++++++++++++++++++++++++++++++--------
 3 files changed, 89 insertions(+), 31 deletions(-)

diff --git a/src/base/SMPBasicBlock.cpp b/src/base/SMPBasicBlock.cpp
index 73add82f..d774b5d2 100644
--- a/src/base/SMPBasicBlock.cpp
+++ b/src/base/SMPBasicBlock.cpp
@@ -1145,9 +1145,11 @@ bool SMPBasicBlock::ComputeReachesOutSet(void) {
 // Add DefOp, remove previous defs of DefOp that now do not reach the end of the block.
 void SMPBasicBlock::UpdateDownExposedDefs(STARSOpndTypePtr DefOp, STARS_ea_t InstAddr) {
 #if 1
+	// Only purpose of the DownExposedDefnSet is to track stack pointer copies, so save time.
 	if (!this->GetFunc()->IsInStackPtrCopySet(DefOp))
 		return;
 #endif
+
 	// First, remove any definition of DefOp that precedes the current definition.
 	set<pair<STARSOpndTypePtr, STARS_ea_t>, LessDefinition>::iterator DEDefnIter = this->GetFirstDownExposedDefn();
 	while (DEDefnIter != this->GetLastDownExposedDefn()) {
@@ -1418,16 +1420,18 @@ void SMPBasicBlock::SetLocalNames(void) {
 
 // Create local DEF-USE chains and renumber all references to all names in LocalNames.
 void SMPBasicBlock::SSALocalRenumber(void) {
+#if SMP_DEBUG_DATAFLOW
 	bool DebugFlag = false;
-#if 0
 	DebugFlag |= (0 == strcmp(".init_proc", this->MyFunc->GetFuncName()));
 #endif
 	size_t NumLocals = this->LocalNames.size();
 	vector<int> SSAIndex;
 	// Initialize SSAIndex and DUChain values for each local name.
 	set<STARSOpndTypePtr, LessOp>::iterator NameIter;
+#if SMP_DEBUG_DATAFLOW
 	if (DebugFlag)
 		SMP_msg("LocalNames size: %zu\n", NumLocals);
+#endif
 
 	for (NameIter = this->LocalNames.begin(); NameIter != this->LocalNames.end(); ++NameIter) {
 		SSAIndex.push_back(-1); // init SSA indices to -1; first DEF will make it 0
@@ -1488,8 +1492,10 @@ void SMPBasicBlock::SSALocalRenumber(void) {
 		} // end for all DEFs in the instruction
 	} // end for all instructions in the block
 
+#if SMP_DEBUG_DATAFLOW
 	if (DebugFlag)
 		SMP_msg("Exiting SSALocalRenumber()\n");
+#endif
 	return;
 } // end of SMPBasicBlock::SSALocalRenumber()
 
@@ -2202,11 +2208,9 @@ bool SMPBasicBlock::AnalyzeMemSet(STARS_ea_t MemSetAddr, STARSOpndTypePtr &MemSe
 bool SMPBasicBlock::PropagateLocalDefType(const STARSOpndTypePtr &DefOp, SMPOperandType DefType, STARS_ea_t DefAddr, int SSANum, bool IsMemOp, bool PointerOverride) {
 	bool changed = false;
 	bool SafeFunc = (this->MyFunc) && this->MyFunc->IsSafe();
-	bool DebugFlag = false;
 	bool ChangeNumericToPointer = (PointerOverride && IsDataPtr(DefType));
 #if SMP_DEBUG_OPTIMIZATIONS
-	DebugFlag |= (0 == strcmp("memset", this->MyFunc->GetFuncName()));
-#endif
+	bool DebugFlag = (0 == strcmp("memset", this->MyFunc->GetFuncName()));
 
 	if (DebugFlag) {
 		SMP_msg("PropagateLocalDefType for DefType %d at %lx ",
@@ -2214,6 +2218,7 @@ bool SMPBasicBlock::PropagateLocalDefType(const STARSOpndTypePtr &DefOp, SMPOper
 		PrintOperand(DefOp);
 		SMP_msg("\n");
 	}
+#endif
 
 #if STARS_PROPAGATE_STACKMEMTYPE_UNTIL_INDIRECT
 	bool UseFP = this->GetFunc()->UsesFramePointer();
@@ -2321,10 +2326,9 @@ bool SMPBasicBlock::PropagateGlobalDefType(const STARSOpndTypePtr &DefOp, SMPOpe
 	bool changed = false;
 	bool FoundPhiDef = false;
 	bool SafeFunc = (this->MyFunc) && this->MyFunc->IsSafe();
-	bool DebugFlag = false;
 	bool ChangeNumericToPointer = (PointerOverride && IsDataPtr(DefType));
 #if SMP_DEBUG_OPTIMIZATIONS
-	DebugFlag |= (0 == strcmp("__strtod_internal", this->MyFunc->GetFuncName()));
+	bool DebugFlag = (0 == strcmp("__strtod_internal", this->MyFunc->GetFuncName()));
 #endif
 	vector<SMPInstr *>::iterator InstIter;
 	set<DefOrUse, LessDefUse>::iterator CurrUse;
@@ -2343,11 +2347,13 @@ bool SMPBasicBlock::PropagateGlobalDefType(const STARSOpndTypePtr &DefOp, SMPOpe
 		return false;
 	}
 
+#if SMP_DEBUG_OPTIMIZATIONS
 	if (DebugFlag) {
 		SMP_msg("PropagateGlobalDefType: DefType %d SSANum %d ", DefType, SSANum);
 		PrintOperand(DefOp);
 		SMP_msg("\n");
 	}
+#endif
 
 #if STARS_PROPAGATE_STACKMEMTYPE_UNTIL_INDIRECT
 	bool StackMemOp = IsMemOp && MDIsDirectStackAccessOpnd(DefOp, UseFP);
@@ -2371,24 +2377,32 @@ bool SMPBasicBlock::PropagateGlobalDefType(const STARSOpndTypePtr &DefOp, SMPOpe
 	//   in moves and arithmetic in the block, and then recurse into successors.
 	set<SMPPhiFunction, LessPhi>::iterator CurrPhi = this->FindPhi(DefOp);
 	if (CurrPhi != this->GetLastPhi()) { // Found a corresponding phi function
+#if SMP_DEBUG_OPTIMIZATIONS
 		if (DebugFlag) SMP_msg("Found Phi for DefOp\n");
+#endif
 		// If SSANum matches the DEF in the Phi function, then we are being
 		//  called by InferPhiDefType() and we should proceed to process
 		//  the instructions in the block.
 		if (SSANum != CurrPhi->GetDefSSANum()) { // not DEF, so find USE
+#if SMP_DEBUG_OPTIMIZATIONS
 			if (DebugFlag) SMP_msg("Phi was a USE\n");
+#endif
 			// Now, find the SSANum entry in the phi arguments (USEs)
 			bool FoundUse = false;
 			size_t PhiIndex;
 			for (PhiIndex = 0; PhiIndex < CurrPhi->GetPhiListSize(); ++PhiIndex) {
 				if (SSANum == CurrPhi->GetUseSSANum(PhiIndex))  {
 					FoundUse = true;
+#if SMP_DEBUG_OPTIMIZATIONS
 					if (DebugFlag) SMP_msg("Found the phi USE at index %zu\n", PhiIndex);
+#endif
 					SMPOperandType CurrType = CurrPhi->GetUseType(PhiIndex);
 					if ((UNINIT == CurrType) || (ChangeNumericToPointer && IsEqType(CurrType, NUMERIC))) {
 						changed = this->SetPhiUseType(DefOp, PhiIndex, DefType);
 						assert(changed);
+#if SMP_DEBUG_OPTIMIZATIONS
 						if (DebugFlag) SMP_msg("Changed the phi USE type\n");
+#endif
 					}
 #if 1
 					break; // **!!** COULD BE MULTIPLE USES HERE
@@ -2457,10 +2471,12 @@ bool SMPBasicBlock::PropagateGlobalDefType(const STARSOpndTypePtr &DefOp, SMPOpe
 		FoundUse = true;
 		UseType = CurrUse->GetType();
 		uint16_t InstOpcode = CurrInst->GetIDAOpcode();
+#if SMP_DEBUG_OPTIMIZATIONS
 		if (DebugFlag) {
 			SMP_msg("Found USE with same SSANum at %lx : %s\n", 
 				(unsigned long) CurrInst->GetAddr(), CurrInst->GetDisasm());
 		}
+#endif
 		if ((UNINIT == UseType) || (ChangeNumericToPointer && IsEqType(UseType, NUMERIC))) {
 			CurrUse = CurrInst->SetUseType(DefOp, DefType);
 			assert(CurrUse != CurrInst->GetLastUse()); // found USE
@@ -2665,16 +2681,15 @@ bool SMPBasicBlock::PropagateLocalMetadata(const STARSOpndTypePtr &UseOp, SMPMet
 //  a single type. If so, set the DEF to that type and return true, else return false.
 bool SMPBasicBlock::InferLocalDefType(const STARSOpndTypePtr &DefOp, unsigned int LocIndex, STARS_ea_t DefAddr) {
 	bool changed = false;
-	bool DebugFlag = false;
 #if SMP_DEBUG_OPTIMIZATIONS
-	DebugFlag |= (0 == strcmp("weightadj", this->MyFunc->GetFuncName()));
-#endif
+	bool DebugFlag = (0 == strcmp("weightadj", this->MyFunc->GetFuncName()));
 
 	if (DebugFlag) {
 		SMP_msg("InferLocalDefType at %lx ", (unsigned long) DefAddr);
 		PrintOperand(DefOp);
 		SMP_msg("\n");
 	}
+#endif
 
 	vector<SMPInstr *>::iterator InstIter;
 	vector<SMPInstr *>::iterator DefInstIter = this->GetInstIterFromAddr(DefAddr);
@@ -2754,7 +2769,9 @@ bool SMPBasicBlock::InferLocalDefType(const STARSOpndTypePtr &DefOp, unsigned in
 			return false; // no POINTER, but no consistent type
 
 		if (!IsEqType(DefType, UseType)) {
+#if SMP_DEBUG_OPTIMIZATIONS
 			if (DebugFlag) SMP_msg("Inferring local DEF of type %d\n", UseType);
+#endif
 			CurrDef = DefInst->SetDefType(DefOp, UseType);
 			changed = true;
 			if (FoundPointer && FoundUninit) {
@@ -3014,16 +3031,21 @@ bool SMPBasicBlock::IsGlobalRegDead(STARS_ea_t InstAddr, const STARSOpndTypePtr
 	bool FoundInLiveInSet = this->IsLiveIn(Operand);
 	bool FoundInLiveOutSet = this->IsLiveOut(Operand);
 	bool FoundInKillSet = this->IsVarKill(Operand);
+#if SMP_DEBUG_OPTIMIZATIONS
 	bool DebugFlag = (0x804837b == InstAddr);
 
 	if (DebugFlag) SMP_msg("A1");
+#endif
 
 	// If it is Live-In and Live-Out and not in the kill set,
 	// it is live the whole time (either pass-through case or use-only case).
 	if (FoundInLiveInSet && FoundInLiveOutSet && !FoundInKillSet)
 		return false;
 
+#if SMP_DEBUG_OPTIMIZATIONS
 	if (DebugFlag) SMP_msg("B");
+#endif
+
 	// If it is not Live-In and not in the Kill set it is dead the whole time
 	if (!FoundInLiveInSet && !FoundInKillSet) {
 		// Must not have USEs, else it would be LiveIn. So, no DEFs, no USEs, not LiveIn: Dead.
@@ -3080,9 +3102,8 @@ bool SMPBasicBlock::IsRegDead(STARS_ea_t InstAddr, uint16_t RegNo) {
 
 // Mark the registers that are dead for each instruction in the block.
 void SMPBasicBlock::MarkDeadRegs(void) {
-	bool DebugFlag = false;
-#if 0
-	DebugFlag |= (0 == strcmp("_int_malloc", this->MyFunc->GetFuncName()));
+#if SMP_DEBUG_OPTIMIZATIONS
+	bool DebugFlag = (0 == strcmp("_int_malloc", this->MyFunc->GetFuncName()));
 #endif
 	set<STARSOpndTypePtr, LessOp>::iterator NameIter;
 	set<STARSOpndTypePtr, LessOp>::iterator FlagNameIter;
@@ -3105,11 +3126,13 @@ void SMPBasicBlock::MarkDeadRegs(void) {
 		if (CurrInst->IsMarkerInst())
 			continue;
 		STARS_ea_t InstAddr = CurrInst->GetAddr();
-		DebugFlag = (0x804dafc == InstAddr);
+#if SMP_DEBUG_OPTIMIZATIONS
+		DebugFlag |= (0x804dafc == InstAddr);
 		if (DebugFlag) {
 			CurrInst->PrintOperands();
 			SMP_msg("\n");
 		}
+#endif
 		// First, put EFLAGS at beginning of string if it is dead.
 		if (!GlobalFlags) {
 			if (FlagNameIter != this->LocalNames.end()) {
@@ -3191,8 +3214,10 @@ void SMPBasicBlock::MarkDeadRegs(void) {
 		//SMP_msg("Done.  Next instruction.\n");
 
 	} // end for all instructions
+#if SMP_DEBUG_OPTIMIZATIONS
 	if (DebugFlag)
 		SMP_msg("Exiting MarkDeadRegs()\n");
+#endif
 	return;
 } // end of SMPBasicBlock::MarkDeadRegs()
 
@@ -4146,13 +4171,6 @@ bool SMPBasicBlock::FindRedundantLocalMetadata(bool SafeFunc) {
 	vector<SMPOperandType> LocalTypes;
 	vector<SMPOperandType> GlobalTypes;
 
-#if 0
-	bool DebugFlag = false;
-	if (0 == strcmp("__libc_start_main", this->GetFunc()->GetFuncName())) {
-		DebugFlag = true;
-	}
-#endif
-
 	// Initialize the most recently seen type for each possible DEF.
 	for (size_t i = 0; i < LocalNameLimit; ++i)
 		LocalTypes.push_back(UNINIT);
diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index e26b20b0..6af05922 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -559,7 +559,9 @@ void SMPFunction::AddLeaOperand(STARS_ea_t addr, STARSOpndTypePtr LeaOperand) {
 // Add input arguments to the NormalizedStackOpsMap.
 void SMPFunction::AddNormalizedStackOperand(STARSOpndTypePtr OldOp, STARS_ea_t InstAddr, STARSOpndTypePtr NormalizedOp) {
 	bool DuplicateCase = false; // e.g. inc [esp+8] will have [esp+8] as a DEF and a USE and maps will see [esp+8] twice
+#if SMP_DEBUG_DATAFLOW_VERBOSE
 	bool DebugFlag = (InstAddr == 0x8048463);
+#endif
 	pair<map<pair<STARSOpndTypePtr, STARS_ea_t>, STARSOpndTypePtr, LessDefinition>::iterator, bool> InsertResult;
 	pair<map<pair<STARSOpndTypePtr, STARS_ea_t>, map<pair<STARSOpndTypePtr, STARS_ea_t>, STARSOpndTypePtr, LessDefinition>::iterator, LessDefinition>::iterator, bool> InverseInsertResult;
 	pair<STARSOpndTypePtr, STARS_ea_t> OldValue(OldOp, InstAddr);
@@ -640,6 +642,7 @@ void SMPFunction::AddNormalizedStackOperand(STARSOpndTypePtr OldOp, STARS_ea_t I
 		InverseInsertResult = this->InverseNormalizedStackOpsMap.insert(InverseInsertTriple);
 		assert(InverseInsertResult.second || DuplicateCase);
 	}
+#if SMP_DEBUG_DATAFLOW_VERBOSE
 	if (DebugFlag) {
 		map<pair<STARSOpndTypePtr, STARS_ea_t>, STARSOpndTypePtr, LessDefinition>::iterator StackMapIter;
 		SMP_msg("DEBUG: NormalizedStackOpsMap size: %zd\n", this->NormalizedStackOpsMap.size());
@@ -651,6 +654,7 @@ void SMPFunction::AddNormalizedStackOperand(STARSOpndTypePtr OldOp, STARS_ea_t I
 			SMP_msg(" addr: %lx\n", (unsigned long) InstAddr);
 		}
 	}
+#endif
 	return;
 } // SMPFunction::AddNormalizedStackOperand()
 
diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp
index e3586d79..3a85d262 100644
--- a/src/base/SMPInstr.cpp
+++ b/src/base/SMPInstr.cpp
@@ -2619,7 +2619,7 @@ void SMPInstr::EmitSPARKAda(FILE *OutFile) {
 				PrintSPARKIndentTabs(OutFile);
 				SMP_fprintf(OutFile, " X86.RSP := X86.RSP - %d;\n", global_STARS_program->GetSTARS_ISA_Bytewidth());
 			}
- 			// Detect loop-related control flow first, then simple if-else control flow otherwise.
+			// Detect loop-related control flow first, then simple if-else control flow otherwise.
 			FuncControlFlowType = this->GetBlock()->GetFunc()->GetControlFlowType(InstAddr);
 			if (FALL_THROUGH == FuncControlFlowType) {
 				SMP_fprintf(OutFile, "ERROR: Jump instruction of unknown control flow.\n");
@@ -3651,7 +3651,7 @@ bool SMPInstr::MDIsStackPtrSaveOrRestore(bool UseFP, STARS_sval_t FPDelta, bool
 	SMPoperator CurrOper;
 	bool LookUpStackDelta; // Get stack delta from reaching defs for TempOp
 	STARS_sval_t DeltaAdjust; // add to StackDelta after computing from reaching defs, e.g. lea esp,[ecx-4] get TempOp of ecx
-	                        //  and DeltaAdjust of -4
+							//  and DeltaAdjust of -4
 
 	Error = false;
 
@@ -6519,54 +6519,72 @@ void SMPInstr::SetImmedTypes(bool UseFP) {
 	CurrUse = this->GetFirstUse();
 	while (CurrUse != this->GetLastUse()) {
 		UseOp = CurrUse->GetOp();
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 		if (DebugFlag) {
 			SMP_msg("SetImmedTypes USE: ");
 			PrintOperand(UseOp);
 			SMP_msg("\n");
 		}
+#endif
 		if (UseOp->IsImmedOp()) {
 			ImmVal = UseOp->GetImmedValue();
 			if (IsImmedGlobalAddress((STARS_ea_t) ImmVal)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting to GLOBALPTR\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, GLOBALPTR);
 			}
 #if 0
 			else if (IsDataAddress((STARS_ea_t) ImmVal)) {
 				// NOTE: We must call IsDataAddress() before we call IsImmedCodeAddress()
 				//  to catch the data addresses within the code address range.
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting to POINTER\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, POINTER);
 			}
 #endif
 			else if (this->MDIsInterruptCall() || IsImmedCodeAddress((STARS_ea_t) ImmVal)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting to CODEPTR\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, CODEPTR);
 			}
 			else { // NUMERIC
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting to NUMERIC\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, NUMERIC);
 			}
 		}
 		else if (UseOp->IsRegOp()) {
 			if (UseOp->MatchesReg(X86_FLAGS_REG)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting flags reg to NUMERIC\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, NUMERIC);
 			}
 #if 1
 			else if (MDIsStackOrFramePointerReg(UseOp, UseFP)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting reg to STACKPTR\n");
+#endif
 				CurrUse = this->SetUseType(UseOp, STACKPTR);
 			}
 #endif
 		}
 #if 0  // could these registers have pointers in them?
 		else if (UseOp->IsTestRegOp() || UseOp->IsDebugRegOp() || UseOp->IsControlRegOp()) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 			if (DebugFlag) SMP_msg("Setting special reg to NUMERIC\n");
+#endif
 			CurrUse = this->SetUseType(UseOp, NUMERIC);
 		}
 #endif
 		else if (UseOp->IsFloatingPointRegOp() || UseOp->IsMMXRegOp() || UseOp->IsXMMRegOp() || UseOp->IsYMMRegOp()) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 			if (DebugFlag) SMP_msg("Setting floating point reg to NUMERIC\n");
+#endif
 			CurrUse = this->SetUseType(UseOp, NUMERIC);
 		}
 		else if (UseOp->IsMemOp()) {
@@ -6580,21 +6598,27 @@ void SMPInstr::SetImmedTypes(bool UseFP) {
 	CurrDef = this->GetFirstDef();
 	while (CurrDef != this->GetLastDef()) {
 		DefOp = CurrDef->GetOp();
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 		if (DebugFlag) {
 			SMP_msg("SetImmedTypes DEF: ");
 			PrintOperand(DefOp);
 			SMP_msg("\n");
+			SMP_msg("FuncName: %s\n", this->BasicBlock->GetFunc()->GetFuncName());
 		}
-		if (DebugFlag) SMP_msg("FuncName: %s\n", this->BasicBlock->GetFunc()->GetFuncName());
+#endif
 		if (DefOp->IsRegOp()) {
 			if (DefOp->MatchesReg(X86_FLAGS_REG)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting flags reg DEF to NUMERIC\n");
+#endif
 				CurrDef = this->SetDefType(DefOp, NUMERIC);
 				// No need to propagate this DEF type, as all flags will become NUMERIC.
 			}
 #if 1
 			else if (MDIsStackOrFramePointerReg(DefOp, UseFP)) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 				if (DebugFlag) SMP_msg("Setting reg DEF to STACKPTR\n");
+#endif
 				CurrDef = this->SetDefType(DefOp, STACKPTR);
 				assert(CurrDef != this->Defs.GetLastRef());
 				// No need to propagate; all stack and frame pointers will become STACKPTR.
@@ -6602,13 +6626,17 @@ void SMPInstr::SetImmedTypes(bool UseFP) {
 #endif
 		}
 		else if (DefOp->IsFloatingPointRegOp() || DefOp->IsMMXRegOp() || DefOp->IsXMMRegOp() || DefOp->IsYMMRegOp()) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 			if (DebugFlag) SMP_msg("Setting floating point reg DEF to NUMERIC\n");
+#endif
 			CurrDef = this->SetDefType(DefOp, NUMERIC);
 			// No need to propagate; all FP reg uses will become NUMERIC anyway.
 		}
 #if 0  // could these registers have pointers in them?
 		else if (DefOp->IsTestRegOp() || DefOp->IsDebugRegOp() || DefOp->IsControlRegOp()) {
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 			if (DebugFlag) SMP_msg("Setting special reg DEF to NUMERIC\n");
+#endif
 			CurrDef = this->SetDefType(DefOp, NUMERIC);
 		}
 #endif	
@@ -7965,11 +7993,11 @@ bool SMPInstr::InferTypes(void) {
 	bool IsMemOp;
 #if SMP_VERBOSE_DEBUG_INFER_TYPES
 	DebugFlag |= (0 == strcmp("_start", this->BasicBlock->GetFunc()->GetFuncName()));
-#endif
 
 	if (DebugFlag) {
 		SMP_msg("opcode: %d TypeCategory: %d\n", opcode, TypeCategory);
 	}
+#endif
 
 	// If we are already finished with all types, return false.
 	if (this->IsTypeInferenceComplete())
@@ -7992,10 +8020,12 @@ bool SMPInstr::InferTypes(void) {
 	SMPitype DFAType = this->GetDataFlowType();
 	bool CallInst = ((DFAType == CALL) || (DFAType == INDIR_CALL) || this->IsTailCall());
 	uint16_t IndirCallReg = STARS_x86_R_none;
+#if SMP_VERBOSE_DEBUG_INFER_TYPES
 	if (DebugFlag) {
 		SMP_msg("DFAType: %d  CategoryInferenceComplete: %d\n",
 			DFAType, this->IsCategoryInferenceComplete());
 	}
+#endif
 
 	if (DFAType == INDIR_CALL) {
 		STARSOpndTypePtr TargetOp = this->STARSInstPtr->GetOpnd(0);
@@ -8229,9 +8259,11 @@ bool SMPInstr::InferTypes(void) {
 	} // end if (!CategoryInference)
 
 	// Walk the RTL and infer types based on operators and operands.
+#if SMP_VERBOSE_DEBUG_INFER_TYPES
 	if (DebugFlag) {
 		SMP_msg("RTcount: %zu\n", this->RTL.GetCount());
 	}
+#endif
 	for (std::size_t index = 0; index < this->RTL.GetCount(); ++index) {
 		SMPRegTransfer *CurrRT = this->RTL.GetRT(index);
 		if (SMP_NULL_OPERATOR == CurrRT->GetOperator()) // nothing to infer
@@ -8239,9 +8271,11 @@ bool SMPInstr::InferTypes(void) {
 		if (!(CurrRT->IsTypeInferenceComplete())) {
 			changed |= this->InferOperatorType(CurrRT);
 		}
+#if SMP_VERBOSE_DEBUG_INFER_TYPES
 		if (DebugFlag) {
 			SMP_msg("returned from InferOperatorType\n");
 		}
+#endif
 	} // end for all RTs in the RTL
 	return changed;
 } // end of SMPInstr::InferTypes()
@@ -10406,7 +10440,7 @@ void SMPInstr::EmitAnnotations(bool UseFP, bool AllocSeen, bool NeedsFrame, FILE
 		{	if (MemDest || MemSrc) {
 				SDTInstrumentation = true;
 				break;  // treat as category 0
-	 		}
+			}
 			SMP_fprintf(AnnotFile, "%10lx %6d INSTR LOCAL Always1stSrc %s \n",
 					(unsigned long) addr, -1, disasm);
 			global_STARS_program->IncrementAnnotationCount(this->OptType);
@@ -10727,7 +10761,7 @@ void SMPInstr::EmitTypeAnnotations(bool UseFP, bool AllocSeen, bool NeedsFrame,
 						// could be more aggressive if we know there's no overflow. -- jdh
 				SDTInstrumentation = true;
 				break;  // treat as category 0
-	 		}
+			}
 			SMP_fprintf(AnnotFile, "%10lx %6d INSTR LOCAL Always1stSrc %s \n",
 					(unsigned long) addr, -1, disasm);
 			global_STARS_program->IncrementAnnotationCount(this->OptType);
@@ -11016,8 +11050,8 @@ void SMPInstr::EmitIntegerErrorAnnotations(FILE *InfoAnnotFile, list<std::size_t
 	bool UseFP = this->BasicBlock->GetFunc()->UsesFramePointer();
 	bool SuppressSignednessCheck = false; // If we are not confident in check, set to true.
 	bool PartialStore; // Store is fewer bits than is defined for the target, e.g. overwriting last 8 bits
-	                   //  of an int or a pointer. Cannot have signedness error in that case, as sign bit
-	                   //  is not affected.
+					   //  of an int or a pointer. Cannot have signedness error in that case, as sign bit
+					   //  is not affected.
 
 
 	bool cases1and2 = (OverflowOpcode || UnderflowOpcode);
@@ -14133,7 +14167,7 @@ bool SMPInstr::BuildMoveRTL(SMPoperator GuardOp) {
 		}
 #if 1
 		else {  // IDA incorrectly lists [EDI] as both DEF and USE, because reg EDI
-			    //  is both DEF and USE in STARS_NN_stos.
+				//  is both DEF and USE in STARS_NN_stos.
 			SMP_msg("WARNING: Ignoring IDA Pro error: MemDest and MemSrc in move at %lx for %s\n",
 				(unsigned long) this->GetAddr(), DisAsmText.GetDisAsm(this->GetAddr()));
 			this->PrintOperands();
@@ -15538,7 +15572,7 @@ bool SMPInstr::BuildPushRTL(void) {
 		// EAX goes to [ESP-4]
 		STARSOpndTypePtr EAXOp = this->STARSInstPtr->MakeRegOpnd(STARS_x86_R_ax);
 		STARSOpndTypePtr StackOp1 = this->STARSInstPtr->MakeMemDisplacementOpnd(STARS_x86_R_sp, STARS_x86_R_none, 0, 
-                                                   -((STARS_ea_t) 1 * global_STARS_program->GetSTARS_ISA_Bytewidth()));
+												   -((STARS_ea_t) 1 * global_STARS_program->GetSTARS_ISA_Bytewidth()));
 		TempRT = new SMPRegTransfer;
 		TempRT->SetParentInst(this);
 		TempRT->SetRightOperand(EAXOp);
@@ -18082,10 +18116,12 @@ void SMPInstr::SyncRTLDefUse(SMPRegTransfer *CurrRT, bool UseFP, STARS_sval_t FP
 	DebugFlag |= (0 == strcmp("__libc_csu_fini", this->BasicBlock->GetFunc()->GetFuncName()));
 #endif
 
+#if SMP_VERBOSE_DEBUG_BUILD_RTL
 	if (DebugFlag) {
 		SMP_msg("SyncRTLDefUse entered. Dump of USE list:\n");
 		this->Uses.Dump();
 	}
+#endif
 
 	LeftOp = CurrRT->GetLeftOperand();
 	if (SMP_ASSIGN == CurrRT->GetOperator()) {
@@ -18200,7 +18236,7 @@ bool SMPInstr::MDIsAddImmediateToReg(STARSOpndTypePtr &DefOp, STARSOpndTypePtr &
 					return false;
 				}
 				if (MDLessReg(UseOp->GetReg(), TempDefOp->GetReg()) 
-                || MDLessReg(TempDefOp->GetReg(), UseOp->GetReg())) {
+				|| MDLessReg(TempDefOp->GetReg(), UseOp->GetReg())) {
 					return false;
 				}
 				// If we make it here, we have the same register DEFed as we found USEd.
-- 
GitLab