From 409e176ded22ab499c6447f08eff35defd3fbc8d Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 1 Dec 2013 11:47:12 +0000 Subject: [PATCH] * Factored reusable (SEH-related) piece of code into separate procedure. git-svn-id: trunk@26157 - --- compiler/ncgutil.pas | 15 +++++++++++++++ compiler/x86_64/cgcpu.pas | 13 ++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index e5e42b0775..30137b65f4 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -138,6 +138,7 @@ interface function getprocalign : shortint; procedure gen_fpc_dummy(list : TAsmList); + procedure gen_load_frame_for_exceptfilter(list : TAsmList); implementation @@ -2213,4 +2214,18 @@ implementation end; + procedure gen_load_frame_for_exceptfilter(list : TAsmList); + var + para: tparavarsym; + begin + para:=tparavarsym(current_procinfo.procdef.paras[0]); + if not (vo_is_parentfp in para.varoptions) then + InternalError(201201142); + if (para.paraloc[calleeside].location^.loc<>LOC_REGISTER) or + (para.paraloc[calleeside].location^.next<>nil) then + InternalError(201201143); + cg.a_load_reg_reg(list,OS_ADDR,OS_ADDR,para.paraloc[calleeside].location^.register, + NR_FRAME_POINTER_REG); + end; + end. diff --git a/compiler/x86_64/cgcpu.pas b/compiler/x86_64/cgcpu.pas index eb0c7d87bd..4d8738ac3b 100644 --- a/compiler/x86_64/cgcpu.pas +++ b/compiler/x86_64/cgcpu.pas @@ -57,7 +57,7 @@ unit cgcpu; uses globtype,globals,verbose,systems,cutils,cclasses, symsym,symtable,defutil,paramgr,fmodule,cpupi, - rgobj,tgobj,rgcpu; + rgobj,tgobj,rgcpu,ncgutil; procedure Tcgx86_64.init_register_allocators; @@ -140,7 +140,6 @@ unit cgcpu; frame_offset: longint; suppress_endprologue: boolean; stackmisalignment: longint; - para: tparavarsym; xmmsize: longint; procedure push_one_reg(reg: tregister); @@ -196,15 +195,7 @@ unit cgcpu; else begin push_regs; - { load framepointer from hidden $parentfp parameter } - para:=tparavarsym(current_procinfo.procdef.paras[0]); - if not (vo_is_parentfp in para.varoptions) then - InternalError(201201142); - if (para.paraloc[calleeside].location^.loc<>LOC_REGISTER) or - (para.paraloc[calleeside].location^.next<>nil) then - InternalError(201201143); - list.concat(Taicpu.op_reg_reg(A_MOV,tcgsize2opsize[OS_ADDR], - para.paraloc[calleeside].location^.register,NR_FRAME_POINTER_REG)); + gen_load_frame_for_exceptfilter(list); { Need only as much stack space as necessary to do the calls. Exception filters don't have own local vars, and temps are 'mapped' to the parent procedure.