From 634f1c3d4d6e9ab619f7277f964226029e70565b Mon Sep 17 00:00:00 2001 From: clc5q <clc5q@git.zephyr-software.com> Date: Wed, 2 Dec 2015 17:40:36 +0000 Subject: [PATCH] Add x86-64 callee-saved regs to return instruction USEs lists. Former-commit-id: 9db9cbda545cf58b1652a33391cf9101331bc190 --- src/base/SMPInstr.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp index 1cc34835..0bd82941 100644 --- a/src/base/SMPInstr.cpp +++ b/src/base/SMPInstr.cpp @@ -5581,10 +5581,19 @@ void SMPInstr::MDFixupDefUseLists(void) { this->MDAddRegUse(STARS_x86_R_bx, false); if (!UseFP) this->MDAddRegUse(MD_FRAME_POINTER_REG, false); - if (global_STARS_program->GetSTARS_ISA_Bitwidth() == 32) { // already caller-saved in x86-64 + size_t BitWidth = global_STARS_program->GetSTARS_ISA_Bitwidth(); + if (BitWidth == 32) { // already caller-saved in x86-64 this->MDAddRegUse(STARS_x86_R_si, false); this->MDAddRegUse(STARS_x86_R_di, false); } + else if (BitWidth == 64) { + // Add callee-saved regs R12 through R15. We can optimize these away with later analysis, + // after we have GlobalNames and LocalNames defined. + this->MDAddRegUse(STARS_x86_R_r12, false); + this->MDAddRegUse(STARS_x86_R_r13, false); + this->MDAddRegUse(STARS_x86_R_r14, false); + this->MDAddRegUse(STARS_x86_R_r15, false); + } } // Next, add the flags register to the DEFs and USEs for those instructions that -- GitLab