mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 20:39:13 +02:00
* use the gcc jumptable scheme for all ppc targets instead of only for
darwin git-svn-id: trunk@8674 -
This commit is contained in:
parent
5a0a6d0d9e
commit
993ec01a76
@ -87,19 +87,13 @@ implementation
|
||||
i:=last+1;
|
||||
while i<=t^._low-1 do
|
||||
begin
|
||||
if not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
|
||||
list.concat(Tai_const.Create_sym(elselabel))
|
||||
else
|
||||
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,elselabel));
|
||||
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,elselabel));
|
||||
i:=i+1;
|
||||
end;
|
||||
i:=t^._low;
|
||||
while i<=t^._high do
|
||||
begin
|
||||
if not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
|
||||
list.concat(Tai_const.Create_sym(blocklabel(t^.blockid)))
|
||||
else
|
||||
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,blocklabel(t^.blockid)));
|
||||
list.concat(Tai_const.Create_rel_sym(aitconst_32bit,table,blocklabel(t^.blockid)));
|
||||
i:=i+1;
|
||||
end;
|
||||
last:=t^._high;
|
||||
@ -125,45 +119,25 @@ implementation
|
||||
min_:=0;
|
||||
end;
|
||||
current_asmdata.getjumplabel(table);
|
||||
{ create reference, indexreg := indexreg * sizeof(OS_ADDR) }
|
||||
if not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
|
||||
mulfactor:=tcgsize2size[OS_ADDR]
|
||||
else
|
||||
mulfactor:=4;
|
||||
{ create reference, indexreg := indexreg * sizeof(jtentry) (= 4) }
|
||||
mulfactor:=4;
|
||||
cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, mulfactor, indexreg);
|
||||
reference_reset_symbol(href, table, (-aint(min_)) * mulfactor);
|
||||
|
||||
if not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
|
||||
begin
|
||||
href.index := indexreg;
|
||||
cg.a_load_ref_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, href, indexreg);
|
||||
end
|
||||
else
|
||||
begin
|
||||
hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
||||
cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
|
||||
reference_reset_base(href,hregister,0);
|
||||
href.index:=indexreg;
|
||||
indexreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
||||
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_S32,OS_ADDR,href,indexreg);
|
||||
cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,hregister,indexreg);
|
||||
end;
|
||||
hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
||||
cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
|
||||
reference_reset_base(href,hregister,0);
|
||||
href.index:=indexreg;
|
||||
indexreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
||||
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_S32,OS_ADDR,href,indexreg);
|
||||
cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,hregister,indexreg);
|
||||
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTCTR, indexreg));
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BCTR));
|
||||
|
||||
{ generate jump table }
|
||||
if not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
|
||||
begin
|
||||
new_section(current_procinfo.aktlocaldata,sec_rodata,current_procinfo.procdef.mangledname,sizeof(aint));
|
||||
current_procinfo.aktlocaldata.concat(Tai_label.Create(table));
|
||||
genitem(current_procinfo.aktlocaldata,hp);
|
||||
end
|
||||
else
|
||||
begin
|
||||
current_asmdata.CurrAsmList.concat(Tai_label.Create(table));
|
||||
genitem(current_asmdata.CurrAsmList,hp);
|
||||
end;
|
||||
current_asmdata.CurrAsmList.concat(Tai_label.Create(table));
|
||||
genitem(current_asmdata.CurrAsmList,hp);
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user