* some ppc stuff fixed

* memory leak fixed
This commit is contained in:
florian 2003-10-19 01:34:30 +00:00
parent c5df303517
commit 05fcae577a
10 changed files with 161 additions and 48 deletions

View File

@ -183,9 +183,9 @@ unit cgobj;
} }
{ Copy a parameter to a (temporary) reference } { Copy a parameter to a (temporary) reference }
procedure a_load_param_ref(list : taasmoutput;const locpara : tparalocation;const ref:treference);virtual; procedure a_loadany_param_ref(list : taasmoutput;const locpara : tparalocation;const ref:treference;shuffle : pmmshuffle);virtual;
{ Copy a parameter to a register } { Copy a parameter to a register }
procedure a_load_param_reg(list : taasmoutput;const locpara : tparalocation;const reg:tregister);virtual; procedure a_loadany_param_reg(list : taasmoutput;const locpara : tparalocation;const reg:tregister;shuffle : pmmshuffle);virtual;
{# Emits instruction to call the method specified by symbol name. {# Emits instruction to call the method specified by symbol name.
This routine must be overriden for each new target cpu. This routine must be overriden for each new target cpu.
@ -680,7 +680,7 @@ implementation
end; end;
procedure tcg.a_load_param_ref(list : taasmoutput;const locpara : tparalocation;const ref:treference); procedure tcg.a_loadany_param_ref(list : taasmoutput;const locpara : tparalocation;const ref:treference;shuffle : pmmshuffle);
begin begin
case locpara.loc of case locpara.loc of
LOC_CREGISTER, LOC_CREGISTER,
@ -705,16 +705,27 @@ implementation
a_load_reg_ref(list,locpara.size,locpara.size,locpara.register,ref); a_load_reg_ref(list,locpara.size,locpara.size,locpara.register,ref);
end; end;
end; end;
LOC_MMREGISTER,
LOC_CMMREGISTER:
begin
getexplicitregister(list,locpara.register);
ungetregister(list,locpara.register);
a_loadmm_reg_ref(list,locpara.size,locpara.size,locpara.register,ref,shuffle);
end;
LOC_FPUREGISTER, LOC_FPUREGISTER,
LOC_CFPUREGISTER: LOC_CFPUREGISTER:
begin
getexplicitregister(list,locpara.register);
ungetregister(list,locpara.register);
a_loadfpu_reg_ref(list,locpara.size,locpara.register,ref); a_loadfpu_reg_ref(list,locpara.size,locpara.register,ref);
end;
else else
internalerror(2002081302); internalerror(2002081302);
end; end;
end; end;
procedure tcg.a_load_param_reg(list : taasmoutput;const locpara : tparalocation;const reg:tregister); procedure tcg.a_loadany_param_reg(list : taasmoutput;const locpara : tparalocation;const reg:tregister;shuffle : pmmshuffle);
var var
href : treference; href : treference;
begin begin
@ -734,7 +745,20 @@ implementation
end; end;
LOC_CFPUREGISTER, LOC_CFPUREGISTER,
LOC_FPUREGISTER: LOC_FPUREGISTER:
begin
getexplicitregister(list,locpara.register);
ungetregister(list,locpara.register);
getexplicitregister(list,reg);
a_loadfpu_reg_reg(list,locpara.size,locpara.register,reg); a_loadfpu_reg_reg(list,locpara.size,locpara.register,reg);
end;
LOC_MMREGISTER,
LOC_CMMREGISTER:
begin
getexplicitregister(list,locpara.register);
ungetregister(list,locpara.register);
getexplicitregister(list,reg);
a_loadmm_reg_reg(list,locpara.size,locpara.size,locpara.register,reg,shuffle);
end;
LOC_REFERENCE, LOC_REFERENCE,
LOC_CREFERENCE: LOC_CREFERENCE:
begin begin
@ -1787,7 +1811,11 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.132 2003-10-17 15:25:18 florian Revision 1.133 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.132 2003/10/17 15:25:18 florian
* fixed more ppc stuff * fixed more ppc stuff
Revision 1.131 2003/10/17 14:38:32 peter Revision 1.131 2003/10/17 14:38:32 peter

View File

@ -875,7 +875,11 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.41 2003-10-18 09:16:45 hajny Revision 1.42 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.41 2003/10/18 09:16:45 hajny
* Watcom patch by Wiktor Sywula * Watcom patch by Wiktor Sywula
Revision 1.40 2003/09/30 08:39:50 michael Revision 1.40 2003/09/30 08:39:50 michael

View File

@ -36,11 +36,6 @@ unit cpupara;
symconst,symtype,symdef,paramgr; symconst,symtype,symdef,paramgr;
type type
{ Returns the location for the nr-st 32 Bit int parameter
if every parameter before is an 32 Bit int parameter as well
and if the calling conventions for the helper routines of the
rtl are used.
}
ti386paramanager = class(tparamanager) ti386paramanager = class(tparamanager)
function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override; function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override;
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override; function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
@ -48,6 +43,11 @@ unit cpupara;
function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;override; function get_volatile_registers_int(calloption : tproccalloption):tcpuregisterset;override;
function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;override; function get_volatile_registers_fpu(calloption : tproccalloption):tcpuregisterset;override;
function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;override; function get_volatile_registers_mm(calloption : tproccalloption):tcpuregisterset;override;
{ Returns the location for the nr-st 32 Bit int parameter
if every parameter before is an 32 Bit int parameter as well
and if the calling conventions for the helper routines of the
rtl are used.
}
function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override; function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override; function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tlinkedlist):longint;override; function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tlinkedlist):longint;override;
@ -446,7 +446,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.41 2003-10-17 14:38:32 peter Revision 1.42 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.41 2003/10/17 14:38:32 peter
* 64k registers supported * 64k registers supported
* fixed some memory leaks * fixed some memory leaks

