* simplified det_resulttype code for include/exclude

* include/exclude doesn't use any helpers anymore in the i386 secondpass
This commit is contained in:
Jonas Maebe 2001-09-04 14:32:45 +00:00
parent 1fd6a2c5f8
commit 17b2fa3424
2 changed files with 50 additions and 64 deletions

View File

@ -733,48 +733,39 @@ implementation
asmop:=A_BTS
else
asmop:=A_BTR;
if tsetdef(left.resulttype.def).settype=smallset then
begin
if tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_CREGISTER,LOC_REGISTER] then
{ we don't need a mod 32 because this is done automatically }
{ by the bts instruction. For proper checking we would }
{ need a cmp and jmp, but this should be done by the }
{ type cast code which does range checking if necessary (FK) }
hregister:=makereg32(tcallparanode(tcallparanode(left).right).left.location.register)
else
begin
getexplicitregister32(R_EDI);
hregister:=R_EDI;
opsize:=def2def_opsize(
tcallparanode(tcallparanode(left).right).left.resulttype.def,u32bittype.def);
if opsize in [S_B,S_W,S_L] then
op:=A_MOV
else
op:=A_MOVZX;
emit_ref_reg(op,opsize,
newreference(
tcallparanode(tcallparanode(left).right).left.location.reference),R_EDI);
end;
if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
emit_reg_ref(asmop,S_L,hregister,
newreference(tcallparanode(left).left.location.reference))
else
emit_reg_reg(asmop,S_L,hregister,
tcallparanode(left).left.location.register);
if hregister = R_EDI then
ungetregister32(R_EDI);
end
if tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_CREGISTER,LOC_REGISTER] then
{ we don't need a mod 32 because this is done automatically }
{ by the bts instruction. For proper checking we would }
{ note: bts doesn't do any mod'ing, that's why we can also use }
{ it for normalsets! (JM) }
{ need a cmp and jmp, but this should be done by the }
{ type cast code which does range checking if necessary (FK) }
hregister:=makereg32(tcallparanode(tcallparanode(left).right).left.location.register)
else
begin
pushsetelement(tcallparanode(tcallparanode(left).right).left);
{ normset is allways a ref }
emitpushreferenceaddr(tcallparanode(left).left.location.reference);
if inlinenumber=in_include_x_y then
emitcall('FPC_SET_SET_BYTE')
getexplicitregister32(R_EDI);
hregister:=R_EDI;
opsize:=def2def_opsize(
tcallparanode(tcallparanode(left).right).left.resulttype.def,u32bittype.def);
if opsize = S_L then
op:=A_MOV
else
emitcall('FPC_SET_UNSET_BYTE');
{CGMessage(cg_e_include_not_implemented);}
op:=A_MOVZX;
emit_ref_reg(op,opsize,
newreference(
tcallparanode(tcallparanode(left).right).left.location.reference),R_EDI);
end;
if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
emit_reg_ref(asmop,S_L,hregister,
newreference(tcallparanode(left).left.location.reference))
else
emit_reg_reg(asmop,S_L,hregister,
tcallparanode(left).left.location.register);
if hregister = R_EDI then
ungetregister32(R_EDI);
end;
end;
in_pi:
@ -879,7 +870,11 @@ begin
end.
{
$Log$
Revision 1.23 2001-08-30 20:13:57 peter
Revision 1.24 2001-09-04 14:32:45 jonas
* simplified det_resulttype code for include/exclude
* include/exclude doesn't use any helpers anymore in the i386 secondpass
Revision 1.23 2001/08/30 20:13:57 peter
* rtti/init table updates
* rttisym for reusable global rtti/init info
* support published for interfaces

View File

@ -1646,31 +1646,18 @@ implementation
in_exclude_x_y:
begin
resulttype:=voidtype;
if assigned(left) then
{ the parser already checks whether we have two (and exectly two) }
{ parameters (JM) }
set_varstate(left,true);
{ first param must be var }
valid_for_var(tcallparanode(left).left);
{ check type }
if (left.resulttype.def.deftype=setdef) then
begin
set_varstate(left,true);
{ remove warning when result is passed }
set_funcret_is_valid(tcallparanode(left).left);
{ first param must be var }
valid_for_var(tcallparanode(left).left);
{ check type }
if assigned(left.resulttype.def) and
(left.resulttype.def.deftype=setdef) then
begin
{ two paras ? }
if assigned(tcallparanode(left).right) then
begin
{ insert a type conversion }
{ to the type of the set elements }
inserttypeconv(tcallparanode(tcallparanode(left).right).left,
tsetdef(left.resulttype.def).elementtype);
{ only three parameters are allowed }
if assigned(tcallparanode(tcallparanode(left).right).right) then
CGMessage(cg_e_illegal_expression);
end;
end
else
CGMessage(type_e_mismatch);
{ insert a type conversion }
{ to the type of the set elements }
inserttypeconv(tcallparanode(tcallparanode(left).right).left,
tsetdef(left.resulttype.def).elementtype);
end
else
CGMessage(type_e_mismatch);
@ -2269,7 +2256,11 @@ begin
end.
{
$Log$
Revision 1.56 2001-09-04 11:38:55 jonas
Revision 1.57 2001-09-04 14:32:45 jonas
* simplified det_resulttype code for include/exclude
* include/exclude doesn't use any helpers anymore in the i386 secondpass
Revision 1.56 2001/09/04 11:38:55 jonas
+ searchsystype() and searchsystype() functions in symtable
* changed ninl and nadd to use these functions
* i386 set comparison functions now return their results in al instead