* various memory reference alignment fixes

git-svn-id: trunk@34544 -
This commit is contained in:
Jonas Maebe 2016-09-20 21:43:19 +00:00
parent 5d18c63b24
commit 0afbe85aab
9 changed files with 28 additions and 28 deletions

View File

@ -2027,8 +2027,8 @@ unit cgcpu;
begin
current_asmdata.getjumplabel(l);
reference_reset(srcref,0);
reference_reset(dstref,0);
reference_reset(srcref,source.alignment);
reference_reset(dstref,dest.alignment);
srcref.base:=NR_R30;
srcref.addressmode:=AM_POSTINCREMENT;
dstref.base:=NR_R26;

View File

@ -1216,7 +1216,7 @@ implementation
record "size" parameters }
tg.gethltemp(list,size,size.size,tt_normal,r);
cg.a_loadfpu_reg_ref(list,l.size,l.size,l.register,r);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
LOC_MMREGISTER,
@ -1224,7 +1224,7 @@ implementation
begin
tg.gethltemp(list,size,size.size,tt_normal,r);
cg.a_loadmm_reg_ref(list,l.size,l.size,l.register,r,mms_movescalar);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
LOC_CONSTANT,
@ -1242,7 +1242,7 @@ implementation
else
{$endif cpu64bitalu}
a_load_loc_ref(list,size,size,l,r);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
else
@ -1264,7 +1264,7 @@ implementation
begin
tg.GetTemp(list,tcgsize2size[l.size],tcgsize2size[l.size],tt_normal,href);
cg.a_loadfpu_reg_ref(list,l.size,l.size,l.register,href);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=href;
end;
{$ifndef cpu64bitalu}

View File

@ -4043,7 +4043,7 @@ implementation
begin
tg.gethltemp(list,size,size.size,tt_normal,r);
a_loadfpu_reg_ref(list,size,size,l.register,r);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
LOC_MMREGISTER,
@ -4054,7 +4054,7 @@ implementation
internalerror(2012062301);
tg.gethltemp(list,size,size.size,tt_normal,r);
a_loadmm_reg_ref(list,size,size,l.register,r,mms_movescalar);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
LOC_CONSTANT,
@ -4072,7 +4072,7 @@ implementation
forcesize:=sizeof(pint);
tg.gethltemp(list,size,forcesize,tt_normal,r);
a_load_loc_ref(list,size,size,l,r);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end;
LOC_CREFERENCE,
@ -4096,7 +4096,7 @@ implementation
begin
tg.gethltemp(list,size,-1,tt_normal,href);
hlcg.a_loadfpu_reg_ref(list,size,size,l.register,href);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=href;
end;
{ on ARM, CFP values may be located in integer registers,

View File

@ -257,7 +257,7 @@ unit cgcpu;
end
else
begin
reference_reset_symbol(tmpref,dirref.symbol,0,dirref.alignment);
reference_reset_symbol(tmpref,dirref.symbol,0,sizeof(pint));
tmpref.refaddr:=addr_pic;
tmpref.base:=current_procinfo.got;
{$ifdef EXTDEBUG}

View File

@ -689,7 +689,7 @@ implementation
else
internalerror(2014052202);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end
else if is_fourbyterecord(size) and (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then
@ -704,7 +704,7 @@ implementation
else
cg.a_load_reg_ref(list,OS_16,OS_16,GetNextReg(l.register),tmpref);
location_reset_ref(l,LOC_REFERENCE,l.size,0);
location_reset_ref(l,LOC_REFERENCE,l.size,size.alignment);
l.reference:=r;
end
else

View File

@ -142,7 +142,7 @@ implementation
reference_reset_symbol(segref,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,0);
segref.refaddr:=addr_seg;
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_16,OS_16,segref,segreg);
reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,pvd.size);
reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA),0,pvd.alignment);
href.segment:=segreg;
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,pvd,pvd,href,hregister);
hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,pvd,OC_EQ,0,hregister,norelocatelab);

View File

@ -316,7 +316,7 @@ implementation
paraloc1.init;
paramanager.getintparaloc(current_asmdata.CurrAsmList,tprocvardef(pvd),1,paraloc1);
hregister:=hlcg.getaddressregister(current_asmdata.CurrAsmList,pvd);
reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA,indirect),0,pvd.size);
reference_reset_symbol(href,current_asmdata.RefAsmSymbol('FPC_THREADVAR_RELOCATE',AT_DATA,indirect),0,pvd.alignment);
if not issystemunit then
current_module.add_extern_asmsym('FPC_THREADVAR_RELOCATE',AB_EXTERNAL,AT_DATA);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,pvd,pvd,href,hregister);

View File

