diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp index 21ece228c2b6c35c0de8c120590ceaaa7cd0375f..1cc348352fc89fb82d3e680c607f9dd32eacfad0 100644 --- a/src/base/SMPInstr.cpp +++ b/src/base/SMPInstr.cpp @@ -5572,14 +5572,19 @@ void SMPInstr::MDFixupDefUseLists(void) { // in order to prevent erroneous analyses of dead registers or unused // metadata. if ((this->type == RETURN) || this->IsTailCall()) { - this->MDAddRegUse(STARS_x86_R_ax, false); + // We want to add the caller-saved registers to the USEs list + for (list<uint16_t>::iterator RegIter = global_STARS_program->GetFirstCallerSavedReg(); RegIter != global_STARS_program->GetLastCallerSavedReg(); ++RegIter) { + uint16_t RegNum = (*RegIter); + this->MDAddRegUse(RegNum, false); + } + this->MDAddRegUse(STARS_x86_R_bx, false); - this->MDAddRegUse(STARS_x86_R_cx, false); - this->MDAddRegUse(STARS_x86_R_dx, false); if (!UseFP) this->MDAddRegUse(MD_FRAME_POINTER_REG, false); - this->MDAddRegUse(STARS_x86_R_si, false); - this->MDAddRegUse(STARS_x86_R_di, false); + if (global_STARS_program->GetSTARS_ISA_Bitwidth() == 32) { // already caller-saved in x86-64 + this->MDAddRegUse(STARS_x86_R_si, false); + this->MDAddRegUse(STARS_x86_R_di, false); + } } // Next, add the flags register to the DEFs and USEs for those instructions that