From 00d37a72cb07a7f6f96c34bc9907f9060ec7a2b2 Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Sat, 3 Oct 2015 00:31:12 +0000
Subject: [PATCH] Fixed bug where pop insn was grabbing the wrong operand from
 bea, where goodRTLs wasn't being init'd properly, and added RTL dump after
 RTL gets built.

Former-commit-id: 36136bd062d5a615d6713f530f029209ee501d33
---
 src/interfaces/irdb/STARS_IRDB_Function.cpp    | 3 +++
 src/interfaces/irdb/STARS_IRDB_Instruction.cpp | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/interfaces/irdb/STARS_IRDB_Function.cpp b/src/interfaces/irdb/STARS_IRDB_Function.cpp
index eb21d51f..25d728e6 100644
--- a/src/interfaces/irdb/STARS_IRDB_Function.cpp
+++ b/src/interfaces/irdb/STARS_IRDB_Function.cpp
@@ -81,6 +81,8 @@ typedef list<SMPInstr*> SMPInstrList_t;
 	SMPInstrList_t::iterator FirstInBlock = func->Instrs.end();
         SMPInstrList_t::iterator LastInBlock = func->Instrs.end();
 	bool GoodRTL=false;
+        func->BuiltRTLs = true;
+
 
 	// build cfg 
 	ControlFlowGraph_t cfg(the_func);
@@ -172,6 +174,7 @@ typedef list<SMPInstr*> SMPInstrList_t;
 			// Build tree RTLs for the instruction.
 			GoodRTL = CurrInst->BuildRTL();
 			func->BuiltRTLs = (func->BuiltRTLs && GoodRTL);
+			CurrInst->Dump();
 			if (GoodRTL) {
 				CurrInst->SetGoodRTL();
 			}
diff --git a/src/interfaces/irdb/STARS_IRDB_Instruction.cpp b/src/interfaces/irdb/STARS_IRDB_Instruction.cpp
index 7c45ff81..be1cd299 100644
--- a/src/interfaces/irdb/STARS_IRDB_Instruction.cpp
+++ b/src/interfaces/irdb/STARS_IRDB_Instruction.cpp
@@ -1477,7 +1477,7 @@ bool STARS_IRDB_Instruction_t::STARS_GetCmd(void)
 		case  STARS_NN_pop:
 		{
 			// make op[0] from reg/imm in Argument2
-			Operands[0]=(std::make_shared<STARS_IRDB_op_t>(disasm,1,disasm.Argument2));	
+			Operands[0]=(std::make_shared<STARS_IRDB_op_t>(disasm,1,disasm.Argument1));	
 			// reset the features of this insn to say we use op 1.
 			features=STARS_CF_CHG1;			
 			do_default=false;
-- 
GitLab