mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 13:29:16 +02:00
* genlinearlist and genlinearcmplist for case blocks now allocate the flags properly
This commit is contained in:
parent
0d63a5fdda
commit
cba0ca490e
@ -177,7 +177,9 @@ implementation
|
||||
last:=0;
|
||||
lastrange:=false;
|
||||
first:=true;
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
genitem(hp);
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
|
||||
end;
|
||||
end;
|
||||
|
@ -406,7 +406,9 @@ implementation
|
||||
last:=0;
|
||||
lastrange:=false;
|
||||
first:=true;
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
genitem(hp);
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
|
||||
end;
|
||||
end;
|
||||
|
@ -769,11 +769,13 @@ implementation
|
||||
last:=0;
|
||||
first:=true;
|
||||
scratch_reg:=hlcg.getintregister(current_asmdata.CurrAsmList,opsize);
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||
genitem(hp);
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ If only one label exists, we can greatly simplify the checks to a simple comparison }
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||
if hp^._low=hp^._high then
|
||||
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ, tcgint(hp^._low.svalue), hregister, blocklabel(hp^.blockid))
|
||||
else
|
||||
@ -783,6 +785,7 @@ implementation
|
||||
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_BE, tcgint(hp^._high.svalue-hp^._low.svalue), hregister, blocklabel(hp^.blockid))
|
||||
end;
|
||||
end;
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
|
||||
end;
|
||||
end;
|
||||
@ -1080,7 +1083,9 @@ implementation
|
||||
begin
|
||||
last:=0;
|
||||
lastwasrange:=false;
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||
genitem(hp);
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
|
||||
hlcg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
|
||||
end;
|
||||
|
||||
|
@ -240,8 +240,10 @@ implementation
|
||||
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opcgsize, OC_EQ,0,hregister,blocklabel(t^.blockid))
|
||||
else
|
||||
begin
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opcgsize, aint(t^._low.svalue-last.svalue), hregister);
|
||||
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,blocklabel(t^.blockid));
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
end;
|
||||
last:=t^._low;
|
||||
lastrange:=false;
|
||||
@ -252,6 +254,7 @@ implementation
|
||||
{ it begins with the smallest label, if the value }
|
||||
{ is even smaller then jump immediately to the }
|
||||
{ ELSE-label }
|
||||
cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
if first then
|
||||
begin
|
||||
{ have we to ajust the first value ? }
|
||||
@ -287,6 +290,7 @@ implementation
|
||||
cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opcgsize, range, hregister);
|
||||
|
||||
cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_le,blocklabel(t^.blockid));
|
||||
cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
||||
last:=t^._high;
|
||||
lastrange:=true;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user