diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-08-27 18:28:57 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-08-27 18:28:57 +0000 |
commit | 56488c46072b8a568198eb90f033beb982ec371a (patch) | |
tree | 8cf971b75ef94fdec16b1e8bc9c13eccca433d00 /compiler/x86 | |
parent | 7a40d09b2e46459806c0c6f7fee35b22f12a410e (diff) | |
download | fpc-56488c46072b8a568198eb90f033beb982ec371a.tar.gz |
* replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
for short circuit boolean and/or-expressions if optimizations are off, but
with optimisations enabled the generated code is the same (except for JVM
because the jump threading optimisation isn't enabled there yet).
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@31431 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/x86')
-rw-r--r-- | compiler/x86/nx86cnv.pas | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index a4449a6321..8b51b57f54 100644 --- a/compiler/x86/nx86cnv.pas +++ b/compiler/x86/nx86cnv.pas @@ -92,13 +92,9 @@ implementation i : integer; {$endif not cpu64bitalu} resflags : tresflags; - hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; + hlabel : tasmlabel; newsize : tcgsize; begin - oldTrueLabel:=current_procinfo.CurrTrueLabel; - oldFalseLabel:=current_procinfo.CurrFalseLabel; - current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); - current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -115,8 +111,6 @@ implementation hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true) else location.size:=newsize; - current_procinfo.CurrTrueLabel:=oldTrueLabel; - current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; end; @@ -184,13 +178,13 @@ implementation location_reset(location,LOC_REGISTER,def_cgsize(resultdef)); location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); current_asmdata.getjumplabel(hlabel); - cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_label(current_asmdata.CurrAsmList,left.location.truelabel); if not(is_cbool(resultdef)) then cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,1,location.register) else cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,-1,location.register); cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); - cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_label(current_asmdata.CurrAsmList,left.location.falselabel); cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,0,location.register); cg.a_label(current_asmdata.CurrAsmList,hlabel); end; @@ -226,8 +220,6 @@ implementation cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,location.size,location.register,location.register); end end; - current_procinfo.CurrTrueLabel:=oldTrueLabel; - current_procinfo.CurrFalseLabel:=oldFalseLabel; end; |