|
@@ -35,7 +35,7 @@ unit tgobj;
|
|
|
|
|
|
|
|
uses
|
|
uses
|
|
|
globals,globtype,
|
|
globals,globtype,
|
|
|
- symtype,
|
|
|
|
|
|
|
+ symconst,symdef,symtype,symtable,
|
|
|
cpubase,cgbase,cgutils,
|
|
cpubase,cgbase,cgutils,
|
|
|
aasmtai,aasmdata;
|
|
aasmtai,aasmdata;
|
|
|
|
|
|
|
@@ -125,7 +125,7 @@ unit tgobj;
|
|
|
|
|
|
|
|
{ Allocate space for a local }
|
|
{ Allocate space for a local }
|
|
|
procedure getlocal(list: TAsmList; size: asizeint; def: tdef; var ref : treference);
|
|
procedure getlocal(list: TAsmList; size: asizeint; def: tdef; var ref : treference);
|
|
|
- procedure getlocal(list: TAsmList; size: asizeint; alignment: shortint; def: tdef; sym : tsym; var ref : treference); virtual;
|
|
|
|
|
|
|
+ procedure getlocal(list: TAsmList; size: asizeint; alignment,explicitalignment: shortint; def: tdef; sym : tsym; var ref : treference); virtual;
|
|
|
procedure UnGetLocal(list: TAsmList; const ref : treference);
|
|
procedure UnGetLocal(list: TAsmList; const ref : treference);
|
|
|
end;
|
|
end;
|
|
|
ttgobjclass = class of ttgobj;
|
|
ttgobjclass = class of ttgobj;
|
|
@@ -747,20 +747,32 @@ implementation
|
|
|
|
|
|
|
|
procedure ttgobj.getlocal(list: TAsmList; size: asizeint; def: tdef; var ref : treference);
|
|
procedure ttgobj.getlocal(list: TAsmList; size: asizeint; def: tdef; var ref : treference);
|
|
|
begin
|
|
begin
|
|
|
- getlocal(list, size, def.alignment, def, nil, ref);
|
|
|
|
|
|
|
+ if def.inheritsfrom(tabstractrecorddef) and (def.typ in [recorddef]) then
|
|
|
|
|
+ getlocal(list, size, def.alignment, tabstractrecordsymtable(tabstractrecorddef(def).symtable).explicitrecordalignment, def, nil, ref)
|
|
|
|
|
+ else
|
|
|
|
|
+ getlocal(list, size, def.alignment, 0, def, nil, ref);
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
- procedure ttgobj.getlocal(list: TAsmList; size: asizeint; alignment: shortint; def: tdef; sym : tsym; var ref : treference);
|
|
|
|
|
|
|
+ procedure ttgobj.getlocal(list: TAsmList; size: asizeint; alignment, explicitalignment: shortint; def: tdef; sym : tsym; var ref : treference);
|
|
|
var
|
|
var
|
|
|
lalign : shortint;
|
|
lalign : shortint;
|
|
|
begin
|
|
begin
|
|
|
lalign:=used_align(alignment,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax);
|
|
lalign:=used_align(alignment,current_settings.alignment.localalignmin,current_settings.alignment.localalignmax);
|
|
|
- if (alignment>lalign) then
|
|
|
|
|
- if assigned(sym) then
|
|
|
|
|
- CGMessage1(scanner_w_local_alignment_large_than_max,sym.name)
|
|
|
|
|
- else
|
|
|
|
|
- CGMessage1(scanner_w_local_alignment_large_than_max,def.typename);
|
|
|
|
|
|
|
+ if (explicitalignment>lalign) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ if assigned(sym) then
|
|
|
|
|
+ CGMessage1(scanner_w_local_alignment_larger_than_max,sym.name)
|
|
|
|
|
+ else
|
|
|
|
|
+ CGMessage1(scanner_w_local_alignment_larger_than_max,def.typename);
|
|
|
|
|
+ end
|
|
|
|
|
+ else if (alignment>lalign) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ if assigned(sym) then
|
|
|
|
|
+ CGMessage1(scanner_n_local_alignment_larger_than_max,sym.name)
|
|
|
|
|
+ else
|
|
|
|
|
+ CGMessage1(scanner_n_local_alignment_larger_than_max,def.typename);
|
|
|
|
|
+ end;
|
|
|
alloctemp(list,size,lalign,tt_persistent,def,false,ref);
|
|
alloctemp(list,size,lalign,tt_persistent,def,false,ref);
|
|
|
end;
|
|
end;
|
|
|
|
|
|