View File

@ -833,7 +833,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.65 2003-10-17 14:38:32 peter Revision 1.66 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.65 2003/10/17 14:38:32 peter
* 64k registers supported * 64k registers supported
* fixed some memory leaks * fixed some memory leaks

View File

@ -1115,7 +1115,15 @@ implementation
{ cg.a_load_param_reg will first allocate and then deallocate paraloc } { cg.a_load_param_reg will first allocate and then deallocate paraloc }
{ register (if the parameter resides in a register) and then allocate } { register (if the parameter resides in a register) and then allocate }
{ the regvar (which is currently not allocated) } { the regvar (which is currently not allocated) }
cg.a_load_param_reg(list,hp.paraloc[calleeside],tvarsym(hp.parasym).localloc.register); cg.a_loadany_param_reg(list,hp.paraloc[calleeside],tvarsym(hp.parasym).localloc.register,nil);
end;
LOC_FPUREGISTER:
begin
gotregvarparas := true;
{ cg.a_load_param_reg will first allocate and then deallocate paraloc }
{ register (if the parameter resides in a register) and then allocate }
{ the regvar (which is currently not allocated) }
cg.a_loadany_param_reg(list,hp.paraloc[calleeside],tvarsym(hp.parasym).localloc.register,nil);
end; end;
LOC_REFERENCE : LOC_REFERENCE :
begin begin
@ -1144,7 +1152,7 @@ implementation
{$endif cpu64bit} {$endif cpu64bit}
cg.ungetregister(list,hp.paraloc[calleeside].register); cg.ungetregister(list,hp.paraloc[calleeside].register);
reference_reset_base(href,tvarsym(hp.parasym).localloc.reference.index,tvarsym(hp.parasym).localloc.reference.offset); reference_reset_base(href,tvarsym(hp.parasym).localloc.reference.index,tvarsym(hp.parasym).localloc.reference.offset);
cg.a_load_param_ref(list,hp.paraloc[calleeside],href); cg.a_loadany_param_ref(list,hp.paraloc[calleeside],href,nil);
end; end;
end; end;
else else
@ -1957,7 +1965,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.160 2003-10-17 15:08:34 peter Revision 1.161 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.160 2003/10/17 15:08:34 peter
* commented out more obsolete constants * commented out more obsolete constants
Revision 1.159 2003/10/17 14:38:32 peter Revision 1.159 2003/10/17 14:38:32 peter

View File

