From 587d37609e93c632920ffc946032c7f9efff429f Mon Sep 17 00:00:00 2001 From: clc5q <clc5q@git.zephyr-software.com> Date: Thu, 29 May 2008 02:19:04 +0000 Subject: [PATCH] Add method GetPushedOpnd(). --- SMPInstr.cpp | 21 +++++++++++++++++++++ SMPInstr.h | 1 + 2 files changed, 22 insertions(+) diff --git a/SMPInstr.cpp b/SMPInstr.cpp index 8133ced9..3f9243dc 100644 --- a/SMPInstr.cpp +++ b/SMPInstr.cpp @@ -2720,6 +2720,27 @@ void SMPInstr::EmitTypeAnnotations(bool UseFP, bool AllocSeen, FILE *AnnotFile) return; } // end of SMPInstr::EmitTypeAnnotations() +// Go through the PUSH RTL and get the operand pushed. +op_t SMPInstr::GetPushedOpnd(void) { + op_t VoidOp; + VoidOp.type = o_void; + + if (NN_push == this->SMPcmd.itype) { + for (size_t OpNum = 0; OpNum < UA_MAXOP; ++OpNum) { + op_t TempOp = this->SMPcmd.Operands[OpNum]; + if (this->features & UseMacros[OpNum]) { // USE + return TempOp; + } + } + msg("ERROR: Could not find PUSH operand at %x %s\n", this->address, + this->GetDisasm()); + return VoidOp; + } + else { + return VoidOp; + } +} // end of SMPInstr::GetPushedOpnd() + // Build the RTL for an instruction with a unary opcode bool SMPInstr::BuildUnaryRTL(SMPoperator UnaryOp) { size_t OpNum; diff --git a/SMPInstr.h b/SMPInstr.h index e3d474d1..04594989 100644 --- a/SMPInstr.h +++ b/SMPInstr.h @@ -224,6 +224,7 @@ public: void AnalyzeMarker(void); // Fill in basic data for top of function pseudo-instruction. bool BuildRTL(void); // Build RTL trees; return true if successfully built. void SyncAllRTs(void); // calls SyncRTLDefUse() for all RTs in RTL + op_t GetPushedOpnd(void); // Extract source operand from PUSH RTL void SetImmedTypes(bool UseFP); // type all immediate operands as NUMERIC, CODEPTR, GLOBALPTR // and set other context-free types (ESP == STACKPTR, etc.) bool InferTypes(void); // return true if any DEF-USE or RTL operator types were updated. -- GitLab