diff --git a/compiler/arm/narmcnv.pas b/compiler/arm/narmcnv.pas index 2a8d9948fa..24c26c78f2 100644 --- a/compiler/arm/narmcnv.pas +++ b/compiler/arm/narmcnv.pas @@ -108,8 +108,6 @@ implementation firstpass(left); end; result := nil; - if registersfpu<1 then - registersfpu:=1; expectloc:=LOC_FPUREGISTER; end; end; diff --git a/compiler/arm/narminl.pas b/compiler/arm/narminl.pas index d3efd887d5..aa84b0a47f 100644 --- a/compiler/arm/narminl.pas +++ b/compiler/arm/narminl.pas @@ -92,8 +92,6 @@ implementation else begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_abs_real:=nil; end; end; @@ -106,8 +104,6 @@ implementation else begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_sqr_real:=nil; end; end; @@ -120,8 +116,6 @@ implementation else begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_sqrt_real := nil; end; end; @@ -131,8 +125,6 @@ implementation function tarminlinenode.first_arctan_real: tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); result:=nil; end; @@ -140,16 +132,12 @@ implementation function tarminlinenode.first_ln_real: tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); result:=nil; end; function tarminlinenode.first_cos_real: tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); result:=nil; end; @@ -157,8 +145,6 @@ implementation function tarminlinenode.first_sin_real: tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); result:=nil; end; } diff --git a/compiler/globals.pas b/compiler/globals.pas index 9543efb4d2..386995dd01 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -242,8 +242,6 @@ interface block_type : tblock_type; { type of currently parsed block } - parsing_para_level : integer; { parameter level, used to convert - proc calls to proc loads in firstcalln } compile_level : word; resolving_forward : boolean; { used to add forward reference as second ref } exceptblockcounter : integer; { each except block gets a unique number check gotos } diff --git a/compiler/globtype.pas b/compiler/globtype.pas index bbde2b89f5..6c6219fcfb 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -141,7 +141,7 @@ interface ds_dwarf_sets ); tdebugswitches = set of tdebugswitch; - + { adding a new entry here requires also adding the appropriate define in systemh.inc (FK) diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 7bf357383b..028e36f576 100644 --- a/compiler/htypechk.pas +++ b/compiler/htypechk.pas @@ -118,11 +118,7 @@ interface (tok:_UNEQUAL ;nod:unequaln;op_overloading_supported:false) { binary overloading NOT supported overload = instead } ); const - { firstcallparan without varspez we don't count the ref } -{$ifdef extdebug} - count_ref : boolean = true; -{$endif def extdebug} - allow_array_constructor : boolean = false; + allow_array_constructor : boolean = false; function node2opstr(nt:tnodetype):string; @@ -134,7 +130,6 @@ interface { Register Allocation } procedure make_not_regable(p : tnode; how: tregableinfoflags); - procedure calcregisters(p : tbinarynode;r32,fpu,mmx : word); { procvar handling } function is_procvar_load(p:tnode):boolean; @@ -702,7 +697,7 @@ implementation begin { arrays are currently never regable and pointers indexed like } { arrays do not have be made unregable, but we do need to } - { propagate the ra_addr_taken info } + { propagate the ra_addr_taken info } update_regable:=false; p:=tvecnode(p).left; end; @@ -752,63 +747,6 @@ implementation make_not_regable_intern(p,how,false); end; - { calculates the needed registers for a binary operator } - procedure calcregisters(p : tbinarynode;r32,fpu,mmx : word); - - begin - p.left_right_max; - - { Only when the difference between the left and right registers < the - wanted registers allocate the amount of registers } - - if assigned(p.left) then - begin - if assigned(p.right) then - begin - { the location must be already filled in because we need it to } - { calculate the necessary number of registers (JM) } - if p.expectloc = LOC_INVALID then - internalerror(200110101); - - if (abs(p.left.registersint-p.right.registersint) 0) or (p.left.registersfpu <> 0)) and - (p.left.registersint < p.right.registersint)) then - inc(p.registersint,r32); - if (abs(p.left.registersfpu-p.right.registersfpu)0) and - (p.left.expectloc in [LOC_REFERENCE,LOC_CREFERENCE]) and - (p.right.expectloc in [LOC_REFERENCE,LOC_CREFERENCE]) then - inc(p.registersint); - end - else - begin - if (p.left.registersint convert to rd } @@ -2003,7 +2003,7 @@ implementation tsetelementnode(right).left:=caddnode.create(subn, ctypeconvnode.create_internal(tsetelementnode(right).left,sinttype), cordconstnode.create(tsetdef(resultdef).setbase,sinttype,false)); - + { add a range or a single element? } if assigned(tsetelementnode(right).right) then begin @@ -2353,23 +2353,6 @@ implementation end; {$endif cpufpemu} expectloc:=LOC_FPUREGISTER; - { maybe we need an integer register to save } - { a reference } - if ((left.expectloc<>LOC_FPUREGISTER) or - (right.expectloc<>LOC_FPUREGISTER)) and - (left.registersint=right.registersint) then - calcregisters(self,1,1,0) - else - calcregisters(self,0,1,0); - { an add node always first loads both the left and the } - { right in the fpu before doing the calculation. However, } - { calcregisters(0,2,0) will overestimate the number of } - { necessary registers (it will make it 3 in case one of } - { the operands is already in the fpu) (JM) } - if ((left.expectloc<>LOC_FPUREGISTER) or - (right.expectloc<>LOC_FPUREGISTER)) and - (registersfpu < 2) then - inc(registersfpu); end { if both are orddefs then check sub types } @@ -2381,26 +2364,13 @@ implementation if (not(cs_full_boolean_eval in current_settings.localswitches) or (nf_short_bool in flags)) and (nodetype in [andn,orn]) then - begin - expectloc:=LOC_JUMP; - calcregisters(self,0,0,0); - end + expectloc:=LOC_JUMP else begin if nodetype in [ltn,lten,gtn,gten,equaln,unequaln] then - begin - expectloc:=LOC_FLAGS; - if (left.expectloc in [LOC_JUMP,LOC_FLAGS]) and - (left.expectloc in [LOC_JUMP,LOC_FLAGS]) then - calcregisters(self,2,0,0) - else - calcregisters(self,1,0,0); - end + expectloc:=LOC_FLAGS else - begin - expectloc:=LOC_REGISTER; - calcregisters(self,0,0,0); - end; + expectloc:=LOC_REGISTER; end; end else @@ -2410,7 +2380,6 @@ implementation if nodetype=addn then internalerror(200103291); expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end {$ifndef cpu64bit} { is there a 64 bit type ? } @@ -2423,7 +2392,6 @@ implementation expectloc:=LOC_REGISTER else expectloc:=LOC_JUMP; - calcregisters(self,2,0,0) end {$endif cpu64bit} { is there a cardinal? } @@ -2433,10 +2401,6 @@ implementation expectloc:=LOC_REGISTER else expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); - { for unsigned mul we need an extra register } - if nodetype=muln then - inc(registersint); end { generic s32bit conversion } else @@ -2445,7 +2409,6 @@ implementation expectloc:=LOC_REGISTER else expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end; end @@ -2510,21 +2473,14 @@ implementation normal temp } addstatement(newstatement,ctempdeletenode.create_normal_temp(temp)); addstatement(newstatement,ctemprefnode.create(temp)); - end - else - calcregisters(self,2,0,0) - end - else - calcregisters(self,1,0,0); + end; + end; end else {$ifdef MMXSET} {$ifdef i386} if cs_mmx in current_settings.localswitches then - begin - expectloc:=LOC_MMXREGISTER; - calcregisters(self,0,0,4); - end + expectloc:=LOC_MMXREGISTER else {$endif} {$endif MMXSET} @@ -2533,7 +2489,6 @@ implementation if assigned(result) then exit; expectloc:=LOC_CREFERENCE; - calcregisters(self,0,0,0); { here we call SET... } include(current_procinfo.flags,pi_do_call); end; @@ -2546,7 +2501,6 @@ implementation expectloc:=LOC_REGISTER else expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end { is one of the operands a string } @@ -2617,16 +2571,6 @@ implementation expectloc:=LOC_FPUREGISTER else expectloc:=LOC_FLAGS; - calcregisters(self,0,1,0); - { an add node always first loads both the left and the } - { right in the fpu before doing the calculation. However, } - { calcregisters(0,2,0) will overestimate the number of } - { necessary registers (it will make it 3 in case one of } - { the operands is already in the fpu) (JM) } - if ((left.expectloc<>LOC_FPUREGISTER) or - (right.expectloc<>LOC_FPUREGISTER)) and - (registersfpu < 2) then - inc(registersfpu); end { pointer comperation and subtraction } @@ -2636,19 +2580,16 @@ implementation expectloc:=LOC_REGISTER else expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end else if is_class_or_interface(ld) then begin expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end else if (ld.typ=classrefdef) then begin expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end { support procvar=nil,procvar<>nil } @@ -2656,7 +2597,6 @@ implementation ((rd.typ=procvardef) and (lt=niln)) then begin expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end {$ifdef SUPPORT_MMX} @@ -2666,14 +2606,12 @@ implementation is_mmx_able_array(rd) then begin expectloc:=LOC_MMXREGISTER; - calcregisters(self,0,0,1); end {$endif SUPPORT_MMX} else if (rd.typ=pointerdef) or (ld.typ=pointerdef) then begin expectloc:=LOC_REGISTER; - calcregisters(self,1,0,0); end else if (rd.typ=procvardef) and @@ -2681,13 +2619,11 @@ implementation equal_defs(rd,ld) then begin expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end else if (ld.typ=enumdef) then begin expectloc:=LOC_FLAGS; - calcregisters(self,1,0,0); end {$ifdef SUPPORT_MMX} @@ -2696,7 +2632,6 @@ implementation is_mmx_able_array(rd) then begin expectloc:=LOC_MMXREGISTER; - calcregisters(self,0,0,1); end {$endif SUPPORT_MMX} @@ -2704,7 +2639,6 @@ implementation else begin expectloc:=LOC_REGISTER; - calcregisters(self,1,0,0); end; end; diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 1753c4c974..a152de8461 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -400,11 +400,6 @@ implementation if codegenerror then exit; expectloc:=left.expectloc; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} { right is the next in the list } if assigned(right) then firstpass(right); @@ -517,25 +512,8 @@ implementation begin codegenerror:=false; firstpass(hp.left); - hp.expectloc:=hp.left.expectloc; - hp.registersint:=hp.left.registersint; - hp.registersfpu:=hp.left.registersfpu; -{$ifdef SUPPORT_MMX} - hp.registersmmx:=hp.left.registersmmx; -{$endif SUPPORT_MMX} - end - else - hp.registersint:=0; - - if hp.registersint>registersint then - registersint:=hp.registersint; - if hp.registersfpu>registersfpu then - registersfpu:=hp.registersfpu; -{$ifdef SUPPORT_MMX} - if hp.registersmmx>registersmmx then - registersmmx:=hp.registersmmx; -{$endif} + end; expectloc:=hp.expectloc; inc(count); hp:=tstatementnode(hp.right); diff --git a/compiler/ncal.pas b/compiler/ncal.pas index 1447510b5d..b11c3ec22c 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -168,11 +168,11 @@ interface procedure ppuwrite(ppufile:tcompilerppufile);override; function dogetcopy : tnode;override; procedure insertintolist(l : tnodelist);override; - function pass_1 : tnode;override; + function pass_typecheck : tnode;override; + function pass_1 : tnode;override; procedure get_paratype; - procedure insert_typeconv(do_count : boolean); - procedure det_registers; procedure firstcallparan; + procedure insert_typeconv(do_count : boolean); procedure secondcallparan;virtual;abstract; function docompare(p: tnode): boolean; override; procedure printnodetree(var t:text);override; @@ -536,11 +536,18 @@ implementation end; + function tcallparanode.pass_typecheck : tnode; + begin + { need to use get_paratype } + internalerror(200709251); + result:=nil; + end; + + function tcallparanode.pass_1 : tnode; begin - firstpass(left); - if assigned(right) then - firstpass(right); + { need to use firstcallparan } + internalerror(200709252); result:=nil; end; @@ -549,7 +556,6 @@ implementation var old_array_constructor : boolean; begin - inc(parsing_para_level); if assigned(right) then tcallparanode(right).get_paratype; old_array_constructor:=allow_array_constructor; @@ -560,7 +566,17 @@ implementation resultdef:=generrordef else resultdef:=left.resultdef; - dec(parsing_para_level); + end; + + + procedure tcallparanode.firstcallparan; + begin + if assigned(right) then + tcallparanode(right).firstcallparan; + if not assigned(left.resultdef) then + get_paratype; + firstpass(left); + expectloc:=left.expectloc; end; @@ -568,19 +584,7 @@ implementation var olddef : tdef; hp : tnode; -{$ifdef extdebug} - store_count_ref : boolean; -{$endif def extdebug} begin - inc(parsing_para_level); - -{$ifdef extdebug} - if do_count then - begin - store_count_ref:=count_ref; - count_ref:=true; - end; -{$endif def extdebug} { Be sure to have the resultdef } if not assigned(left.resultdef) then typecheckpass(left); @@ -685,10 +689,7 @@ implementation inserttypeconv(left,parasym.vardef); end; if codegenerror then - begin - dec(parsing_para_level); - exit; - end; + exit; end; { check var strings } @@ -786,38 +787,6 @@ implementation { process next node } if assigned(right) then tcallparanode(right).insert_typeconv(do_count); - - dec(parsing_para_level); -{$ifdef extdebug} - if do_count then - count_ref:=store_count_ref; -{$endif def extdebug} - end; - - - procedure tcallparanode.det_registers; - begin - if assigned(right) then - begin - tcallparanode(right).det_registers; - - registersint:=right.registersint; - registersfpu:=right.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=right.registersmmx; -{$endif} - end; - - firstpass(left); - - if left.registersint>registersint then - registersint:=left.registersint; - if left.registersfpu>registersfpu then - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - if left.registersmmx>registersmmx then - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} end; @@ -845,14 +814,6 @@ implementation end; - procedure tcallparanode.firstcallparan; - begin - if not assigned(left.resultdef) then - get_paratype; - det_registers; - end; - - function tcallparanode.docompare(p: tnode): boolean; begin docompare := @@ -2471,10 +2432,10 @@ implementation { pull in at the correct place. Used order: 1. LOC_REFERENCE with smallest offset (i386 only) - 2. LOC_REFERENCE with most registers and least complexity (non-i386 only) - 3. LOC_REFERENCE with least registers and most complexity (non-i386 only) - 4. LOC_REGISTER with most registers and most complexity - 5. LOC_REGISTER with least registers and least complexity + 2. LOC_REFERENCE with least complexity (non-i386 only) + 3. LOC_REFERENCE with most complexity (non-i386 only) + 4. LOC_REGISTER with most complexity + 5. LOC_REGISTER with least complexity For the moment we only look at the first parameter field. Combining it with multiple parameter fields will make things a lot complexer (PFV) @@ -2519,8 +2480,7 @@ implementation { pushes } if (hpcurr.parasym.paraloc[callerside].location^.reference.offset>hp.parasym.paraloc[callerside].location^.reference.offset) then {$else i386} - if (hpcurr.registersint>hp.registersint) or - (node_complexity(hpcurr)[]) then - check_stack_parameters; - end; - - { order parameters } - order_parameters; + { check for stacked parameters } + if assigned(left) and + (current_settings.optimizerswitches*[cs_opt_stackframe,cs_opt_level1]<>[]) then + check_stack_parameters; if assigned(callinitblock) then firstpass(callinitblock); @@ -2680,16 +2632,27 @@ implementation if assigned(funcretnode) then firstpass(funcretnode); + { parameters } + if assigned(left) then + tcallparanode(left).firstcallparan; + { procedure variable ? } if assigned(right) then firstpass(right); + if assigned(methodpointer) and + (methodpointer.nodetype<>typen) then + firstpass(methodpointer); + if assigned(callcleanupblock) then firstpass(callcleanupblock); if not (block_type in [bt_const,bt_type]) then include(current_procinfo.flags,pi_do_call); + { order parameters } + order_parameters; + { get a register for the return value } if (not is_void(resultdef)) then begin @@ -2703,7 +2666,6 @@ implementation is_widestring(resultdef) then begin expectloc:=LOC_REFERENCE; - registersint:=1; end else { we have only to handle the result if it is used } @@ -2713,47 +2675,15 @@ implementation enumdef, orddef : begin - if (procdefinition.proctypeoption=potype_constructor) then - begin - expectloc:=LOC_REGISTER; - registersint:=1; - end - else - begin - expectloc:=LOC_REGISTER; - if is_64bit(resultdef) then - registersint:=2 - else - registersint:=1; - end; + expectloc:=LOC_REGISTER; end; floatdef : begin expectloc:=LOC_FPUREGISTER; -{$ifdef cpufpemu} - if (cs_fp_emulation in current_settings.moduleswitches) then - registersint:=1 - else -{$endif cpufpemu} -{$ifdef m68k} - if (tfloatdef(resultdef).floattype=s32real) then - registersint:=1 - else -{$endif m68k} - registersfpu:=1; end; else begin expectloc:=procdefinition.funcretloc[callerside].loc; - if (expectloc = LOC_REGISTER) then -{$ifndef cpu64bit} - if (resultdef.size > sizeof(aint)) then - registersint:=2 - else -{$endif cpu64bit} - registersint:=1 - else - registersint:=0; end; end; end @@ -2762,49 +2692,6 @@ implementation end else expectloc:=LOC_VOID; - -{$ifdef m68k} - { we need one more address register for virtual calls on m68k } - if (po_virtualmethod in procdefinition.procoptions) then - inc(registersint); -{$endif m68k} - { a fpu can be used in any procedure !! } -{$ifdef i386} - registersfpu:=procdefinition.fpu_used; -{$endif i386} - { if this is a call to a method calc the registers } - if (methodpointer<>nil) then - begin - if methodpointer.nodetype<>typen then - begin - firstpass(methodpointer); - registersfpu:=max(methodpointer.registersfpu,registersfpu); - registersint:=max(methodpointer.registersint,registersint); -{$ifdef SUPPORT_MMX } - registersmmx:=max(methodpointer.registersmmx,registersmmx); -{$endif SUPPORT_MMX} - end; - end; - - { determine the registers of the procedure variable } - { is this OK for inlined procs also ?? (PM) } - if assigned(right) then - begin - registersfpu:=max(right.registersfpu,registersfpu); - registersint:=max(right.registersint,registersint); -{$ifdef SUPPORT_MMX} - registersmmx:=max(right.registersmmx,registersmmx); -{$endif SUPPORT_MMX} - end; - { determine the registers of the procedure } - if assigned(left) then - begin - registersfpu:=max(left.registersfpu,registersfpu); - registersint:=max(left.registersint,registersint); -{$ifdef SUPPORT_MMX} - registersmmx:=max(left.registersmmx,registersmmx); -{$endif SUPPORT_MMX} - end; end; {$ifdef state_tracking} diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index ea1a697d1a..eae38704e3 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -73,8 +73,8 @@ interface cutils,verbose,globals, symconst,symdef,paramgr, aasmbase,aasmtai,aasmdata,defutil, - cgbase,procinfo,pass_2, - ncon,nset,ncgutil,cgobj,cgutils + cgbase,procinfo,pass_2,tgobj, + nutils,ncon,nset,ncgutil,cgobj,cgutils ; @@ -114,10 +114,16 @@ interface end; { are too few registers free? } - if left.location.loc=LOC_FPUREGISTER then - pushedfpu:=maybe_pushfpu(current_asmdata.CurrAsmList,right.registersfpu,left.location) - else - pushedfpu:=false; + pushedfpu:=false; +{$ifdef i386} + if (left.location.loc=LOC_FPUREGISTER) and + (node_resources_fpu(right)>=maxfpuregs) then + begin + location_force_mem(current_asmdata.CurrAsmList,left.location); + pushedfpu:=true; + end; +{$endif i386} + isjump:=(right.expectloc=LOC_JUMP); if isjump then begin @@ -141,6 +147,7 @@ interface begin tmpreg := cg.getmmregister(current_asmdata.CurrAsmList,left.location.size); cg.a_loadmm_loc_reg(current_asmdata.CurrAsmList,left.location.size,left.location,tmpreg,mms_movescalar); + location_freetemp(current_asmdata.CurrAsmList,left.location); location_reset(left.location,LOC_MMREGISTER,left.location.size); left.location.register := tmpreg; end @@ -149,6 +156,7 @@ interface begin tmpreg := cg.getfpuregister(current_asmdata.CurrAsmList,left.location.size); cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location.size,left.location,tmpreg); + location_freetemp(current_asmdata.CurrAsmList,left.location); location_reset(left.location,LOC_FPUREGISTER,left.location.size); left.location.register := tmpreg; {$ifdef x86} diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index 37bf3fd97a..45b96895aa 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -518,15 +518,13 @@ implementation right then decreasing the refcnt on left can possibly release the memory before right increased the refcnt, result is that an empty value is assigned - - calln, call destroys most registers and is therefor 'complex' But not when the result is in the flags, then loading the left node afterwards can destroy the flags. } if not(right.expectloc in [LOC_FLAGS,LOC_JUMP]) and - ((right.nodetype=calln) or - (right.resultdef.needs_inittable) or - (right.registersint>=left.registersint)) then + ((right.resultdef.needs_inittable) or + (node_complexity(right)>node_complexity(left))) then begin secondpass(right); { increment source reference counter, this is diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index 7f5f9f0315..0d9e7a34f5 100644 --- a/compiler/ncgmem.pas +++ b/compiler/ncgmem.pas @@ -831,10 +831,6 @@ implementation begin extraoffset:=tordconstnode(taddnode(right).right).value.svalue; t:=taddnode(right).left; - { First pass processed this with the assumption } - { that there was an add node which may require an } - { extra register. Fake it or die with IE10 (JM) } - t.registersint := taddnode(right).registersint; taddnode(right).left:=nil; right.free; right:=t; @@ -843,7 +839,6 @@ implementation begin extraoffset:=tordconstnode(taddnode(right).left).value.svalue; t:=taddnode(right).right; - t.registersint := right.registersint; taddnode(right).right:=nil; right.free; right:=t; @@ -855,22 +850,10 @@ implementation begin extraoffset:=-tordconstnode(taddnode(right).right).value.svalue; t:=taddnode(right).left; - t.registersint := right.registersint; taddnode(right).left:=nil; right.free; right:=t; - end -{ You also have to negate right.right in this case! I can't add an - unaryminusn without causing a crash, so I've disabled it (JM) - else if right.left.nodetype=ordconstn then - begin - extraoffset:=right.left.value; - t:=right.right; - t^.registersint := right.registersint; - putnode(right); - putnode(right.left); - right:=t; - end;} + end; end; inc(location.reference.offset, mulsize*extraoffset); diff --git a/compiler/ncgopt.pas b/compiler/ncgopt.pas index fc6ac574be..e235463aab 100644 --- a/compiler/ncgopt.pas +++ b/compiler/ncgopt.pas @@ -73,11 +73,6 @@ begin if codegenerror then exit; expectloc:=LOC_REFERENCE; - if not is_constcharnode(right) then - { it's not sure we need the register, but we can't know it here yet } - calcregisters(self,2,0,0) - else - calcregisters(self,1,0,0); end; diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 396dc6c925..c2951e22c9 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -71,8 +71,6 @@ interface a register it is expected to contain the address of the data } procedure location_get_data_ref(list:TAsmList;const l:tlocation;var ref:treference;loadref:boolean); - function maybe_pushfpu(list:TAsmList;needed : byte;var l:tlocation) : boolean; - function has_alias_name(pd:tprocdef;const s:string):boolean; procedure alloc_proc_symbol(pd: tprocdef); procedure gen_proc_symbol(list:TAsmList); @@ -214,43 +212,18 @@ implementation end; - - { DO NOT RELY on the fact that the tnode is not yet swaped - because of inlining code PM } procedure firstcomplex(p : tbinarynode); - var - hp : tnode; begin { always calculate boolean AND and OR from left to right } if (p.nodetype in [orn,andn]) and is_boolean(p.left.resultdef) then begin if nf_swapped in p.flags then - internalerror(234234); + internalerror(200709253); end else - if ( - (p.expectloc=LOC_FPUREGISTER) and - (p.right.registersfpu > p.left.registersfpu) - ) or - ( - ( - ( - ((p.left.registersfpu = 0) and (p.right.registersfpu = 0)) or - (p.expectloc<>LOC_FPUREGISTER) - ) and - (p.left.registersintnode_resources_fpu(p.left) then + p.swapleftright; end; @@ -847,27 +820,6 @@ implementation end; -{***************************************************************************** - Maybe_Save -*****************************************************************************} - - function maybe_pushfpu(list:TAsmList;needed : byte;var l:tlocation) : boolean; - begin -{$ifdef i386} - if (needed>=maxfpuregs) and - (l.loc = LOC_FPUREGISTER) then - begin - location_force_mem(list,l); - maybe_pushfpu:=true; - end - else - maybe_pushfpu:=false; -{$else i386} - maybe_pushfpu:=false; -{$endif i386} - end; - - {**************************************************************************** Init/Finalize Code ****************************************************************************} diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 900a6c21e2..ba7d0a7202 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -2022,12 +2022,6 @@ implementation (resultdef.size=normal_function_level) then include(current_procinfo.flags,pi_needs_stackframe); if tabstractprocdef(resultdef).is_addressonly then - begin - registersint:=left.registersint; - if registersint<1 then - registersint:=1; - expectloc:=LOC_REGISTER; - end + expectloc:=LOC_REGISTER else - begin - if not(left.expectloc in [LOC_CREFERENCE,LOC_REFERENCE]) then - CGMessage(parser_e_illegal_expression); - registersint:=left.registersint; - expectloc:=left.expectloc - end + begin + if not(left.expectloc in [LOC_CREFERENCE,LOC_REFERENCE]) then + CGMessage(parser_e_illegal_expression); + expectloc:=left.expectloc; + end; end; - function ttypeconvnode.first_nil_to_methodprocvar : tnode; - begin - first_nil_to_methodprocvar:=nil; - registersint:=0; - expectloc:=LOC_REFERENCE; - end; + function ttypeconvnode.first_nil_to_methodprocvar : tnode; + begin + first_nil_to_methodprocvar:=nil; + expectloc:=LOC_REFERENCE; + end; + function ttypeconvnode.first_set_to_set : tnode; var @@ -2459,8 +2427,6 @@ implementation begin first_ansistring_to_pchar:=nil; expectloc:=LOC_REGISTER; - if registersint<1 then - registersint:=1; end; @@ -2475,8 +2441,6 @@ implementation begin first_class_to_intf:=nil; expectloc:=LOC_REGISTER; - if registersint<1 then - registersint:=1; end; function ttypeconvnode._first_int_to_int : tnode; @@ -2658,15 +2622,7 @@ implementation firstpass(left); if codegenerror then exit; - - { load the value_str from the left part } - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif} expectloc:=left.expectloc; - result:=first_call_helper(convtype); end; @@ -3119,11 +3075,6 @@ implementation if codegenerror then exit; expectloc:=call.expectloc; - registersint:=call.registersint; - registersfpu:=call.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=call.registersmmx; -{$endif SUPPORT_MMX} end; end; diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 3982ee364b..75329badec 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -536,8 +536,6 @@ implementation begin result:=nil; expectloc:=LOC_CREFERENCE; - { needs to be loaded into an FPU register } - registersfpu:=1; end; function trealconstnode.docompare(p: tnode): boolean; @@ -1029,7 +1027,7 @@ implementation end; end; - + function tsetconstnode.dogetcopy : tnode; diff --git a/compiler/nflw.pas b/compiler/nflw.pas index 079395f1cb..ab7d670d86 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -500,11 +500,6 @@ implementation firstpass(left); if codegenerror then exit; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} { loop instruction } if assigned(right) then @@ -512,15 +507,6 @@ implementation firstpass(right); if codegenerror then exit; - - if registersintregistersint then - registersint:=left.registersint; - if left.registersfpu>registersfpu then - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - if left.registersmmx>registersmmx then - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - firstpass(right); - if right.registersint>registersint then - registersint:=right.registersint; - if right.registersfpu>registersfpu then - registersfpu:=right.registersfpu; -{$ifdef SUPPORT_MMX} - if right.registersmmx>registersmmx then - registersmmx:=right.registersmmx; -{$endif SUPPORT_MMX} - firstpass(t1); - if t1.registersint>registersint then - registersint:=t1.registersint; - if t1.registersfpu>registersfpu then - registersfpu:=t1.registersfpu; -{$ifdef SUPPORT_MMX} - if t1.registersmmx>registersmmx then - registersmmx:=t1.registersmmx; -{$endif SUPPORT_MMX} if assigned(t2) then begin @@ -917,20 +850,8 @@ implementation firstpass(t2); if codegenerror then exit; - if t2.registersint>registersint then - registersint:=t2.registersint; - if t2.registersfpu>registersfpu then - registersfpu:=t2.registersfpu; -{$ifdef SUPPORT_MMX} - if t2.registersmmx>registersmmx then - registersmmx:=t2.registersmmx; -{$endif SUPPORT_MMX} cg.t_times:=old_t_times; end; - - { we need at least one register for comparisons PM } - if registersint=0 then - inc(registersint); end; @@ -982,11 +903,6 @@ implementation firstpass(left); if codegenerror then exit; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} end; end; @@ -1202,14 +1118,7 @@ implementation result:=nil; expectloc:=LOC_VOID; if assigned(left) then - begin - firstpass(left); - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - end; + firstpass(left); end; @@ -1287,7 +1196,6 @@ implementation if assigned(third) then firstpass(third); end; - left_right_max; end; end; @@ -1324,24 +1232,10 @@ implementation firstpass(left); { on statements } if assigned(right) then - begin - firstpass(right); - registersint:=max(registersint,right.registersint); - registersfpu:=max(registersfpu,right.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(registersmmx,right.registersmmx); -{$endif SUPPORT_MMX} - end; + firstpass(right); { else block } if assigned(t1) then - begin - firstpass(t1); - registersint:=max(registersint,t1.registersint); - registersfpu:=max(registersfpu,t1.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(registersmmx,t1.registersmmx); -{$endif SUPPORT_MMX} - end; + firstpass(t1); end; @@ -1394,17 +1288,9 @@ implementation firstpass(left); firstpass(right); - left_right_max; if assigned(t1) then - begin - firstpass(t1); - registersint:=max(registersint,t1.registersint); - registersfpu:=max(registersfpu,t1.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(registersmmx,t1.registersmmx); -{$endif SUPPORT_MMX} - end; + firstpass(t1); end; @@ -1469,30 +1355,11 @@ implementation result:=nil; include(current_procinfo.flags,pi_do_call); expectloc:=LOC_VOID; - registersint:=0; - registersfpu:=0; -{$ifdef SUPPORT_MMX} - registersmmx:=0; -{$endif SUPPORT_MMX} if assigned(left) then - begin - firstpass(left); - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - end; + firstpass(left); if assigned(right) then - begin - firstpass(right); - registersint:=max(registersint,right.registersint); - registersfpu:=max(registersfpu,right.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(registersmmx,right.registersmmx); -{$endif SUPPORT_MMX} - end; + firstpass(right); end; diff --git a/compiler/ninl.pas b/compiler/ninl.pas index c3d28c5692..0d96a23e47 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1483,7 +1483,6 @@ implementation else typecheckpass(left); end; - inc(parsing_para_level); { handle intern constant functions in separate case } if nf_inlineconst in flags then @@ -2379,7 +2378,6 @@ implementation (left.nodetype=callparan) then tcallparanode(left).get_paratype; end; - dec(parsing_para_level); end; @@ -2400,10 +2398,8 @@ implementation tcallparanode(left).firstcallparan else firstpass(left); - left_max; end; - inc(parsing_para_level); { intern const should already be handled } if nf_inlineconst in flags then internalerror(200104044); @@ -2435,15 +2431,11 @@ implementation in_sizeof_x: begin - if registersint<1 then - registersint:=1; expectloc:=LOC_REGISTER; end; in_typeof_x: begin - if registersint<1 then - registersint:=1; expectloc:=LOC_REGISTER; end; @@ -2454,8 +2446,6 @@ implementation else begin { ansi/wide string } - if registersint<1 then - registersint:=1; expectloc:=LOC_REGISTER; end; end; @@ -2463,28 +2453,16 @@ implementation in_typeinfo_x: begin expectloc:=LOC_REGISTER; - registersint:=1; end; in_assigned_x: begin expectloc := LOC_JUMP; - registersint:=1; end; in_pred_x, in_succ_x: begin - if is_64bit(resultdef) then - begin - if (registersint<2) then - registersint:=2 - end - else - begin - if (registersint<1) then - registersint:=1; - end; expectloc:=LOC_REGISTER; end; @@ -2586,23 +2564,6 @@ implementation firstpass(newblock); { return new node } result := newblock; - end - else if (left.resultdef.typ in [enumdef,pointerdef]) or - is_ordinal(left.resultdef) then - begin - { two paras ? } - if assigned(tcallparanode(left).right) then - begin - { need we an additional register ? } - if not(is_constintnode(tcallparanode(tcallparanode(left).right).left)) and - (tcallparanode(tcallparanode(left).right).left.expectloc in [LOC_CREFERENCE,LOC_REFERENCE]) and - (tcallparanode(tcallparanode(left).right).left.registersint<=1) then - inc(registersint); - - { do we need an additional register to restore the first parameter? } - if tcallparanode(tcallparanode(left).right).left.registersint>=registersint then - inc(registersint); - end; end; end; @@ -2610,12 +2571,6 @@ implementation in_exclude_x_y: begin expectloc:=LOC_VOID; - - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} end; in_pack_x_y_z, @@ -2698,11 +2653,6 @@ implementation in_assert_x_y : begin expectloc:=LOC_VOID; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} end; in_low_x, @@ -2746,12 +2696,10 @@ implementation in_get_caller_frame: begin expectloc:=LOC_REGISTER; - registersint:=1; end; in_get_caller_addr: begin expectloc:=LOC_REGISTER; - registersint:=1; end; in_prefetch_var: @@ -2767,7 +2715,6 @@ implementation else internalerror(89); end; - dec(parsing_para_level); end; {$maxfpuregisters default} diff --git a/compiler/nld.pas b/compiler/nld.pas index e55f1c51f2..b7b432f54a 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -351,11 +351,6 @@ implementation begin result:=nil; expectloc:=LOC_REFERENCE; - registersint:=0; - registersfpu:=0; -{$ifdef SUPPORT_MMX} - registersmmx:=0; -{$endif SUPPORT_MMX} if (cs_create_pic in current_settings.moduleswitches) and not(symtableentry.typ in [paravarsym,localvarsym]) then include(current_procinfo.flags,pi_needs_got); @@ -380,11 +375,6 @@ implementation else if (tabstractvarsym(symtableentry).varspez=vs_const) then expectloc:=LOC_CREFERENCE; - { we need a register for call by reference parameters } - if paramanager.push_addr_param(tabstractvarsym(symtableentry).varspez,tabstractvarsym(symtableentry).vardef,pocall_default) then - registersint:=1; - if ([vo_is_thread_var,vo_is_dll_var]*tabstractvarsym(symtableentry).varoptions)<>[] then - registersint:=1; if (target_info.system=system_powerpc_darwin) and ([vo_is_dll_var,vo_is_external] * tabstractvarsym(symtableentry).varoptions <> []) then include(current_procinfo.flags,pi_needs_got); @@ -406,11 +396,6 @@ implementation begin expectloc:=LOC_CREFERENCE; firstpass(left); - registersint:=max(registersint,left.registersint); - registersfpu:=max(registersfpu,left.registersfpu); - {$ifdef SUPPORT_MMX} - registersmmx:=max(registersmmx,left.registersmmx); - {$endif SUPPORT_MMX} end; end; labelsym : @@ -716,12 +701,6 @@ implementation end; end; end; - - registersint:=left.registersint+right.registersint; - registersfpu:=max(left.registersfpu,right.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(left.registersmmx,right.registersmmx); -{$endif SUPPORT_MMX} end; @@ -782,7 +761,6 @@ implementation firstpass(left); firstpass(right); expectloc:=LOC_CREFERENCE; - calcregisters(self,0,0,0); result:=nil; end; @@ -968,15 +946,13 @@ implementation end; end; expectloc:=LOC_CREFERENCE; - calcregisters(self,0,0,0); end; function tarrayconstructornode.docompare(p: tnode): boolean; - - begin - docompare:=inherited docompare(p); - end; + begin + docompare:=inherited docompare(p); + end; {***************************************************************************** diff --git a/compiler/nmat.pas b/compiler/nmat.pas index db7b1c046c..fa1a847e0b 100644 --- a/compiler/nmat.pas +++ b/compiler/nmat.pas @@ -434,7 +434,6 @@ implementation if assigned(result) then exit; expectloc:=LOC_REGISTER; - calcregisters(self,2,0,0); end else {$endif cpu64bit} @@ -442,9 +441,6 @@ implementation result := first_moddivint; if assigned(result) then exit; - left_right_max; - if left.registersint<=right.registersint then - inc(registersint); end; expectloc:=LOC_REGISTER; end; @@ -573,7 +569,6 @@ implementation if (right.nodetype<>ordconstn) then inc(regs); expectloc:=LOC_REGISTER; - calcregisters(self,regs,0,0); end; @@ -722,44 +717,15 @@ implementation end else begin - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - if (left.resultdef.typ=floatdef) then - begin - if (left.expectloc<>LOC_REGISTER) and - (registersfpu<1) then - registersfpu:=1; - expectloc:=LOC_FPUREGISTER; - end + expectloc:=LOC_FPUREGISTER {$ifdef SUPPORT_MMX} else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then - begin - if (left.expectloc<>LOC_MMXREGISTER) and - (registersmmx<1) then - registersmmx:=1; - end + expectloc:=LOC_MMXREGISTER {$endif SUPPORT_MMX} -{$ifndef cpu64bit} - else if is_64bit(left.resultdef) then - begin - if (left.expectloc<>LOC_REGISTER) and - (registersint<2) then - registersint:=2; - expectloc:=LOC_REGISTER; - end -{$endif cpu64bit} else if (left.resultdef.typ=orddef) then - begin - if (left.expectloc<>LOC_REGISTER) and - (registersint<1) then - registersint:=1; - expectloc:=LOC_REGISTER; - end; + expectloc:=LOC_REGISTER; end; end; @@ -909,18 +875,10 @@ implementation exit; expectloc:=left.expectloc; - registersint:=left.registersint; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} if is_boolean(resultdef) then begin if (expectloc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then - begin - expectloc:=LOC_REGISTER; - if (registersint<1) then - registersint:=1; - end; + expectloc:=LOC_REGISTER; { before loading it into flags we need to load it into a register thus 1 register is need PM } {$ifdef cpuflags} @@ -932,32 +890,19 @@ implementation {$ifdef SUPPORT_MMX} if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then - begin - if (left.expectloc<>LOC_MMXREGISTER) and - (registersmmx<1) then - registersmmx:=1; - end + expectloc:=LOC_MMXREGISTER else {$endif SUPPORT_MMX} {$ifndef cpu64bit} if is_64bit(left.resultdef) then begin if (expectloc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then - begin - expectloc:=LOC_REGISTER; - if (registersint<2) then - registersint:=2; - end; + expectloc:=LOC_REGISTER; end else {$endif cpu64bit} if is_integer(left.resultdef) then - begin - if (left.expectloc<>LOC_REGISTER) and - (registersint<1) then - registersint:=1; - expectloc:=LOC_REGISTER; - end; + expectloc:=LOC_REGISTER; end; {$ifdef state_tracking} diff --git a/compiler/nmem.pas b/compiler/nmem.pas index be500bbb0a..b86146398c 100644 --- a/compiler/nmem.pas +++ b/compiler/nmem.pas @@ -168,12 +168,7 @@ implementation result:=nil; expectloc:=LOC_REGISTER; if left.nodetype<>typen then - begin - firstpass(left); - registersint:=left.registersint; - end; - if registersint<1 then - registersint:=1; + firstpass(left); end; @@ -241,7 +236,6 @@ implementation resultdef:=voidpointertype; {$ifdef dummy} { currently parentfps are never loaded in registers (FK) } - if (current_procinfo.procdef.parast.symtablelevel<>parentpd.parast.symtablelevel) then begin currpi:=current_procinfo; @@ -265,7 +259,6 @@ implementation begin result:=nil; expectloc:=LOC_REGISTER; - registersint:=1; end; @@ -458,9 +451,6 @@ implementation if (mark_read_written) then begin - { this is like the function addr } - inc(parsing_para_level); - { This is actually only "read", but treat it nevertheless as } { modified due to the possible use of pointers } { To avoid false positives regarding "uninitialised" } @@ -469,7 +459,6 @@ implementation { vsf_must_be_valid so it doesn't get changed into } { vsf_referred_not_inited } set_varstate(left,vs_read,[vsf_must_be_valid]); - dec(parsing_para_level); end; end; @@ -481,13 +470,6 @@ implementation if codegenerror then exit; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - if registersint<1 then - registersint:=1; { is this right for object of methods ?? } expectloc:=LOC_REGISTER; end; @@ -534,12 +516,6 @@ implementation if codegenerror then exit; - registersint:=max(left.registersint,1); - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - expectloc:=LOC_REFERENCE; end; @@ -623,18 +599,9 @@ implementation if codegenerror then exit; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} { classes must be dereferenced implicit } if is_class_or_interface(left.resultdef) then - begin - if registersint=0 then - registersint:=1; - expectloc:=LOC_REFERENCE; - end + expectloc:=LOC_REFERENCE else begin case left.expectloc of @@ -875,58 +842,6 @@ implementation else if is_widestring(left.resultdef) and (tf_winlikewidestring in target_info.flags) then exclude(flags,nf_callunique); - { the register calculation is easy if a const index is used } - if right.nodetype=ordconstn then - begin - registersint:=left.registersint; - - { for ansi/wide strings, we need at least one register } - if is_ansistring(left.resultdef) or - is_widestring(left.resultdef) or - { ... as well as for dynamic arrays } - is_dynamic_array(left.resultdef) then - registersint:=max(registersint,1); - end - else - begin - { this rules are suboptimal, but they should give } - { good results } - registersint:=max(left.registersint,right.registersint); - - { for ansi/wide strings, we need at least one register } - if is_ansistring(left.resultdef) or - is_widestring(left.resultdef) or - { ... as well as for dynamic arrays } - is_dynamic_array(left.resultdef) then - registersint:=max(registersint,1); - - { need we an extra register when doing the restore ? } - if (left.registersint<=right.registersint) and - { only if the node needs less than 3 registers } - { two for the right node and one for the } - { left address } - (registersint<3) then - inc(registersint); - - { need we an extra register for the index ? } - if (right.expectloc<>LOC_REGISTER) - { only if the right node doesn't need a register } - and (right.registersint<1) then - inc(registersint); - - { not correct, but what works better ? - if left.registersint>0 then - registersint:=max(registersint,2) - else - min. one register - registersint:=max(registersint,1); - } - end; - - registersfpu:=max(left.registersfpu,right.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(left.registersmmx,right.registersmmx); -{$endif SUPPORT_MMX} if (not is_packed_array(left.resultdef)) or ((tarraydef(left.resultdef).elepackedbitsize mod 8) = 0) then if left.expectloc=LOC_CREFERENCE then @@ -992,11 +907,6 @@ implementation begin result:=nil; expectloc:=LOC_VOID; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} end; diff --git a/compiler/node.pas b/compiler/node.pas index 303a043855..b85307155f 100644 --- a/compiler/node.pas +++ b/compiler/node.pas @@ -290,11 +290,6 @@ interface { there are some properties about the node stored } flags : tnodeflags; ppuidx : longint; - { the number of registers needed to evalute the node } - registersint,registersfpu,registersmm : longint; { must be longint !!!! } -{$ifdef SUPPORT_MMX} - registersmmx : longint; -{$endif SUPPORT_MMX} resultdef : tdef; resultdefderef : tderef; fileinfo : tfileposinfo; @@ -389,7 +384,6 @@ interface function docompare(p : tnode) : boolean;override; function dogetcopy : tnode;override; procedure insertintolist(l : tnodelist);override; - procedure left_max; procedure printnodedata(var t:text);override; end; @@ -409,7 +403,6 @@ interface procedure swapleftright; function dogetcopy : tnode;override; procedure insertintolist(l : tnodelist);override; - procedure left_right_max; procedure printnodedata(var t:text);override; procedure printnodelist(var t:text); end; @@ -695,11 +688,6 @@ implementation fileinfo:=current_filepos; localswitches:=current_settings.localswitches; resultdef:=nil; - registersint:=0; - registersfpu:=0; -{$ifdef SUPPORT_MMX} - registersmmx:=0; -{$endif SUPPORT_MMX} {$ifdef EXTDEBUG} maxfirstpasscount:=0; firstpasscount:=0; @@ -727,11 +715,6 @@ implementation expectloc:=LOC_INVALID; { updated by secondpass } location.loc:=LOC_INVALID; - registersint:=0; - registersfpu:=0; -{$ifdef SUPPORT_MMX} - registersmmx:=0; -{$endif SUPPORT_MMX} {$ifdef EXTDEBUG} maxfirstpasscount:=0; firstpasscount:=0; @@ -821,9 +804,7 @@ implementation write(t,', resultdef = '); write(t,', pos = (',fileinfo.line,',',fileinfo.column,')', ', loc = ',tcgloc2str[location.loc], - ', expectloc = ',tcgloc2str[expectloc], - ', intregs = ',registersint, - ', fpuregs = ',registersfpu); + ', expectloc = ',tcgloc2str[expectloc]); end; @@ -898,12 +879,6 @@ implementation p.location:=location; p.parent:=parent; p.flags:=flags; - p.registersint:=registersint; - p.registersfpu:=registersfpu; -{$ifdef SUPPORT_MMX} - p.registersmmx:=registersmmx; - p.registersmm:=registersmm; -{$endif SUPPORT_MMX} p.resultdef:=resultdef; p.fileinfo:=fileinfo; p.localswitches:=localswitches; @@ -1017,16 +992,6 @@ implementation end; - procedure tunarynode.left_max; - begin - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - end; - - procedure tunarynode.concattolist(l : tlinkedlist); begin left.parent:=self; @@ -1155,30 +1120,6 @@ implementation end; - procedure tbinarynode.left_right_max; - begin - if assigned(left) then - begin - if assigned(right) then - begin - registersint:=max(left.registersint,right.registersint); - registersfpu:=max(left.registersfpu,right.registersfpu); -{$ifdef SUPPORT_MMX} - registersmmx:=max(left.registersmmx,right.registersmmx); -{$endif SUPPORT_MMX} - end - else - begin - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - end; - end; - end; - - procedure tbinarynode.printnodedata(var t:text); begin inherited printnodedata(t); diff --git a/compiler/nopt.pas b/compiler/nopt.pas index 4edeeadb4f..a3eefb215b 100644 --- a/compiler/nopt.pas +++ b/compiler/nopt.pas @@ -140,7 +140,6 @@ function taddsstringoptnode.pass_1: tnode; begin pass_1 := nil; expectloc:= LOC_REFERENCE; - calcregisters(self,0,0,0); { here we call STRCONCAT or STRCMP or STRCOPY } include(current_procinfo.flags,pi_do_call); end; diff --git a/compiler/nset.pas b/compiler/nset.pas index 60fe479b58..e53c7adea1 100644 --- a/compiler/nset.pas +++ b/compiler/nset.pas @@ -153,7 +153,6 @@ implementation exit; expectloc:=left.expectloc; - calcregisters(self,0,0,0); end; @@ -335,22 +334,6 @@ implementation firstpass(left); if codegenerror then exit; - - left_right_max; - - if tsetdef(right.resultdef).settype<>smallset then - begin - if registersint < 3 then - registersint := 3; - end - else - begin - { a smallset needs maybe an misc. register } - if (left.nodetype<>ordconstn) and - not(right.expectloc in [LOC_CREGISTER,LOC_REGISTER]) and - (right.registersint<1) then - inc(registersint); - end; end; @@ -396,7 +379,6 @@ implementation firstpass(right); if codegenerror then exit; - left_right_max; expectloc:=left.expectloc; end; @@ -607,7 +589,6 @@ implementation function tcasenode.pass_1 : tnode; var old_t_times : longint; - hp : tnode; i : integer; begin result:=nil; @@ -617,12 +598,6 @@ implementation set_varstate(left,vs_read,[vsf_must_be_valid]); if codegenerror then exit; - registersint:=left.registersint; - registersfpu:=left.registersfpu; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} - { walk through all instructions } { estimates the repeat of each instruction } @@ -635,42 +610,12 @@ implementation end; { first case } for i:=0 to blocks.count-1 do - begin - - firstpass(pcaseblock(blocks[i])^.statement); - - { searchs max registers } - hp:=pcaseblock(blocks[i])^.statement; - if hp.registersint>registersint then - registersint:=hp.registersint; - if hp.registersfpu>registersfpu then - registersfpu:=hp.registersfpu; -{$ifdef SUPPORT_MMX} - if hp.registersmmx>registersmmx then - registersmmx:=hp.registersmmx; -{$endif SUPPORT_MMX} - end; + firstpass(pcaseblock(blocks[i])^.statement); { may be handle else tree } if assigned(elseblock) then - begin - firstpass(elseblock); - if registersintorddef) or (torddef(pd.returndef).ordtype<>bool8bit)) then diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 5013c09bb5..7d15728b05 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -258,7 +258,6 @@ implementation { set para parsing values } in_args:=true; named_args_allowed:=false; - inc(parsing_para_level); allow_array_constructor:=true; p2:=nil; repeat @@ -307,7 +306,6 @@ implementation end; until not try_to_consume(_COMMA); allow_array_constructor:=old_allow_array_constructor; - dec(parsing_para_level); in_args:=prev_in_args; named_args_allowed:=old_named_args_allowed; parse_paras:=p2; diff --git a/compiler/pinline.pas b/compiler/pinline.pas index b5bf261c79..f91c02bc05 100644 --- a/compiler/pinline.pas +++ b/compiler/pinline.pas @@ -498,10 +498,8 @@ implementation end; { last param must be var } destppn:=ppn.left; - inc(parsing_para_level); valid_for_var(destppn,true); set_varstate(destppn,vs_written,[]); - dec(parsing_para_level); { first param must be a string or dynamic array ...} isarray:=is_dynamic_array(destppn.resultdef); if not((destppn.resultdef.typ=stringdef) or diff --git a/compiler/powerpc/nppccnv.pas b/compiler/powerpc/nppccnv.pas index 966a3a502f..2ebf63ac52 100644 --- a/compiler/powerpc/nppccnv.pas +++ b/compiler/powerpc/nppccnv.pas @@ -102,8 +102,6 @@ implementation firstpass(left); end; result := nil; - if registersfpu<1 then - registersfpu:=1; expectloc:=LOC_FPUREGISTER; end; diff --git a/compiler/powerpc64/nppccnv.pas b/compiler/powerpc64/nppccnv.pas index 50fe4c3aba..e3b75c0c10 100644 --- a/compiler/powerpc64/nppccnv.pas +++ b/compiler/powerpc64/nppccnv.pas @@ -85,8 +85,6 @@ begin end; firstpass(left); result := nil; - if registersfpu < 1 then - registersfpu := 1; expectloc := LOC_FPUREGISTER; end; diff --git a/compiler/ppcgen/ngppcadd.pas b/compiler/ppcgen/ngppcadd.pas index 99d061a0ad..b11d655f78 100644 --- a/compiler/ppcgen/ngppcadd.pas +++ b/compiler/ppcgen/ngppcadd.pas @@ -76,7 +76,6 @@ implementation firstpass(left); firstpass(right); expectloc := LOC_FLAGS; - calcregisters(self,2,0,0); exit; end; result := inherited pass_1; diff --git a/compiler/ppcgen/ngppcinl.pas b/compiler/ppcgen/ngppcinl.pas index 79c2ba036e..e482918140 100644 --- a/compiler/ppcgen/ngppcinl.pas +++ b/compiler/ppcgen/ngppcinl.pas @@ -66,23 +66,16 @@ implementation if (current_settings.cputype >= cpu_PPC970) then begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_sqrt_real := nil; end else result:=inherited first_sqrt_real; end; - + function tgppcinlinenode.first_abs_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_abs_real := nil; end; @@ -90,11 +83,6 @@ implementation function tgppcinlinenode.first_sqr_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_sqr_real := nil; end; diff --git a/compiler/psub.pas b/compiler/psub.pas index ae142b357a..6dc71d60a2 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -756,8 +756,11 @@ implementation { firstpass everything } flowcontrol:=[]; do_firstpass(code); - if code.registersfpu>0 then +{$ifdef i386} + procdef.fpu_used:=node_resources_fpu(code); + if procdef.fpu_used>0 then include(flags,pi_uses_fpu); +{$endif i386} { do this before adding the entry code else the tail recursion recognition won't work, if this causes troubles, it must be if'ed @@ -910,9 +913,6 @@ implementation { generate code for the node tree } do_secondpass(code); aktproccode.concatlist(current_asmdata.CurrAsmList); -{$ifdef i386} - procdef.fpu_used:=code.registersfpu; -{$endif i386} { The position of the loadpara_asmnode is now known } aktproccode.insertlistafter(loadpara_asmnode.currenttai,templist); diff --git a/compiler/sparc/ncpucnv.pas b/compiler/sparc/ncpucnv.pas index 04cb3655d6..9c5ba86fb6 100644 --- a/compiler/sparc/ncpucnv.pas +++ b/compiler/sparc/ncpucnv.pas @@ -101,8 +101,6 @@ implementation firstpass(left); end; result := nil; - if registersfpu<1 then - registersfpu:=1; expectloc:=LOC_FPUREGISTER; end; diff --git a/compiler/sparc/ncpuinln.pas b/compiler/sparc/ncpuinln.pas index 445bd69197..2d81e05da8 100644 --- a/compiler/sparc/ncpuinln.pas +++ b/compiler/sparc/ncpuinln.pas @@ -73,8 +73,6 @@ implementation function tsparcinlinenode.first_abs_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_abs_real := nil; end; @@ -82,8 +80,6 @@ implementation function tsparcinlinenode.first_sqr_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_sqr_real:=nil; end; @@ -91,8 +87,6 @@ implementation function tsparcinlinenode.first_sqrt_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); first_sqrt_real := nil; end; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index cac510dcf4..c1753aa445 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -347,9 +347,6 @@ interface { number of user visibile parameters } maxparacount, minparacount : byte; -{$ifdef i386} - fpu_used : longint; { how many stack fpu must be empty } -{$endif i386} {$ifdef m68k} exp_funcretloc : tregister; { explicit funcretloc for AmigaOS } {$endif} @@ -363,7 +360,6 @@ interface procedure deref;override; procedure calcparas; function typename_paras(showhidden:boolean): string; - procedure test_if_fpu_result; function is_methodpointer:boolean;virtual; function is_addressonly:boolean;virtual; private @@ -463,6 +459,9 @@ interface {$ifdef oldregvars} regvarinfo: pregvarinfo; {$endif oldregvars} +{$ifdef i386} + fpu_used : byte; +{$endif i386} { position in aasmoutput list } procstarttai, procendtai : tai; @@ -2542,13 +2541,9 @@ implementation proccalloption:=pocall_none; procoptions:=[]; returndef:=voidtype; -{$ifdef i386} - fpu_used:=0; -{$endif i386} savesize:=sizeof(aint); requiredargarea:=0; has_paraloc_info:=false; - location_reset(funcretloc[callerside],LOC_INVALID,OS_NO); location_reset(funcretloc[calleeside],LOC_INVALID,OS_NO); end; @@ -2625,20 +2620,6 @@ implementation end; - { all functions returning in FPU are - assume to use 2 FPU registers - until the function implementation - is processed PM } - procedure tabstractprocdef.test_if_fpu_result; - begin -{$ifdef i386} - if assigned(returndef) and - (returndef.typ=floatdef) then - fpu_used:=maxfpuregs; -{$endif i386} - end; - - procedure tabstractprocdef.buildderef; begin { released procdef? } @@ -2672,11 +2653,8 @@ implementation minparacount:=0; maxparacount:=0; ppufile.getderef(returndefderef); -{$ifdef i386} - fpu_used:=ppufile.getbyte; -{$else} +{$warning TODO remove fpu_used loading} ppufile.getbyte; -{$endif i386} proctypeoption:=tproctypeoption(ppufile.getbyte); proccalloption:=tproccalloption(ppufile.getbyte); ppufile.getnormalset(procoptions); @@ -2707,13 +2685,7 @@ implementation ppufile.putderef(returndefderef); oldintfcrc:=ppufile.do_interface_crc; ppufile.do_interface_crc:=false; -{$ifdef i386} - if simplify_ppu then - fpu_used:=0; - ppufile.putbyte(fpu_used); -{$else} ppufile.putbyte(0); -{$endif} ppufile.putbyte(ord(proctypeoption)); ppufile.putbyte(ord(proccalloption)); ppufile.putnormalset(procoptions); @@ -2851,6 +2823,9 @@ implementation import_name:=nil; import_nr:=0; inlininginfo:=nil; +{$ifdef i386} + fpu_used:=maxfpuregs; +{$endif i386} end; @@ -2926,6 +2901,9 @@ implementation hasforward:=false; { Disable po_has_inlining until the derefimpl is done } exclude(procoptions,po_has_inlininginfo); +{$ifdef i386} + fpu_used:=maxfpuregs; +{$endif i386} end; @@ -3501,9 +3479,6 @@ implementation for i:=low(tcallercallee) to high(tcallercallee) do location_copy(tprocvardef(result).funcretloc[i],funcretloc[i]); tprocvardef(result).has_paraloc_info:=has_paraloc_info; -{$ifdef i386} - tprocvardef(result).fpu_used:=fpu_used; -{$endif i386} {$ifdef m68k} tprocvardef(result).exp_funcretloc:=exp_funcretloc; {$endif} @@ -3512,16 +3487,6 @@ implementation procedure tprocvardef.ppuwrite(ppufile:tcompilerppufile); begin - { here we cannot get a real good value so just give something } - { plausible (PM) } - { a more secure way would be - to allways store in a temp } -{$ifdef i386} - if is_fpu(returndef) then - fpu_used:={2}maxfpuregs - else - fpu_used:=0; -{$endif i386} inherited ppuwrite(ppufile); { Write this entry } diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index 4f28a82313..14d0b77ab9 100644 --- a/compiler/x86/nx86cnv.pas +++ b/compiler/x86/nx86cnv.pas @@ -77,17 +77,9 @@ implementation not (nf_explicit in flags) then CGMessage(type_w_convert_real_2_comp); if use_sse(resultdef) then - begin - if registersmm<1 then - registersmm:=1; - expectloc:=LOC_MMREGISTER; - end + expectloc:=LOC_MMREGISTER else - begin - if registersfpu<1 then - registersfpu:=1; - expectloc:=LOC_FPUREGISTER; - end; + expectloc:=LOC_FPUREGISTER; end; @@ -189,8 +181,6 @@ implementation begin first_int_to_real:=nil; - if registersfpu<1 then - registersfpu:=1; expectloc:=LOC_FPUREGISTER; end; @@ -244,7 +234,7 @@ implementation begin emit_const_reg(A_BT,S_Q,63,left.location.register); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_Q,left.location.register,location.register)); - end + end else begin inc(left.location.reference.offset,4); diff --git a/compiler/x86/nx86con.pas b/compiler/x86/nx86con.pas index 1518cfa5e1..dbfd69a02e 100644 --- a/compiler/x86/nx86con.pas +++ b/compiler/x86/nx86con.pas @@ -51,10 +51,7 @@ implementation begin result:=nil; if is_number_float(value_real) and not(use_sse(resultdef)) and (value_real=1.0) or (value_real=0.0) then - begin - expectloc:=LOC_FPUREGISTER; - registersfpu:=1; - end + expectloc:=LOC_FPUREGISTER else expectloc:=LOC_CREFERENCE; end; diff --git a/compiler/x86/nx86inl.pas b/compiler/x86/nx86inl.pas index 253bfc8fd7..31832daf32 100644 --- a/compiler/x86/nx86inl.pas +++ b/compiler/x86/nx86inl.pas @@ -86,7 +86,6 @@ implementation function tx86inlinenode.first_pi : tnode; begin expectloc:=LOC_FPUREGISTER; - registersfpu:=1; first_pi := nil; end; @@ -94,85 +93,45 @@ implementation function tx86inlinenode.first_arctan_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,2); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_arctan_real := nil; end; function tx86inlinenode.first_abs_real : tnode; begin if use_sse(resultdef) then - begin - expectloc:=LOC_MMREGISTER; - registersmm:=max(left.registersmm,1); - end + expectloc:=LOC_MMREGISTER else - begin - expectloc:=LOC_FPUREGISTER; - registersfpu:=max(left.registersfpu,1); - end; - registersint:=left.registersint; -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} + expectloc:=LOC_FPUREGISTER; first_abs_real := nil; end; function tx86inlinenode.first_sqr_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_sqr_real := nil; end; function tx86inlinenode.first_sqrt_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_sqrt_real := nil; end; function tx86inlinenode.first_ln_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,2); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_ln_real := nil; end; function tx86inlinenode.first_cos_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_cos_real := nil; end; function tx86inlinenode.first_sin_real : tnode; begin expectloc:=LOC_FPUREGISTER; - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} first_sin_real := nil; end; @@ -186,11 +145,6 @@ implementation {$else x86_64} expectloc:=LOC_REFERENCE; {$endif x86_64} - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} result:=nil; end; @@ -212,11 +166,6 @@ implementation {$else x86_64} expectloc:=LOC_REFERENCE; {$endif x86_64} - registersint:=left.registersint; - registersfpu:=max(left.registersfpu,1); -{$ifdef SUPPORT_MMX} - registersmmx:=left.registersmmx; -{$endif SUPPORT_MMX} result:=nil; end; end; diff --git a/compiler/x86/nx86mat.pas b/compiler/x86/nx86mat.pas index f929b74bab..31af4626a7 100644 --- a/compiler/x86/nx86mat.pas +++ b/compiler/x86/nx86mat.pas @@ -72,29 +72,16 @@ interface if (left.resultdef.typ=floatdef) then begin if use_sse(left.resultdef) then - begin - if (registersmm < 1) then - registersmm := 1; - expectloc:=LOC_MMREGISTER; - end + expectloc:=LOC_MMREGISTER else - begin - if (registersfpu < 1) then - registersfpu := 1; - expectloc:=LOC_FPUREGISTER; - end; + expectloc:=LOC_FPUREGISTER; end {$ifdef SUPPORT_MMX} else if (cs_mmx in current_settings.localswitches) and is_mmx_able_array(left.resultdef) then begin - registersint:=left.registersint; - registersfpu:=left.registersfpu; - registersmmx:=left.registersmmx; - if (left.location.loc<>LOC_MMXREGISTER) and - (registersmmx<1) then - registersmmx:=1; + expectloc:=LOC_MMXREGISTER; end {$endif SUPPORT_MMX} else diff --git a/compiler/x86/nx86set.pas b/compiler/x86/nx86set.pas index 14866de91b..fe8ddd5398 100644 --- a/compiler/x86/nx86set.pas +++ b/compiler/x86/nx86set.pas @@ -63,13 +63,6 @@ implementation firstpass(left); if codegenerror then exit; - - left_right_max; - { a smallset needs maybe an misc. register } - if (left.nodetype<>ordconstn) and - not(right.expectloc in [LOC_CREGISTER,LOC_REGISTER]) and - (right.registersint<1) then - inc(registersint); end; @@ -417,7 +410,7 @@ implementation pleftreg:=left.location.register; if (opsize >= OS_S8) or { = if signed } - ((left.resultdef.typ=orddef) and + ((left.resultdef.typ=orddef) and ((torddef(left.resultdef).low < int64(tsetdef(right.resultdef).setbase)) or (torddef(left.resultdef).high > int64(tsetdef(right.resultdef).setmax)))) or ((left.resultdef.typ=enumdef) and