From 1c692d50eb9fbe6efcb25c8406b47c1c623ecc69 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Sat, 11 Feb 2012 22:47:21 +0000
Subject: [PATCH] Reduce DU chain offsets from unsigned int to unsigned short
 to reduce memory usage.

---
 SMPDataFlowAnalysis.cpp | 6 +++---
 SMPDataFlowAnalysis.h   | 7 ++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/SMPDataFlowAnalysis.cpp b/SMPDataFlowAnalysis.cpp
index 5cd46104..744b158d 100644
--- a/SMPDataFlowAnalysis.cpp
+++ b/SMPDataFlowAnalysis.cpp
@@ -1228,7 +1228,7 @@ void SMPPhiFunction::Dump(void) const {
 SMPDefUseChain::SMPDefUseChain(void) {
 	this->SSAName.type = o_void;
 	this->RefInstrs.clear();
-	this->RefInstrs.push_back(BADADDR);
+	this->RefInstrs.push_back((unsigned short) BADADDR);
 	this->IndWrite = false;
 	return;
 }
@@ -1253,13 +1253,13 @@ void SMPDefUseChain::SetName(op_t Name) {
 
 // Set the DEF instruction.
 void SMPDefUseChain::SetDef(ea_t Def) {
-	this->RefInstrs[0] = Def;
+	this->RefInstrs[0] = (unsigned short) Def;
 	return;
 }
 
 // Push a USE onto the list
 void SMPDefUseChain::PushUse(ea_t Use) {
-	this->RefInstrs.push_back(Use);
+	this->RefInstrs.push_back((unsigned short) Use);
 	return;
 }
 
diff --git a/SMPDataFlowAnalysis.h b/SMPDataFlowAnalysis.h
index 91906e9d..4a25e901 100644
--- a/SMPDataFlowAnalysis.h
+++ b/SMPDataFlowAnalysis.h
@@ -532,7 +532,12 @@ public:
 private:
 	op_t SSAName;  // What variable is defined and used in the chain?
 	bool IndWrite; // Does an indirect memory write occur within the chain?
-	vector<ea_t> RefInstrs; // First is always DEF, rest are USE.
+	// Keep DEF and USE addrs as unsigned short offsets from BaseAddr of block.
+	//  The BaseAddr of the block is 1 less than the first inst addr of the block,
+	//  so that this value can be used as a flag to indicate that the value was
+	//  live-in and upward-exposed upon block entry and does not have a real DEF
+	//  in the block for that SSANum.
+	vector<unsigned short> RefInstrs; // First is always DEF, rest are USE.
 }; // end class SMPDefUseChain
 
 class SMPDUChainArray {
-- 
GitLab