From e10e383b8e6d348e645b01fe2a54c9f076cf0204 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 13 Oct 2013 20:23:43 +0000 Subject: [PATCH] * MIPS: ".set macro"/".set nomacro" directives around ".cprestore" are necessary only when offset is outside smallint range. Otherwise they just clutter the assembler file. git-svn-id: trunk@25767 - --- compiler/mips/cgcpu.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/mips/cgcpu.pas b/compiler/mips/cgcpu.pas index a4113efdc4..51c3267aef 100644 --- a/compiler/mips/cgcpu.pas +++ b/compiler/mips/cgcpu.pas @@ -1196,6 +1196,7 @@ var href: treference; reg : Tsuperregister; helplist : TAsmList; + largeoffs : boolean; begin a_reg_alloc(list,NR_STACK_POINTER_REG); @@ -1306,9 +1307,12 @@ begin if (cs_create_pic in current_settings.moduleswitches) and (pi_needs_got in current_procinfo.flags) then begin - list.concat(Taicpu.op_none(A_P_SET_MACRO)); + largeoffs:=(TMIPSProcinfo(current_procinfo).save_gp_ref.offset>simm16hi); + if largeoffs then + list.concat(Taicpu.op_none(A_P_SET_MACRO)); list.concat(Taicpu.op_const(A_P_CPRESTORE,TMIPSProcinfo(current_procinfo).save_gp_ref.offset)); - list.concat(Taicpu.op_none(A_P_SET_NOMACRO)); + if largeoffs then + list.concat(Taicpu.op_none(A_P_SET_NOMACRO)); end; href.base:=NR_STACK_POINTER_REG;