mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:26:24 +02:00
* force writing of new section before generating the jumptable
git-svn-id: trunk@1085 -
This commit is contained in:
parent
fdc4925fcd
commit
ca66b9f7c1
@ -82,30 +82,24 @@ implementation
|
|||||||
last : TConstExprInt;
|
last : TConstExprInt;
|
||||||
indexreg : tregister;
|
indexreg : tregister;
|
||||||
href : treference;
|
href : treference;
|
||||||
jumpsegment : TAAsmOutput;
|
|
||||||
|
|
||||||
procedure genitem(t : pcaselabel);
|
procedure genitem(list:taasmoutput;t : pcaselabel);
|
||||||
var
|
var
|
||||||
i : aint;
|
i : aint;
|
||||||
begin
|
begin
|
||||||
if assigned(t^.less) then
|
if assigned(t^.less) then
|
||||||
genitem(t^.less);
|
genitem(list,t^.less);
|
||||||
{ fill possible hole }
|
{ fill possible hole }
|
||||||
for i:=last+1 to t^._low-1 do
|
for i:=last+1 to t^._low-1 do
|
||||||
jumpSegment.concat(Tai_const.Create_sym(elselabel));
|
list.concat(Tai_const.Create_sym(elselabel));
|
||||||
for i:=t^._low to t^._high do
|
for i:=t^._low to t^._high do
|
||||||
jumpSegment.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
list.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
||||||
last:=t^._high;
|
last:=t^._high;
|
||||||
if assigned(t^.greater) then
|
if assigned(t^.greater) then
|
||||||
genitem(t^.greater);
|
genitem(list,t^.greater);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (cs_create_smart in aktmoduleswitches) or
|
|
||||||
(af_smartlink_sections in target_asm.flags) then
|
|
||||||
jumpsegment:=current_procinfo.aktlocaldata
|
|
||||||
else
|
|
||||||
jumpsegment:=asmlist[al_globals];
|
|
||||||
if not(jumptable_no_range) then
|
if not(jumptable_no_range) then
|
||||||
begin
|
begin
|
||||||
{ case expr less than min_ => goto elselabel }
|
{ case expr less than min_ => goto elselabel }
|
||||||
@ -124,11 +118,10 @@ implementation
|
|||||||
href.scalefactor:=4;
|
href.scalefactor:=4;
|
||||||
emit_ref(A_JMP,S_NO,href);
|
emit_ref(A_JMP,S_NO,href);
|
||||||
{ generate jump table }
|
{ generate jump table }
|
||||||
if not(cs_littlesize in aktglobalswitches) then
|
new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(aint));
|
||||||
jumpSegment.concat(Tai_Align.Create_Op(4,0));
|
current_procinfo.aktlocaldata.concat(Tai_label.Create(table));
|
||||||
jumpSegment.concat(Tai_label.Create(table));
|
|
||||||
last:=min_;
|
last:=min_;
|
||||||
genitem(hp);
|
genitem(current_procinfo.aktlocaldata,hp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,14 +68,13 @@ implementation
|
|||||||
last : TConstExprInt;
|
last : TConstExprInt;
|
||||||
indexreg : tregister;
|
indexreg : tregister;
|
||||||
href : treference;
|
href : treference;
|
||||||
jumpsegment : TAAsmOutput;
|
|
||||||
|
|
||||||
procedure genitem(t : pcaselabel);
|
procedure genitem(list:taasmoutput;t : pcaselabel);
|
||||||
var
|
var
|
||||||
i : aint;
|
i : aint;
|
||||||
begin
|
begin
|
||||||
if assigned(t^.less) then
|
if assigned(t^.less) then
|
||||||
genitem(t^.less);
|
genitem(list,t^.less);
|
||||||
{ fill possible hole }
|
{ fill possible hole }
|
||||||
for i:=last+1 to t^._low-1 do
|
for i:=last+1 to t^._low-1 do
|
||||||
jumpSegment.concat(Tai_const.Create_sym(elselabel));
|
jumpSegment.concat(Tai_const.Create_sym(elselabel));
|
||||||
@ -83,15 +82,10 @@ implementation
|
|||||||
jumpSegment.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
jumpSegment.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
||||||
last:=t^._high;
|
last:=t^._high;
|
||||||
if assigned(t^.greater) then
|
if assigned(t^.greater) then
|
||||||
genitem(t^.greater);
|
genitem(list,t^.greater);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (cs_create_smart in aktmoduleswitches) or
|
|
||||||
(af_smartlink_sections in target_asm.flags) then
|
|
||||||
jumpsegment:=current_procinfo.aktlocaldata
|
|
||||||
else
|
|
||||||
jumpsegment:=asmlist[al_globals];
|
|
||||||
if not(jumptable_no_range) then
|
if not(jumptable_no_range) then
|
||||||
begin
|
begin
|
||||||
{ case expr less than min_ => goto elselabel }
|
{ case expr less than min_ => goto elselabel }
|
||||||
@ -111,16 +105,15 @@ implementation
|
|||||||
href.index := indexreg;
|
href.index := indexreg;
|
||||||
|
|
||||||
cg.a_load_ref_reg(exprasmlist, OS_INT, OS_INT, href, indexreg);
|
cg.a_load_ref_reg(exprasmlist, OS_INT, OS_INT, href, indexreg);
|
||||||
|
|
||||||
exprasmlist.concat(taicpu.op_reg(A_MTCTR, indexreg));
|
exprasmlist.concat(taicpu.op_reg(A_MTCTR, indexreg));
|
||||||
exprasmlist.concat(taicpu.op_none(A_BCTR));
|
exprasmlist.concat(taicpu.op_none(A_BCTR));
|
||||||
|
|
||||||
{ generate jump table }
|
{ generate jump table }
|
||||||
if not(cs_littlesize in aktglobalswitches) then
|
new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(aint));
|
||||||
jumpSegment.concat(Tai_Align.Create_Op(4, 0));
|
current_procinfo.aktlocaldata.concat(Tai_label.Create(table));
|
||||||
jumpSegment.concat(Tai_label.Create(table));
|
|
||||||
last:=min_;
|
last:=min_;
|
||||||
genitem(hp);
|
genitem(current_procinfo.aktlocaldata,hp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -845,27 +845,18 @@ implementation
|
|||||||
aktproccode.concatlist(templist);
|
aktproccode.concatlist(templist);
|
||||||
|
|
||||||
{$ifdef ARM}
|
{$ifdef ARM}
|
||||||
|
{ because of the limited constant size of the arm, all data access is done pc relative }
|
||||||
insertpcrelativedata(aktproccode,aktlocaldata);
|
insertpcrelativedata(aktproccode,aktlocaldata);
|
||||||
{$endif ARM}
|
{$endif ARM}
|
||||||
|
|
||||||
{ save local data (casetable) also in the same file }
|
|
||||||
if assigned(aktlocaldata) and
|
|
||||||
(not aktlocaldata.empty) then
|
|
||||||
begin
|
|
||||||
{ because of the limited constant size of the arm, all data access is done pc relative }
|
|
||||||
if target_info.cpu=cpu_arm then
|
|
||||||
aktproccode.concatlist(aktlocaldata)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
new_section(aktproccode,sec_data,lower(procdef.mangledname),0);
|
|
||||||
aktproccode.concatlist(aktlocaldata);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ add the procedure to the al_procedures }
|
{ add the procedure to the al_procedures }
|
||||||
maybe_new_object_file(asmlist[al_procedures]);
|
maybe_new_object_file(asmlist[al_procedures]);
|
||||||
new_section(asmlist[al_procedures],sec_code,lower(procdef.mangledname),aktalignment.procalign);
|
new_section(asmlist[al_procedures],sec_code,lower(procdef.mangledname),aktalignment.procalign);
|
||||||
asmlist[al_procedures].concatlist(aktproccode);
|
asmlist[al_procedures].concatlist(aktproccode);
|
||||||
|
{ save local data (casetable) also in the same file }
|
||||||
|
if assigned(aktlocaldata) and
|
||||||
|
(not aktlocaldata.empty) then
|
||||||
|
asmlist[al_procedures].concatlist(aktlocaldata);
|
||||||
|
|
||||||
{ only now we can remove the temps }
|
{ only now we can remove the temps }
|
||||||
tg.resettempgen;
|
tg.resettempgen;
|
||||||
|
@ -68,30 +68,24 @@ unit ncpuset;
|
|||||||
last : TConstExprInt;
|
last : TConstExprInt;
|
||||||
indexreg,jmpreg,basereg : tregister;
|
indexreg,jmpreg,basereg : tregister;
|
||||||
href : treference;
|
href : treference;
|
||||||
jumpsegment : TAAsmOutput;
|
|
||||||
|
|
||||||
procedure genitem(t : pcaselabel);
|
procedure genitem(list:taasmoutput;t : pcaselabel);
|
||||||
var
|
var
|
||||||
i : aint;
|
i : aint;
|
||||||
begin
|
begin
|
||||||
if assigned(t^.less) then
|
if assigned(t^.less) then
|
||||||
genitem(t^.less);
|
genitem(list,t^.less);
|
||||||
{ fill possible hole }
|
{ fill possible hole }
|
||||||
for i:=last+1 to t^._low-1 do
|
for i:=last+1 to t^._low-1 do
|
||||||
jumpSegment.concat(Tai_const.Create_sym(elselabel));
|
list.concat(Tai_const.Create_sym(elselabel));
|
||||||
for i:=t^._low to t^._high do
|
for i:=t^._low to t^._high do
|
||||||
jumpSegment.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
list.concat(Tai_const.Create_sym(blocklabel(t^.blockid)));
|
||||||
last:=t^._high;
|
last:=t^._high;
|
||||||
if assigned(t^.greater) then
|
if assigned(t^.greater) then
|
||||||
genitem(t^.greater);
|
genitem(list,t^.greater);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (cs_create_smart in aktmoduleswitches) or
|
|
||||||
(af_smartlink_sections in target_asm.flags) then
|
|
||||||
jumpsegment:=current_procinfo.aktlocaldata
|
|
||||||
else
|
|
||||||
jumpsegment:=asmlist[al_globals];
|
|
||||||
if not(jumptable_no_range) then
|
if not(jumptable_no_range) then
|
||||||
begin
|
begin
|
||||||
{ case expr less than min_ => goto elselabel }
|
{ case expr less than min_ => goto elselabel }
|
||||||
@ -119,11 +113,10 @@ unit ncpuset;
|
|||||||
{ Delay slot }
|
{ Delay slot }
|
||||||
exprasmlist.concat(taicpu.op_none(A_NOP));
|
exprasmlist.concat(taicpu.op_none(A_NOP));
|
||||||
{ generate jump table }
|
{ generate jump table }
|
||||||
if not(cs_littlesize in aktglobalswitches) then
|
new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(aint));
|
||||||
jumpSegment.concat(Tai_Align.Create_Op(4,0));
|
current_procinfo.aktlocaldata.concat(Tai_label.Create(table));
|
||||||
jumpSegment.concat(Tai_label.Create(table));
|
|
||||||
last:=min_;
|
last:=min_;
|
||||||
genitem(hp);
|
genitem(current_procinfo.aktlocaldata,hp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user