diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-07-01 19:35:22 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2007-07-01 19:35:22 +0000 |
commit | 5f023ed3e7ca1864e5fa189110a50f850fce4d20 (patch) | |
tree | 92f68a5eeca1ed5321084855496a914e00ac9163 /compiler/ncgset.pas | |
parent | 0d183c5e001516fda4e6799490cd2dd9f63649fc (diff) | |
download | fpc-5f023ed3e7ca1864e5fa189110a50f850fce4d20.tar.gz |
* fixed generic in-code in case left = LOC_JUMP
* fixed generic and x86 in-code in case genjumps=true and
complexity(right)>complexity(left) (not sure if possible
in practice currently, but better safe than sorry)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@7912 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgset.pas')
-rw-r--r-- | compiler/ncgset.pas | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/compiler/ncgset.pas b/compiler/ncgset.pas index feed41098b..d995445b5b 100644 --- a/compiler/ncgset.pas +++ b/compiler/ncgset.pas @@ -207,15 +207,16 @@ implementation var adjustment : aint; l, l2 : tasmlabel; - href : treference; - hr,hr2, + otl, ofl : tasmlabel; + hr, pleftreg : tregister; setparts : Tsetparts; opsize : tcgsize; uopsize : tcgsize; orgopsize : tcgsize; genjumps, - use_small : boolean; + use_small, + isjump : boolean; i,numparts : byte; needslabel : Boolean; begin @@ -232,10 +233,36 @@ implementation opsize := uopsize; needslabel := false; - { calculate both operators } - { the complex one first } - firstcomplex(self); + isjump:=false; + if (left.expectloc=LOC_JUMP) then + begin + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); + isjump:=true; + end + else if not genjumps then + { calculate both operators } + { the complex one first } + { only if left will not be a LOC_JUMP, to keep complexity in the } + { code generator down. This almost never happens anyway, only in } + { case like "if ((a in someset) in someboolset) then" etc } + { also not in case of genjumps, because then we don't secondpass } + { right at all (so we have to make sure that "right" really is } + { "right" and not "swapped left" in that case) } + firstcomplex(self); + secondpass(left); + if isjump then + begin + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true); + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; + end + else if (left.location.loc=LOC_JUMP) then + internalerror(2007070101); + { Only process the right if we are not generating jumps } if not genjumps then secondpass(right); |