From 301ca121be1faca472f5641a889823840323733f Mon Sep 17 00:00:00 2001 From: clc5q <clc5q@git.zephyr-software.com> Date: Wed, 2 Dec 2015 16:38:31 +0000 Subject: [PATCH] Add x86-64 caller-saved regs to return statement USE lists. Former-commit-id: 60cf80ed5cf437754a2a53f91c79a3ef97d030b5 --- src/base/SMPInstr.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp index 21ece228..1cc34835 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 -- GitLab