@ -127,7 +127,7 @@ implementation
vmtname:=tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname;
reference_reset_symbol(href,
current_asmdata.RefAsmSymbol(vmtname,AT_DATA,indirect),0,
voidpointertype.size);
resultdef.alignment);
hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,resultdef,resultdef,href,location.register);
if otherunit then
current_module.add_extern_asmsym(vmtname,AB_EXTERNAL,AT_DATA);
@ -146,7 +146,7 @@ implementation
{ find/add necessary classref/classname pool entries }
objcfinishstringrefpoolentry(entry,sp_objcclassnames,sec_objc_cls_refs,sec_objc_class_names);
end;
reference_reset_symbol(href,tasmlabel(entry^.Data),0,voidpointertype.size);
reference_reset_symbol(href,tasmlabel(entry^.Data),0,objc_idtype.alignment);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,objc_idtype,objc_idtype,href,location.register);
end;
end
@ -194,7 +194,7 @@ implementation
if hsym.localloc.loc<>LOC_REFERENCE then
internalerror(200309283);
hlcg.reference_reset_base(href,parentfpvoidpointertype,location.register,hsym.localloc.reference.offset,sizeof(pint));
hlcg.reference_reset_base(href,parentfpvoidpointertype,location.register,hsym.localloc.reference.offset,parentfpvoidpointertype.alignment);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,parentfpvoidpointertype,parentfpvoidpointertype,href,location.register);
end;
end;
@ -542,7 +542,7 @@ implementation
earlier versions)
}
asmsym:=current_asmdata.RefAsmSymbol(vs.mangledname,AT_DATA);
reference_reset_symbol(tmpref,asmsym,0,sizeof(pint));
reference_reset_symbol(tmpref,asmsym,0,voidpointertype.alignment);
hlcg.g_ptrtypecast_ref(current_asmdata.CurrAsmList,left.resultdef,cpointerdef.getreusable(resultdef),location.reference);
location.reference.index:=hlcg.getintregister(current_asmdata.CurrAsmList,ptruinttype);
hlcg.a_load_ref_reg(current_asmdata.CurrAsmList,ptruinttype,ptruinttype,tmpref,location.reference.index);

View File

@ -457,18 +457,18 @@ unit cgx86;
else
begin
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
reference_reset_base(href,ref.base,0,ref.alignment);
href.index:=hreg;
if ref.scalefactor<>0 then
begin
reference_reset_base(href,ref.base,0,8);
reference_reset_base(href,ref.base,0,ref.alignment);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,hreg));
ref.base:=hreg;
end
else
begin
reference_reset_base(href,ref.index,0,8);
reference_reset_base(href,ref.index,0,ref.alignment);
href.index:=hreg;
list.concat(taicpu.op_reg_reg(A_ADD,S_Q,ref.index,hreg));
ref.index:=hreg;
@ -521,7 +521,7 @@ unit cgx86;
else
begin
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
reference_reset_base(href,ref.base,0,ref.alignment);
href.index:=hreg;
ref.base:=getaddressregister(list);
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,ref.base));
@ -556,7 +556,7 @@ unit cgx86;
else
begin
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
reference_reset_base(href,ref.base,0,ref.alignment);
href.index:=hreg;
ref.base:=getaddressregister(list);
list.concat(taicpu.op_ref_reg(A_LEA,S_Q,href,ref.base));
@ -615,7 +615,7 @@ unit cgx86;
else
begin
{ don't use add, as the flags may contain a value }
reference_reset_base(href,ref.base,0,8);
reference_reset_base(href,ref.base,0,ref.alignment);
href.index:=hreg;
list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
ref.base:=hreg;
@ -1083,12 +1083,12 @@ unit cgx86;
then
begin
{$ifdef x86_64}
reference_reset_symbol(tmpref,dirref.symbol,0,dirref.alignment);
reference_reset_symbol(tmpref,dirref.symbol,0,sizeof(pint));
tmpref.refaddr:=addr_pic;
tmpref.base:=NR_RIP;
list.concat(taicpu.op_ref_reg(A_MOV,S_Q,tmpref,r));
{$else x86_64}
reference_reset_symbol(tmpref,dirref.symbol,0,dirref.alignment);
reference_reset_symbol(tmpref,dirref.symbol,0,sizeof(pint));
tmpref.refaddr:=addr_pic;
tmpref.base:=current_procinfo.got;
include(current_procinfo.flags,pi_needs_got);
@ -1147,7 +1147,7 @@ unit cgx86;
system_i386_linux,system_i386_android:
if segment=NR_GS then
begin
reference_reset_symbol(tmpref,current_asmdata.RefAsmSymbol('___fpc_threadvar_offset',AT_DATA),0,dirref.alignment);
reference_reset_symbol(tmpref,current_asmdata.RefAsmSymbol('___fpc_threadvar_offset',AT_DATA),0,sizeof(pint));
tmpref.segment:=NR_GS;
list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r));
end