From 1ef7e36f3c85d9f66584548ffa4a27970a7bfc2d Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 11 Apr 2015 13:56:21 +0000 Subject: [PATCH] * some fixes for handling parameters passed on the stack git-svn-id: trunk@30545 - --- compiler/avr/cgcpu.pas | 17 ++++++++--------- compiler/avr/cpupara.pas | 9 +++------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/compiler/avr/cgcpu.pas b/compiler/avr/cgcpu.pas index cbea43c8bf..02ec029331 100644 --- a/compiler/avr/cgcpu.pas +++ b/compiler/avr/cgcpu.pas @@ -313,24 +313,23 @@ unit cgcpu; for i:=1 to tcgsize2size[paraloc.Size] do begin - if not(assigned(hp)) or - (tcgsize2size[hp^.size]<>1) or - (hp^.shiftval<>0) then + if not(assigned(hp)) then internalerror(2014011105); case hp^.loc of LOC_REGISTER,LOC_CREGISTER: - a_load_const_reg(list,hp^.size,(a shr (8*(i-1))) and $ff,hp^.register); - LOC_REFERENCE,LOC_CREFERENCE: begin - list.concat(taicpu.op_const(A_PUSH,(a shr (8*(i-1))) and $ff)); + if (tcgsize2size[hp^.size]<>1) or + (hp^.shiftval<>0) then + internalerror(2015041101); + a_load_const_reg(list,hp^.size,(a shr (8*(i-1))) and $ff,hp^.register); + hp:=hp^.Next; end; + LOC_REFERENCE,LOC_CREFERENCE: + list.concat(taicpu.op_const(A_PUSH,(a shr (8*(i-1))) and $ff)); else internalerror(2002071004); end; - hp:=hp^.Next; end; - if assigned(hp) then - internalerror(2014011104); end; diff --git a/compiler/avr/cpupara.pas b/compiler/avr/cpupara.pas index 93782991cc..86c3484044 100644 --- a/compiler/avr/cpupara.pas +++ b/compiler/avr/cpupara.pas @@ -324,11 +324,6 @@ unit cpupara; else internalerror(2005082901); end - else if paracgsize<>OS_S8 then - begin - paraloc^.size:=OS_8; - paraloc^.def:=u8inttype - end else begin paraloc^.size:=paracgsize; @@ -340,6 +335,8 @@ unit cpupara; if nextintreg>=RS_R8 then begin paraloc^.loc:=LOC_REGISTER; + paraloc^.size:=OS_8; + paraloc^.def:=u8inttype; paraloc^.register:=newreg(R_INTREGISTER,nextintreg,R_SUBWHOLE); inc(nextintreg); end @@ -349,9 +346,9 @@ unit cpupara; end; LOC_REFERENCE: begin - paraloc^.size:=OS_ADDR; if push_addr_param(hp.varspez,paradef,p.proccalloption) then begin + paraloc^.size:=OS_ADDR; paraloc^.def:=getpointerdef(paradef); assignintreg end