mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 01:29:21 +02:00
Merge branch 'main' of https://gitlab.com/freepascal.org/fpc/source
This commit is contained in:
commit
f8de5fece2
@ -1357,21 +1357,17 @@ implementation
|
|||||||
|
|
||||||
procedure recorddef_rtti(def:trecorddef);
|
procedure recorddef_rtti(def:trecorddef);
|
||||||
|
|
||||||
procedure write_record_operators;
|
procedure write_record_operators(rttilab:tasmlabel);
|
||||||
var
|
var
|
||||||
rttilab: Tasmsymbol;
|
|
||||||
rttidef: tdef;
|
rttidef: tdef;
|
||||||
tcb: ttai_typedconstbuilder;
|
tcb: ttai_typedconstbuilder;
|
||||||
mop: tmanagementoperator;
|
mop: tmanagementoperator;
|
||||||
procdef: tprocdef;
|
procdef: tprocdef;
|
||||||
begin
|
begin
|
||||||
rttilab := current_asmdata.DefineAsmSymbol(
|
|
||||||
internaltypeprefixName[itp_init_record_operators]+def.rtti_mangledname(rt),
|
|
||||||
AB_GLOBAL,AT_DATA,def);
|
|
||||||
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
|
||||||
|
|
||||||
tcb.begin_anonymous_record(
|
tcb.begin_anonymous_record(
|
||||||
rttilab.Name,
|
'',
|
||||||
defaultpacking,min(reqalign,SizeOf(PInt)),
|
defaultpacking,min(reqalign,SizeOf(PInt)),
|
||||||
targetinfos[target_info.system]^.alignment.recordalignmin
|
targetinfos[target_info.system]^.alignment.recordalignmin
|
||||||
);
|
);
|
||||||
@ -1400,6 +1396,8 @@ implementation
|
|||||||
tcb.free;
|
tcb.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
oplab : tasmlabel;
|
||||||
begin
|
begin
|
||||||
write_header(tcb,def,tkRecord);
|
write_header(tcb,def,tkRecord);
|
||||||
{ need extra reqalign record, because otherwise the u32 int will
|
{ need extra reqalign record, because otherwise the u32 int will
|
||||||
@ -1426,6 +1424,7 @@ implementation
|
|||||||
|
|
||||||
tcb.emit_ord_const(def.size,u32inttype);
|
tcb.emit_ord_const(def.size,u32inttype);
|
||||||
|
|
||||||
|
oplab:=nil;
|
||||||
{ store rtti management operators only for init table }
|
{ store rtti management operators only for init table }
|
||||||
if rt=initrtti then
|
if rt=initrtti then
|
||||||
begin
|
begin
|
||||||
@ -1434,10 +1433,13 @@ implementation
|
|||||||
if (trecordsymtable(def.symtable).managementoperators=[]) then
|
if (trecordsymtable(def.symtable).managementoperators=[]) then
|
||||||
tcb.emit_tai(Tai_const.Create_nil_dataptr,voidpointertype)
|
tcb.emit_tai(Tai_const.Create_nil_dataptr,voidpointertype)
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
|
current_asmdata.getlocaldatalabel(oplab);
|
||||||
tcb.emit_tai(Tai_const.Createname(
|
tcb.emit_tai(Tai_const.Createname(
|
||||||
internaltypeprefixName[itp_init_record_operators]+def.rtti_mangledname(rt),
|
oplab.name,
|
||||||
AT_DATA_FORCEINDIRECT,0),voidpointertype);
|
AT_DATA_FORCEINDIRECT,0),voidpointertype);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
fields_write_rtti_data(tcb,def,rt);
|
fields_write_rtti_data(tcb,def,rt);
|
||||||
tcb.end_anonymous_record;
|
tcb.end_anonymous_record;
|
||||||
@ -1445,7 +1447,7 @@ implementation
|
|||||||
|
|
||||||
{ write pointers to operators if needed }
|
{ write pointers to operators if needed }
|
||||||
if (rt=initrtti) and (trecordsymtable(def.symtable).managementoperators<>[]) then
|
if (rt=initrtti) and (trecordsymtable(def.symtable).managementoperators<>[]) then
|
||||||
write_record_operators;
|
write_record_operators(oplab);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -794,7 +794,6 @@ type
|
|||||||
itp_rtti_set_inner,
|
itp_rtti_set_inner,
|
||||||
itp_rtti_record,
|
itp_rtti_record,
|
||||||
itp_rtti_record_inner,
|
itp_rtti_record_inner,
|
||||||
itp_init_record_operators,
|
|
||||||
itp_init_mop_offset_entry,
|
itp_init_mop_offset_entry,
|
||||||
itp_threadvar_record,
|
itp_threadvar_record,
|
||||||
itp_objc_method_list,
|
itp_objc_method_list,
|
||||||
@ -949,7 +948,6 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
|
|||||||
'$rtti_set_inner$',
|
'$rtti_set_inner$',
|
||||||
'$rtti_record$',
|
'$rtti_record$',
|
||||||
'$rtti_record_inner$',
|
'$rtti_record_inner$',
|
||||||
'$init_record_operators$',
|
|
||||||
'$init_mop_offset_entry$',
|
'$init_mop_offset_entry$',
|
||||||
'$threadvar_record$',
|
'$threadvar_record$',
|
||||||
'$objc_method_list$',
|
'$objc_method_list$',
|
||||||
|
@ -10527,13 +10527,33 @@ unit aoptx86;
|
|||||||
((taicpu(hp1).oper[0]^.val and Limit) = taicpu(hp1).oper[0]^.val)
|
((taicpu(hp1).oper[0]^.val and Limit) = taicpu(hp1).oper[0]^.val)
|
||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
|
{$if defined(i386) or defined(i8086)}
|
||||||
|
{ If the target size is 8-bit, make sure we can actually encode it }
|
||||||
|
if (NewRegSize = R_SUBL) and (taicpu(hp1).oper[0]^.typ = top_reg) and not (GetSupReg(taicpu(hp1).oper[0]^.reg) in [RS_EAX,RS_EBX,RS_ECX,RS_EDX]) then
|
||||||
|
Exit;
|
||||||
|
{$endif i386 or i8086}
|
||||||
|
|
||||||
DebugMsg(SPeepholeOptimization + 'MovxOp2Op 2',p);
|
DebugMsg(SPeepholeOptimization + 'MovxOp2Op 2',p);
|
||||||
|
|
||||||
if AndTest and not RegUsed then
|
|
||||||
taicpu(hp1).opcode := A_TEST;
|
|
||||||
|
|
||||||
taicpu(hp1).opsize := NewSize;
|
taicpu(hp1).opsize := NewSize;
|
||||||
|
|
||||||
|
taicpu(hp1).loadoper(1, taicpu(p).oper[0]^);
|
||||||
|
if AndTest then
|
||||||
|
begin
|
||||||
|
RemoveInstruction(hp2);
|
||||||
|
if not RegUsed then
|
||||||
|
begin
|
||||||
|
taicpu(hp1).opcode := A_TEST;
|
||||||
|
if (taicpu(hp1).oper[0]^.typ = top_ref) then
|
||||||
|
begin
|
||||||
|
{ Make sure the reference is the second operand }
|
||||||
|
SwapOper := taicpu(hp1).oper[0];
|
||||||
|
taicpu(hp1).oper[0] := taicpu(hp1).oper[1];
|
||||||
|
taicpu(hp1).oper[1] := SwapOper;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
case taicpu(hp1).oper[0]^.typ of
|
case taicpu(hp1).oper[0]^.typ of
|
||||||
top_reg:
|
top_reg:
|
||||||
setsubreg(taicpu(hp1).oper[0]^.reg, NewRegSize);
|
setsubreg(taicpu(hp1).oper[0]^.reg, NewRegSize);
|
||||||
@ -10544,18 +10564,6 @@ unit aoptx86;
|
|||||||
;
|
;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
taicpu(hp1).loadoper(1, taicpu(p).oper[0]^);
|
|
||||||
if (taicpu(hp1).opcode = A_TEST) and (taicpu(hp1).oper[0]^.typ = top_ref) then
|
|
||||||
begin
|
|
||||||
{ For TEST, make sure the reference is the second operand }
|
|
||||||
SwapOper := taicpu(hp1).oper[0];
|
|
||||||
taicpu(hp1).oper[0] := taicpu(hp1).oper[1];
|
|
||||||
taicpu(hp1).oper[1] := SwapOper;
|
|
||||||
end;
|
|
||||||
|
|
||||||
if AndTest then
|
|
||||||
RemoveInstruction(hp2);
|
|
||||||
|
|
||||||
if RegUsed then
|
if RegUsed then
|
||||||
begin
|
begin
|
||||||
AsmL.Remove(p);
|
AsmL.Remove(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user