diff --git a/SMPInstr.cpp b/SMPInstr.cpp index 8133ced93adbd9d9477543f00cfa28038d4af706..3f9243dc33101eb3105a1053219347ed4b464ba0 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 e3d474d13cb3ed5499e06c258db45fb1078efe46..045949894f80895d89ed7467466bbd76375e00df 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.