@ -232,6 +232,9 @@ implementation
symtablestack.next.foreach_static({$ifdef FPCPROCVAR}@{$endif}clearrefs,nil); symtablestack.next.foreach_static({$ifdef FPCPROCVAR}@{$endif}clearrefs,nil);
{ firstpass everything } { firstpass everything }
do_firstpass(p); do_firstpass(p);
{ after pass 1, we should have all necessary information to set the temp. start location }
current_procinfo.set_first_temp_offset;
{ only do secondpass if there are no errors } { only do secondpass if there are no errors }
if ErrorCount=0 then if ErrorCount=0 then
begin begin
@ -278,7 +281,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.71 2003-10-18 15:41:26 peter Revision 1.72 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.71 2003/10/18 15:41:26 peter
* made worklists dynamic in size * made worklists dynamic in size
Revision 1.70 2003/10/17 15:08:34 peter Revision 1.70 2003/10/17 15:08:34 peter

View File

@ -49,6 +49,8 @@ unit cgcpu;
procedure ungetregister(list:Taasmoutput;r:Tregister);override; procedure ungetregister(list:Taasmoutput;r:Tregister);override;
procedure add_move_instruction(instr:Taicpu);override; procedure add_move_instruction(instr:Taicpu);override;
procedure do_register_allocation(list:Taasmoutput;headertai:tai);override; procedure do_register_allocation(list:Taasmoutput;headertai:tai);override;
procedure allocexplicitregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);override;
procedure deallocexplicitregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);override;
{ passing parameters, per default the parameter is pushed } { passing parameters, per default the parameter is pushed }
{ nr gives the number of the parameter (enumerated from } { nr gives the number of the parameter (enumerated from }
@ -184,8 +186,9 @@ const
{$warning FIX ME} {$warning FIX ME}
rgfpu:=trgcpu.create(R_FPUREGISTER,R_SUBNONE, rgfpu:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5],first_fpu_imreg,[]); [RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5],first_fpu_imreg,[]);
rgmm:=trgcpu.create(R_MMXREGISTER,R_SUBNONE, {$warning FIX ME}
[],first_mm_imreg,[]); rgmm:=trgcpu.create(R_MMREGISTER,R_SUBNONE,
[RS_M0,RS_M1,RS_M2],first_mm_imreg,[]);
end; end;
@ -251,6 +254,36 @@ const
end; end;
procedure tcgppc.allocexplicitregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);
begin
case rt of
R_INTREGISTER :
rgint.allocexplicitregisters(list,r);
R_FPUREGISTER :
rgfpu.allocexplicitregisters(list,r);
R_MMREGISTER :
rgmm.allocexplicitregisters(list,r);
else
internalerror(200310092);
end;
end;
procedure tcgppc.deallocexplicitregisters(list:Taasmoutput;rt:Tregistertype;r:Tcpuregisterset);
begin
case rt of
R_INTREGISTER :
rgint.deallocexplicitregisters(list,r);
R_FPUREGISTER :
rgfpu.deallocexplicitregisters(list,r);
R_MMREGISTER :
rgmm.deallocexplicitregisters(list,r);
else
internalerror(200310093);
end;
end;
procedure tcgppc.add_move_instruction(instr:Taicpu); procedure tcgppc.add_move_instruction(instr:Taicpu);
begin begin
rgint.add_move_instruction(instr); rgint.add_move_instruction(instr);
@ -1025,7 +1058,7 @@ const
{ FIXME: has to be R_F8 instad of R_F14 for SYSV abi } { FIXME: has to be R_F8 instad of R_F14 for SYSV abi }
for regcounter:=RS_F14 to RS_F31 do for regcounter:=RS_F14 to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
usesfpr:= true; usesfpr:= true;
firstregfpu:=regcounter; firstregfpu:=regcounter;
@ -1037,7 +1070,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
firstreggpr:=regcounter2; firstreggpr:=regcounter2;
@ -1120,7 +1153,7 @@ const
reference_reset_base(href,NR_R12,-8); reference_reset_base(href,NR_R12,-8);
for regcounter:=firstregfpu to RS_F31 do for regcounter:=firstregfpu to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
a_loadfpu_reg_ref(list,OS_F64,newreg(R_FPUREGISTER,regcounter,R_SUBNONE),href); a_loadfpu_reg_ref(list,OS_F64,newreg(R_FPUREGISTER,regcounter,R_SUBNONE),href);
dec(href.offset,8); dec(href.offset,8);
@ -1146,7 +1179,7 @@ const
reference_reset_base(href,NR_R12,-4); reference_reset_base(href,NR_R12,-4);
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href); a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href);
@ -1239,7 +1272,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter:=RS_F14 to RS_F31 do for regcounter:=RS_F14 to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
usesfpr:=true; usesfpr:=true;
firstregfpu:=regcounter; firstregfpu:=regcounter;
@ -1251,7 +1284,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
firstreggpr:=regcounter2; firstreggpr:=regcounter2;
@ -1272,7 +1305,7 @@ const
reference_reset_base(href,NR_R12,-8); reference_reset_base(href,NR_R12,-8);
for regcounter := firstregfpu to RS_F31 do for regcounter := firstregfpu to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
a_loadfpu_ref_reg(list,OS_F64,href,newreg(R_FPUREGISTER,regcounter,R_SUBNONE)); a_loadfpu_ref_reg(list,OS_F64,href,newreg(R_FPUREGISTER,regcounter,R_SUBNONE));
dec(href.offset,8); dec(href.offset,8);
@ -1285,7 +1318,7 @@ const
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE)); a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
@ -1370,7 +1403,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter:=RS_F14 to RS_F31 do for regcounter:=RS_F14 to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
usesfpr:=true; usesfpr:=true;
firstregfpu:=regcounter; firstregfpu:=regcounter;
@ -1381,7 +1414,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
firstreggpr:=regcounter2; firstreggpr:=regcounter2;
@ -1439,7 +1472,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter:=RS_F14 to RS_F31 do for regcounter:=RS_F14 to RS_F31 do
begin begin
if supregset_in(rgfpu.used_in_proc,regcounter) then if regcounter in rgfpu.used_in_proc then
begin begin
usesfpr:=true; usesfpr:=true;
firstregfpu:=regcounter; firstregfpu:=regcounter;
@ -1451,7 +1484,7 @@ const
if not (po_assembler in current_procinfo.procdef.procoptions) then if not (po_assembler in current_procinfo.procdef.procoptions) then
for regcounter2:=RS_R13 to RS_R31 do for regcounter2:=RS_R13 to RS_R31 do
begin begin
if supregset_in(rgint.used_in_proc,regcounter2) then if regcounter2 in rgint.used_in_proc then
begin begin
usesgpr:=true; usesgpr:=true;
firstreggpr:=regcounter2; firstreggpr:=regcounter2;
@ -2139,6 +2172,7 @@ const
if (getsupreg(ref.index) < first_int_imreg) and if (getsupreg(ref.index) < first_int_imreg) and
(supregset_in(rgint.unusedregs,getsupreg(ref.index))) then (supregset_in(rgint.unusedregs,getsupreg(ref.index))) then
begin begin
internalerror(200310191);
rgint.getexplicitregister(list,ref.index); rgint.getexplicitregister(list,ref.index);
orgindex := ref.index; orgindex := ref.index;
freeindex := true; freeindex := true;
@ -2455,7 +2489,11 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.133 2003-10-17 15:25:18 florian Revision 1.134 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.133 2003/10/17 15:25:18 florian
* fixed more ppc stuff * fixed more ppc stuff
Revision 1.132 2003/10/17 15:08:34 peter Revision 1.132 2003/10/17 15:08:34 peter

