From f33d23922afd382e245956f396ab175d30010a0d Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 30 Sep 2001 16:12:46 +0000 Subject: [PATCH] - removed unnecessary i386 pass_2 of as- and isnode and added dummy generic ones --- compiler/i386/n386cnv.pas | 145 ++++---------------------------------- compiler/ncnv.pas | 22 +++++- 2 files changed, 33 insertions(+), 134 deletions(-) diff --git a/compiler/i386/n386cnv.pas b/compiler/i386/n386cnv.pas index 84d7045729..905c9e66ec 100644 --- a/compiler/i386/n386cnv.pas +++ b/compiler/i386/n386cnv.pas @@ -55,22 +55,14 @@ interface procedure second_call_helper(c : tconverttype); end; - ti386asnode = class(tasnode) - procedure pass_2;override; - end; - - ti386isnode = class(tisnode) - procedure pass_2;override; - end; - implementation uses - verbose,globals,systems, + verbose,systems, symconst,symdef,aasm, cgbase,temp_gen,pass_2, ncon,ncal, - cpubase,cpuasm, + cpubase, cga,tgcpu,n386util; @@ -84,7 +76,6 @@ implementation opsize : topsize; hregister, hregister2 : tregister; - l : tasmlabel; begin { insert range check if not explicit conversion } @@ -184,18 +175,14 @@ implementation end else begin - emit_reg_reg(A_XOR,S_L, - hregister2,hregister2); if (torddef(resulttype.def).typ=s64bit) and - is_signed(left.resulttype.def) then + is_signed(left.resulttype.def) then begin - getlabel(l); - emit_const_reg(A_TEST,S_L,longint($80000000),makereg32(hregister)); - emitjmp(C_Z,l); - emit_reg(A_NOT,S_L, - hregister2); - emitlab(l); - end; + emit_reg_reg(A_MOV,S_L,location.register,hregister2); + emit_const_reg(A_SAR,S_L,31,hregister2); + end + else + emit_reg_reg(A_XOR,S_L,hregister2,hregister2); end; end; end; @@ -484,123 +471,15 @@ implementation end; -{***************************************************************************** - TI386ISNODE -*****************************************************************************} - - procedure ti386isnode.pass_2; - var - pushed : tpushed; - - begin - { save all used registers } - pushusedregisters(pushed,$ff); - secondpass(left); - clear_location(location); - location.loc:=LOC_FLAGS; - location.resflags:=F_NE; - - { push instance to check: } - case left.location.loc of - LOC_REGISTER,LOC_CREGISTER: - begin - emit_reg(A_PUSH, - S_L,left.location.register); - ungetregister32(left.location.register); - end; - LOC_MEM,LOC_REFERENCE: - begin - emit_ref(A_PUSH, - S_L,newreference(left.location.reference)); - del_reference(left.location.reference); - end; - else internalerror(100); - end; - - { generate type checking } - secondpass(right); - case right.location.loc of - LOC_REGISTER,LOC_CREGISTER: - begin - emit_reg(A_PUSH, - S_L,right.location.register); - ungetregister32(right.location.register); - end; - LOC_MEM,LOC_REFERENCE: - begin - emit_ref(A_PUSH, - S_L,newreference(right.location.reference)); - del_reference(right.location.reference); - end; - else internalerror(100); - end; - saveregvars($ff); - emitcall('FPC_DO_IS'); - emit_reg_reg(A_OR,S_B,R_AL,R_AL); - popusedregisters(pushed); - maybe_loadself; - end; - - -{***************************************************************************** - TI386ASNODE -*****************************************************************************} - - procedure ti386asnode.pass_2; - var - pushed : tpushed; - begin - secondpass(left); - { save all used registers } - pushusedregisters(pushed,$ff); - - { push instance to check: } - case left.location.loc of - LOC_REGISTER,LOC_CREGISTER: - emit_reg(A_PUSH, - S_L,left.location.register); - LOC_MEM,LOC_REFERENCE: - emit_ref(A_PUSH, - S_L,newreference(left.location.reference)); - else internalerror(100); - end; - - { we doesn't modifiy the left side, we check only the type } - set_location(location,left.location); - - { generate type checking } - secondpass(right); - case right.location.loc of - LOC_REGISTER,LOC_CREGISTER: - begin - emit_reg(A_PUSH, - S_L,right.location.register); - ungetregister32(right.location.register); - end; - LOC_MEM,LOC_REFERENCE: - begin - emit_ref(A_PUSH, - S_L,newreference(right.location.reference)); - del_reference(right.location.reference); - end; - else internalerror(100); - end; - saveregvars($ff); - emitcall('FPC_DO_AS'); - { restore register, this restores automatically the } - { result } - popusedregisters(pushed); - maybe_loadself; - end; - begin ctypeconvnode:=ti386typeconvnode; - cisnode:=ti386isnode; - casnode:=ti386asnode; end. { $Log$ - Revision 1.24 2001-09-29 21:32:47 jonas + Revision 1.25 2001-09-30 16:12:47 jonas + - removed unnecessary i386 pass_2 of as- and isnode and added dummy generic ones + + Revision 1.24 2001/09/29 21:32:47 jonas * almost all second pass typeconvnode helpers are now processor independent * fixed converting boolean to int64/qword * fixed register allocation bugs which could cause internalerror 10 diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 72fc5b8112..277188dc51 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -105,6 +105,7 @@ interface constructor create(l,r : tnode);virtual; function pass_1 : tnode;override; function det_resulttype:tnode;override; + procedure pass_2;override; end; tasnodeclass = class of tasnode; @@ -112,6 +113,7 @@ interface constructor create(l,r : tnode);virtual; function pass_1 : tnode;override; function det_resulttype:tnode;override; + procedure pass_2;override; end; tisnodeclass = class of tisnode; @@ -1503,6 +1505,13 @@ implementation firstpass(result); end; + { dummy pass_2, it will never be called, but we need one since } + { you can't instantiate an abstract class } + procedure tisnode.pass_2; + + begin + end; + {***************************************************************************** TASNODE @@ -1563,6 +1572,14 @@ implementation end; + { dummy pass_2, it will never be called, but we need one since } + { you can't instantiate an abstract class } + procedure tasnode.pass_2; + + begin + end; + + begin ctypeconvnode:=ttypeconvnode; casnode:=tasnode; @@ -1570,7 +1587,10 @@ begin end. { $Log$ - Revision 1.38 2001-09-29 21:32:46 jonas + Revision 1.39 2001-09-30 16:12:46 jonas + - removed unnecessary i386 pass_2 of as- and isnode and added dummy generic ones + + Revision 1.38 2001/09/29 21:32:46 jonas * almost all second pass typeconvnode helpers are now processor independent * fixed converting boolean to int64/qword * fixed register allocation bugs which could cause internalerror 10