|
@@ -523,6 +523,8 @@ implementation
|
|
{ "x in [y..z]" expression }
|
|
{ "x in [y..z]" expression }
|
|
adjustment := 0;
|
|
adjustment := 0;
|
|
|
|
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
|
|
+
|
|
for i:=1 to numparts do
|
|
for i:=1 to numparts do
|
|
if setparts[i].range then
|
|
if setparts[i].range then
|
|
{ use fact that a <= x <= b <=> cardinal(x-a) <= cardinal(b-a) }
|
|
{ use fact that a <= x <= b <=> cardinal(x-a) <= cardinal(b-a) }
|
|
@@ -548,6 +550,7 @@ implementation
|
|
{ (this will never overflow since we check at the }
|
|
{ (this will never overflow since we check at the }
|
|
{ beginning whether stop-start <> 255) }
|
|
{ beginning whether stop-start <> 255) }
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_B,setparts[i].stop-setparts[i].start+1,pleftreg,l);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_B,setparts[i].stop-setparts[i].start+1,pleftreg,l);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
{ if setparts[i].start = 0 and setparts[i].stop = 255, }
|
|
{ if setparts[i].start = 0 and setparts[i].stop = 255, }
|
|
@@ -589,6 +592,7 @@ implementation
|
|
begin
|
|
begin
|
|
if left.location.loc=LOC_CONSTANT then
|
|
if left.location.loc=LOC_CONSTANT then
|
|
begin
|
|
begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
location.resflags:=F_NE;
|
|
location.resflags:=F_NE;
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER,
|
|
LOC_REGISTER,
|
|
@@ -624,6 +628,7 @@ implementation
|
|
emit_const_reg(A_MOV,S_W,1,hreg);
|
|
emit_const_reg(A_MOV,S_W,1,hreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,hreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,hreg);
|
|
|
|
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER,
|
|
LOC_REGISTER,
|
|
LOC_CREGISTER :
|
|
LOC_CREGISTER :
|
|
@@ -648,6 +653,7 @@ implementation
|
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,u32inttype,true);
|
|
hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,u32inttype,true);
|
|
hreg:=left.location.register;
|
|
hreg:=left.location.register;
|
|
|
|
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER,
|
|
LOC_REGISTER,
|
|
LOC_CREGISTER :
|
|
LOC_CREGISTER :
|
|
@@ -688,15 +694,18 @@ implementation
|
|
left.location.size := OS_16;
|
|
left.location.size := OS_16;
|
|
cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_16,left.location,NR_CX);
|
|
cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_16,left.location,NR_CX);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,15,NR_CX,l);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,15,NR_CX,l);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
{ set the zero flag }
|
|
{ set the zero flag }
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_TEST,S_B,0,NR_AL));
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_TEST,S_B,0,NR_AL));
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
|
|
+ cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
|
|
|
|
hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
|
|
hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
|
|
cg.a_label(current_asmdata.CurrAsmList,l);
|
|
cg.a_label(current_asmdata.CurrAsmList,l);
|
|
emit_const_reg(A_MOV,S_W,1,hreg);
|
|
emit_const_reg(A_MOV,S_W,1,hreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,hreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,hreg);
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_const_reg(A_TEST,S_W,right.location.value,hreg);
|
|
emit_const_reg(A_TEST,S_W,right.location.value,hreg);
|
|
|
|
|
|
cg.a_label(current_asmdata.CurrAsmList,l2);
|
|
cg.a_label(current_asmdata.CurrAsmList,l2);
|
|
@@ -720,6 +729,7 @@ implementation
|
|
hreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,opsize);
|
|
hreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,opsize);
|
|
cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,opsize,left.location.register,hreg);
|
|
cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,opsize,left.location.register,hreg);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,31,hreg,l);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,31,hreg,l);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
{ reset carry flag }
|
|
{ reset carry flag }
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO));
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO));
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
@@ -732,6 +742,7 @@ implementation
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_const_ref(A_CMP,TCGSize2OpSize[orgopsize],31,left.location.reference);
|
|
emit_const_ref(A_CMP,TCGSize2OpSize[orgopsize],31,left.location.reference);
|
|
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_BE,l);
|
|
cg.a_jmp_flags(current_asmdata.CurrAsmList,F_BE,l);
|
|
{ reset carry flag }
|
|
{ reset carry flag }
|
|
@@ -763,10 +774,12 @@ implementation
|
|
LOC_REFERENCE,LOC_CREFERENCE:
|
|
LOC_REFERENCE,LOC_CREFERENCE:
|
|
begin
|
|
begin
|
|
inc(right.location.reference.offset,(left.location.value-setbase) shr 3);
|
|
inc(right.location.reference.offset,(left.location.value-setbase) shr 3);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_const_ref(A_TEST,S_B,1 shl ((left.location.value-setbase) and 7),right.location.reference);
|
|
emit_const_ref(A_TEST,S_B,1 shl ((left.location.value-setbase) and 7),right.location.reference);
|
|
end;
|
|
end;
|
|
LOC_REGISTER,LOC_CREGISTER:
|
|
LOC_REGISTER,LOC_CREGISTER:
|
|
begin
|
|
begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_const_reg(A_TEST,TCGSize2OpSize[right.location.size],1 shl (left.location.value-setbase),right.location.register);
|
|
emit_const_reg(A_TEST,TCGSize2OpSize[right.location.size],1 shl (left.location.value-setbase),right.location.register);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
@@ -819,21 +832,27 @@ implementation
|
|
{ BE will be false for negative values }
|
|
{ BE will be false for negative values }
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,tsetdef(right.resultdef).setmax-tsetdef(right.resultdef).setbase,pleftreg,l);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,tsetdef(right.resultdef).setmax-tsetdef(right.resultdef).setbase,pleftreg,l);
|
|
{ set the zero flag }
|
|
{ set the zero flag }
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_TEST,S_B,0,NR_AL));
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_TEST,S_B,0,NR_AL));
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
|
|
|
|
cg.a_label(current_asmdata.CurrAsmList,l);
|
|
cg.a_label(current_asmdata.CurrAsmList,l);
|
|
|
|
+ cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
|
|
|
|
emit_const_reg(A_MOV,S_W,1,pleftreg);
|
|
emit_const_reg(A_MOV,S_W,1,pleftreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,pleftreg);
|
|
emit_reg_reg(A_SHL,S_W,NR_CL,pleftreg);
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
- emit_reg_reg(A_TEST,S_W,pleftreg,right.location.register);
|
|
|
|
|
|
+ begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
|
|
+ emit_reg_reg(A_TEST,S_W,pleftreg,right.location.register);
|
|
|
|
+ end;
|
|
LOC_CREFERENCE, LOC_REFERENCE :
|
|
LOC_CREFERENCE, LOC_REFERENCE :
|
|
begin
|
|
begin
|
|
if not use_small then
|
|
if not use_small then
|
|
add_extra_offset(extra_offset_reg,right.location.reference);
|
|
add_extra_offset(extra_offset_reg,right.location.reference);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_reg_ref(A_TEST,S_W,pleftreg,right.location.reference);
|
|
emit_reg_ref(A_TEST,S_W,pleftreg,right.location.reference);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
@@ -852,11 +871,15 @@ implementation
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_CX);
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
- emit_reg_reg(A_TEST,S_W,pleftreg,right.location.register);
|
|
|
|
|
|
+ begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
|
|
+ emit_reg_reg(A_TEST,S_W,pleftreg,right.location.register);
|
|
|
|
+ end;
|
|
LOC_CREFERENCE, LOC_REFERENCE :
|
|
LOC_CREFERENCE, LOC_REFERENCE :
|
|
begin
|
|
begin
|
|
if not use_small then
|
|
if not use_small then
|
|
add_extra_offset(extra_offset_reg,right.location.reference);
|
|
add_extra_offset(extra_offset_reg,right.location.reference);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
emit_reg_ref(A_TEST,S_W,pleftreg,right.location.reference);
|
|
emit_reg_ref(A_TEST,S_W,pleftreg,right.location.reference);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
@@ -887,6 +910,7 @@ implementation
|
|
|
|
|
|
{ BE will be false for negative values }
|
|
{ BE will be false for negative values }
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,tsetdef(right.resultdef).setmax-tsetdef(right.resultdef).setbase,pleftreg,l);
|
|
cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_BE,tsetdef(right.resultdef).setmax-tsetdef(right.resultdef).setbase,pleftreg,l);
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
{ reset carry flag }
|
|
{ reset carry flag }
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO));
|
|
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO));
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
cg.a_jmp_always(current_asmdata.CurrAsmList,l2);
|
|
@@ -910,6 +934,7 @@ implementation
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
|
|
+ cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_DEFAULTFLAGS);
|
|
case right.location.loc of
|
|
case right.location.loc of
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
LOC_REGISTER, LOC_CREGISTER :
|
|
emit_reg_reg(A_BT,S_L,pleftreg,right.location.register);
|
|
emit_reg_reg(A_BT,S_L,pleftreg,right.location.register);
|