View File

@ -122,7 +122,7 @@ uses
first_fpu_imreg = $20; first_fpu_imreg = $20;
{ MM Super register first and last } { MM Super register first and last }
first_mm_imreg = $0; first_mm_imreg = $20;
{$warning TODO Calculate bsstart} {$warning TODO Calculate bsstart}
regnumber_count_bsstart = 64; regnumber_count_bsstart = 64;
@ -714,7 +714,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.72 2003-10-17 15:08:34 peter Revision 1.73 2003-10-19 01:34:31 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.72 2003/10/17 15:08:34 peter
* commented out more obsolete constants * commented out more obsolete constants
Revision 1.71 2003/10/11 16:06:42 florian Revision 1.71 2003/10/11 16:06:42 florian

View File

@ -660,7 +660,7 @@ implementation
aktfilepos:=exitpos; aktfilepos:=exitpos;
aktlocalswitches:=exitswitches; aktlocalswitches:=exitswitches;
gen_finalize_code(templist,false); gen_finalize_code(templist,false);
{ the finalcode must be concatted if there was no position available, { the finalcode must be concated if there was no position available,
using insertlistafter will result in an insert at the start using insertlistafter will result in an insert at the start
when currentai=nil } when currentai=nil }
if assigned(tasmnode(finalasmnode).currenttai) then if assigned(tasmnode(finalasmnode).currenttai) then
@ -1260,12 +1260,14 @@ implementation
end; end;
begin
cprocinfo:=tcgprocinfo;
end. end.
{ {
$Log$ $Log$
Revision 1.163 2003-10-17 14:38:32 peter Revision 1.164 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.163 2003/10/17 14:38:32 peter
* 64k registers supported * 64k registers supported
* fixed some memory leaks * fixed some memory leaks

View File

@ -196,6 +196,7 @@ unit rgobj;
Afirst_imaginary:Tsuperregister; Afirst_imaginary:Tsuperregister;
Apreserved_by_proc:Tcpuregisterset); Apreserved_by_proc:Tcpuregisterset);
destructor destroy;override; destructor destroy;override;
{# Allocate a register. An internalerror will be generated if there is {# Allocate a register. An internalerror will be generated if there is
no more free registers which can be allocated.} no more free registers which can be allocated.}
function getregister(list:Taasmoutput;subreg:Tsubregister):Tregister; function getregister(list:Taasmoutput;subreg:Tsubregister):Tregister;
@ -233,11 +234,12 @@ unit rgobj;
{# Adds an interference edge.} {# Adds an interference edge.}
procedure add_edge(u,v:Tsuperregister); procedure add_edge(u,v:Tsuperregister);
unusedregs : Tsuperregisterset;
protected protected
regtype : Tregistertype; regtype : Tregistertype;
{ default subregister used } { default subregister used }
defaultsub : tsubregister; defaultsub : tsubregister;
unusedregs : Tsuperregisterset;
{# First imaginary register.} {# First imaginary register.}
first_imaginary : Tsuperregister; first_imaginary : Tsuperregister;
{# Highest register allocated until now.} {# Highest register allocated until now.}
@ -311,6 +313,8 @@ implementation
destructor tsuperregisterworklist.done; destructor tsuperregisterworklist.done;
begin begin
if assigned(buf) then
freemem(buf);
end; end;
@ -505,6 +509,9 @@ implementation
var var
i : Tsuperregister; i : Tsuperregister;
begin begin
{ empty super register sets can cause very strange problems }
if high(Ausable)=0 then
internalerror(200210181);
first_imaginary:=Afirst_imaginary; first_imaginary:=Afirst_imaginary;
maxreg:=Afirst_imaginary; maxreg:=Afirst_imaginary;
regtype:=Aregtype; regtype:=Aregtype;
@ -524,7 +531,6 @@ implementation
worklist_moves:=Tlinkedlist.create; worklist_moves:=Tlinkedlist.create;
{ Usable registers } { Usable registers }
fillchar(usable_registers,sizeof(usable_registers),0); fillchar(usable_registers,sizeof(usable_registers),0);
if high(Ausable)>0 then
for i:=low(Ausable) to high(Ausable) do for i:=low(Ausable) to high(Ausable) do
usable_registers[i]:=Ausable[i]; usable_registers[i]:=Ausable[i];
usable_registers_cnt:=high(Ausable)+1; usable_registers_cnt:=high(Ausable)+1;
@ -1660,7 +1666,7 @@ implementation
end; end;
end; end;
p:=Tai(p.next); p:=Tai(p.next);
end; end;
aktfilepos:=current_procinfo.exitpos; aktfilepos:=current_procinfo.exitpos;
i:=spillednodes.head; i:=spillednodes.head;
while (i<>spillednodes.tail) do while (i<>spillednodes.tail) do
@ -1765,7 +1771,11 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.88 2003-10-18 15:41:26 peter Revision 1.89 2003-10-19 01:34:30 florian
* some ppc stuff fixed
* memory leak fixed
Revision 1.88 2003/10/18 15:41:26 peter
* made worklists dynamic in size * made worklists dynamic in size
Revision 1.87 2003/10/17 16:16:08 peter Revision 1.87 2003/10/17 16:16:08 peter