* more record alignment fixes

This commit is contained in:
peter 2004-01-28 22:16:31 +00:00
parent e2df62fc08
commit 8caaa7740d
10 changed files with 103 additions and 64 deletions

View File

@ -189,7 +189,8 @@ interface
{$IFDEF testvarsets}
Initsetalloc, {0=fixed, 1 =var}
{$ENDIF}
initpackenum : longint;
initpackrecords,
initpackenum : shortint;
initalignment : talignmentinfo;
initoptprocessor,
initspecificoptprocessor : tprocessors;
@ -210,6 +211,7 @@ interface
{$IFDEF testvarsets}
aktsetalloc,
{$ENDIF}
aktpackrecords,
aktpackenum : longint;
aktmaxfpuregisters : longint;
aktalignment : talignmentinfo;
@ -1734,6 +1736,7 @@ implementation
initfputype:=fpu_x87;
initpackrecords:=4;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
@ -1742,6 +1745,7 @@ implementation
{$endif i386}
{$ifdef m68k}
initoptprocessor:=MC68020;
initpackrecords:=2;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
@ -1749,6 +1753,7 @@ implementation
{$endif m68k}
{$ifdef powerpc}
initoptprocessor:=PPC604;
initpackrecords:=4;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
@ -1757,12 +1762,14 @@ implementation
{$endif powerpc}
{$ifdef sparc}
initoptprocessor:=SPARC_V8;
initpackrecords:=8;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
{$ENDIF}
{$endif sparc}
{$ifdef arm}
initpackrecords:=4;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
@ -1775,6 +1782,7 @@ implementation
initfputype:=fpu_sse64;
initpackrecords:=8;
initpackenum:=4;
{$IFDEF testvarsets}
initsetalloc:=0;
@ -1796,7 +1804,10 @@ implementation
end.
{
$Log$
Revision 1.122 2004-01-28 21:05:56 florian
Revision 1.123 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.122 2004/01/28 21:05:56 florian
* fixed alignment of classes
Revision 1.121 2004/01/14 23:39:05 florian

View File

@ -341,6 +341,7 @@ implementation
oldaktlocalswitches : tlocalswitches;
oldaktmoduleswitches : tmoduleswitches;
oldaktfilepos : tfileposinfo;
oldaktpackrecords,
oldaktpackenum,oldaktmaxfpuregisters : longint;
oldaktalignment : talignmentinfo;
oldaktoutputformat : tasm;
@ -421,6 +422,7 @@ implementation
oldaktmoduleswitches:=aktmoduleswitches;
oldaktalignment:=aktalignment;
oldaktpackenum:=aktpackenum;
oldaktpackrecords:=aktpackrecords;
oldaktfputype:=aktfputype;
oldaktmaxfpuregisters:=aktmaxfpuregisters;
oldaktoutputformat:=aktoutputformat;
@ -478,6 +480,7 @@ implementation
aktalignment:=initalignment;
aktfputype:=initfputype;
aktpackenum:=initpackenum;
aktpackrecords:=initpackrecords;
aktoutputformat:=initoutputformat;
set_target_asm(aktoutputformat);
aktoptprocessor:=initoptprocessor;
@ -608,6 +611,7 @@ implementation
aktmoduleswitches:=oldaktmoduleswitches;
aktalignment:=oldaktalignment;
aktpackenum:=oldaktpackenum;
aktpackrecords:=oldaktpackrecords;
aktmaxfpuregisters:=oldaktmaxfpuregisters;
aktoutputformat:=oldaktoutputformat;
set_target_asm(aktoutputformat);
@ -691,7 +695,10 @@ implementation
end.
{
$Log$
Revision 1.58 2003-10-29 21:02:51 peter
Revision 1.59 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.58 2003/10/29 21:02:51 peter
* set ms_compiled after the program/unit is parsed
* check for ms_compiled before checking preproc matches

View File

@ -1064,7 +1064,7 @@ implementation
if not(is_ordinal(casetype.def)) or is_64bitint(casetype.def) then
Message(type_e_ordinal_expr_expected);
consume(_OF);
UnionSymtable:=trecordsymtable.create;
UnionSymtable:=trecordsymtable.create(aktpackrecords);
Unionsymtable.next:=symtablestack;
registerdef:=false;
UnionDef:=trecorddef.create(unionsymtable);
@ -1114,7 +1114,7 @@ implementation
symtablestack:=symtablestack.next;
{ we do NOT call symtablestack.insert
on purpose PM }
if aktalignment.recordalignmax=-1 then
if trecordsymtable(symtablestack).usefieldalignment=-1 then
begin
{$ifdef i386}
if maxalignment>2 then
@ -1152,7 +1152,10 @@ implementation
end.
{
$Log$
Revision 1.60 2004-01-28 20:30:18 peter
Revision 1.61 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.60 2004/01/28 20:30:18 peter
* record alignment splitted in fieldalignment and recordalignment,
the latter is used when this record is inserted in another record.

View File

@ -198,7 +198,7 @@ implementation
addtype('$s80real',s80floattype);
addtype('$s64currency',s64currencytype);
{ Add a type for virtual method tables }
hrecst:=trecordsymtable.create;
hrecst:=trecordsymtable.create(aktpackrecords);
vmttype.setdef(trecorddef.create(hrecst));
pvmttype.setdef(tpointerdef.create(vmttype));
hrecst.insertfield(tvarsym.create('$parent',vs_value,pvmttype),true);
@ -213,7 +213,7 @@ implementation
tarraydef(vmtarraytype.def).setelementtype(pvmttype);
addtype('$vtblarray',vmtarraytype);
{ Add a type for methodpointers }
hrecst:=trecordsymtable.create;
hrecst:=trecordsymtable.create(1);
hrecst.insertfield(tvarsym.create('$proc',vs_value,voidpointertype),true);
hrecst.insertfield(tvarsym.create('$self',vs_value,voidpointertype),true);
methodpointertype.setdef(trecorddef.create(hrecst));
@ -521,7 +521,10 @@ implementation
end.
{
$Log$
Revision 1.59 2004-01-20 12:59:37 florian
Revision 1.60 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.59 2004/01/20 12:59:37 florian
* common addnode code for x86-64 and i386
Revision 1.58 2003/11/29 16:19:54 peter

View File

@ -226,7 +226,7 @@ implementation
old_object_option : tsymoptions;
begin
{ create recdef }
symtable:=trecordsymtable.create;
symtable:=trecordsymtable.create(aktpackrecords);
record_dec:=trecorddef.create(symtable);
{ update symtable stack }
symtable.next:=symtablestack;
@ -582,13 +582,13 @@ implementation
array_dec
else
begin
oldaktpackrecords:=aktalignment.recordalignmax;
aktalignment.recordalignmax:=1;
oldaktpackrecords:=aktpackrecords;
aktpackrecords:=1;
if token in [_CLASS,_OBJECT] then
tt.setdef(object_dec(name,nil))
else
tt.setdef(record_dec);
aktalignment.recordalignmax:=oldaktpackrecords;
aktpackrecords:=oldaktpackrecords;
end;
end;
_CLASS,
@ -644,7 +644,10 @@ implementation
end.
{
$Log$
Revision 1.61 2004-01-28 20:30:18 peter
Revision 1.62 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.61 2004/01/28 20:30:18 peter
* record alignment splitted in fieldalignment and recordalignment,
the latter is used when this record is inserted in another record.

View File

@ -425,6 +425,7 @@ implementation
spillworklist.done;
coalescednodes.done;
selectstack.done;
live_registers.done;
worklist_moves.free;
dispose_reginfo;
end;
@ -1562,7 +1563,7 @@ implementation
p:=Tai(p.previous);
end;
live_registers.done;
live_registers.copyfrom(back);
live_registers:=back;
end;
@ -1862,7 +1863,10 @@ implementation
end.
{
$Log$
Revision 1.115 2004-01-26 17:40:11 florian
Revision 1.116 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.115 2004/01/26 17:40:11 florian
* made DoSpill* overrideable
+ add_cpu_interferences added

View File

@ -119,22 +119,22 @@ implementation
{ Support also the ON and OFF as switch }
hs:=current_scanner.readid;
if (hs='ON') then
aktalignment.recordalignmax:=4
aktpackrecords:=4
else
if (hs='OFF') then
aktalignment.recordalignmax:=1
aktpackrecords:=1
else
Message(scan_w_only_pack_records);
end
else
begin
case current_scanner.readval of
1 : aktalignment.recordalignmax:=1;
2 : aktalignment.recordalignmax:=2;
4 : aktalignment.recordalignmax:=4;
8 : aktalignment.recordalignmax:=8;
16 : aktalignment.recordalignmax:=16;
32 : aktalignment.recordalignmax:=32;
1 : aktpackrecords:=1;
2 : aktpackrecords:=2;
4 : aktpackrecords:=4;
8 : aktpackrecords:=8;
16 : aktpackrecords:=16;
32 : aktpackrecords:=32;
else
Message(scan_w_only_pack_records);
end;
@ -602,22 +602,22 @@ implementation
hs:=current_scanner.readid;
{ C has the special recordalignmax of -1 }
if (hs='C') then
aktalignment.recordalignmax:=-1
aktpackrecords:=-1
else
if (hs='NORMAL') or (hs='DEFAULT') then
aktalignment.recordalignmax:=2
aktpackrecords:=2
else
Message(scan_w_only_pack_records);
end
else
begin
case current_scanner.readval of
1 : aktalignment.recordalignmax:=1;
2 : aktalignment.recordalignmax:=2;
4 : aktalignment.recordalignmax:=4;
8 : aktalignment.recordalignmax:=8;
16 : aktalignment.recordalignmax:=16;
32 : aktalignment.recordalignmax:=32;
1 : aktpackrecords:=1;
2 : aktpackrecords:=2;
4 : aktpackrecords:=4;
8 : aktpackrecords:=8;
16 : aktpackrecords:=16;
32 : aktpackrecords:=32;
else
Message(scan_w_only_pack_records);
end;
@ -992,7 +992,10 @@ implementation
end.
{
$Log$
Revision 1.29 2003-12-25 01:07:09 florian
Revision 1.30 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.29 2003/12/25 01:07:09 florian
+ $fputype directive support
+ single data type operations with sse unit
* fixed more x86-64 stuff

View File

@ -3044,12 +3044,6 @@ implementation
deftype:=recorddef;
symtable:=p;
symtable.defowner:=self;
{ recordalign -1 means C record packing, that starts
with an alignment of 1 }
if aktalignment.recordalignmax=-1 then
trecordsymtable(symtable).fieldalignment:=1
else
trecordsymtable(symtable).fieldalignment:=aktalignment.recordalignmax;
isunion:=false;
end;
@ -3059,7 +3053,7 @@ implementation
inherited ppuloaddef(ppufile);
deftype:=recorddef;
savesize:=ppufile.getlongint;
symtable:=trecordsymtable.create;
symtable:=trecordsymtable.create(0);
trecordsymtable(symtable).datasize:=ppufile.getlongint;
trecordsymtable(symtable).fieldalignment:=ppufile.getbyte;
trecordsymtable(symtable).recordalignment:=ppufile.getbyte;
@ -4667,16 +4661,10 @@ implementation
deftype:=objectdef;
objectoptions:=[];
childof:=nil;
symtable:=tobjectsymtable.create(n);
symtable:=tobjectsymtable.create(n,aktpackrecords);
{ create space for vmt !! }
vmt_offset:=0;
symtable.defowner:=self;
{ recordalign -1 means C record packing, that starts
with an alignment of 1 }
if aktalignment.recordalignmax=-1 then
tobjectsymtable(symtable).fieldalignment:=1
else
tobjectsymtable(symtable).fieldalignment:=aktalignment.recordalignmax;
lastvtableindex:=0;
set_parent(c);
objname:=stringdup(upper(n));
@ -4735,7 +4723,7 @@ implementation
else
implementedinterfaces:=nil;
symtable:=tobjectsymtable.create(objrealname^);
symtable:=tobjectsymtable.create(objrealname^,aktpackrecords);
tobjectsymtable(symtable).datasize:=ppufile.getlongint;
tobjectsymtable(symtable).fieldalignment:=ppufile.getbyte;
tobjectsymtable(symtable).recordalignment:=ppufile.getbyte;
@ -6164,7 +6152,10 @@ implementation
end.
{
$Log$
Revision 1.212 2004-01-28 21:05:56 florian
Revision 1.213 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.212 2004/01/28 21:05:56 florian
* fixed alignment of classes
Revision 1.211 2004/01/28 20:30:18 peter

View File

@ -93,9 +93,10 @@ interface
tabstractrecordsymtable = class(tstoredsymtable)
public
datasize : longint;
usefieldalignment, { alignment to use for fields (PACKRECORDS value), -1 is C style }
recordalignment, { alignment required when inserting this record }
fieldalignment : byte; { alignment used when fields are inserted }
constructor create(const n:string);
fieldalignment : shortint; { alignment current alignment used when fields are inserted }
constructor create(const n:string;usealign:shortint);
procedure ppuload(ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
@ -105,13 +106,13 @@ interface
trecordsymtable = class(tabstractrecordsymtable)
public
constructor create;
constructor create(usealign:shortint);
procedure insert_in(tsymt : trecordsymtable;offset : longint);
end;
tobjectsymtable = class(tabstractrecordsymtable)
public
constructor create(const n:string);
constructor create(const n:string;usealign:shortint);
procedure insert(sym : tsymentry);override;
end;
@ -975,11 +976,18 @@ implementation
TAbstractRecordSymtable
****************************************************************************}
constructor tabstractrecordsymtable.create(const n:string);
constructor tabstractrecordsymtable.create(const n:string;usealign:shortint);
begin
inherited create(n);
datasize:=0;
fieldalignment:=1;
recordalignment:=1;
usefieldalignment:=usealign;
{ recordalign -1 means C record packing, that starts
with an alignment of 1 }
if usealign=-1 then
fieldalignment:=1
else
fieldalignment:=usealign;
end;
@ -1057,7 +1065,7 @@ implementation
vardef:=tvarsym(sym).vartype.def;
varalign:=vardef.alignment;
{ Calc the alignment size for C style records }
if (aktalignment.recordalignmax=-1) then
if (usefieldalignment=-1) then
begin
if (varalign>4) and
((varalign mod 4)<>0) and
@ -1098,9 +1106,9 @@ implementation
TRecordSymtable
****************************************************************************}
constructor trecordsymtable.create;
constructor trecordsymtable.create(usealign:shortint);
begin
inherited create('');
inherited create('',usealign);
symtabletype:=recordsymtable;
end;
@ -1156,9 +1164,9 @@ implementation
TObjectSymtable
****************************************************************************}
constructor tobjectsymtable.create(const n:string);
constructor tobjectsymtable.create(const n:string;usealign:shortint);
begin
inherited create(n);
inherited create(n,usealign);
symtabletype:=objectsymtable;
end;
@ -2302,7 +2310,10 @@ implementation
end.
{
$Log$
Revision 1.127 2004-01-28 20:30:18 peter
Revision 1.128 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.127 2004/01/28 20:30:18 peter
* record alignment splitted in fieldalignment and recordalignment,
the latter is used when this record is inserted in another record.

View File

@ -81,7 +81,7 @@ unit i_linux;
localalignmin : 4;
localalignmax : 4;
recordalignmin : 0;
recordalignmax : 2;
recordalignmax : 4;
maxCrecordalign : 4
);
first_parm_offset : 8;
@ -207,7 +207,7 @@ unit i_linux;
localalignmin : 4;
localalignmax : 4;
recordalignmin : 0;
recordalignmax : 2;
recordalignmax : 4;
maxCrecordalign : 8
);
first_parm_offset : 8;
@ -514,7 +514,10 @@ initialization
end.
{
$Log$
Revision 1.22 2004-01-28 15:36:47 florian
Revision 1.23 2004-01-28 22:16:31 peter
* more record alignment fixes
Revision 1.22 2004/01/28 15:36:47 florian
* fixed another couple of arm bugs
Revision 1.21 2004/01/26 19:05:56 florian