* lots of newra fixes (need getfuncretparaloc implementation for i386)!

* renamed all_intregisters to volatile_intregisters and made it
    processor dependent
This commit is contained in:
Jonas Maebe 2003-06-17 16:34:44 +00:00
parent e6e43724c3
commit 404d344d92
16 changed files with 247 additions and 103 deletions

View File

@ -287,15 +287,6 @@ unit rgcpu;
end; end;
procedure trgcpu.ungetreference(list: taasmoutput; const ref : treference);
begin
if (ref.base.number<>NR_NO) and (ref.base.number<>NR_FRAME_POINTER_REG) then
ungetregisterint(list,ref.base);
if (ref.index.number<>NR_NO) and (ref.index.number<>NR_FRAME_POINTER_REG) then
ungetregisterint(list,ref.index);
end;
{$ifndef newra} {$ifndef newra}
procedure trgcpu.pushusedintregisters(list:Taasmoutput; procedure trgcpu.pushusedintregisters(list:Taasmoutput;
var pushed:Tpushedsavedint; var pushed:Tpushedsavedint;
@ -517,7 +508,12 @@ end.
{ {
$Log$ $Log$
Revision 1.27 2003-06-13 21:19:31 peter Revision 1.28 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.27 2003/06/13 21:19:31 peter
* current_procdef removed, use current_procinfo.procdef instead * current_procdef removed, use current_procinfo.procdef instead
Revision 1.26 2003/06/12 21:12:20 peter Revision 1.26 2003/06/12 21:12:20 peter

View File

@ -174,6 +174,10 @@ uses
first_supreg = $01; first_supreg = $01;
last_supreg = $10; last_supreg = $10;
{$warning FIXME!!!}
{ registers which may be destroyed by calls }
VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
first_imreg = $11; first_imreg = $11;
last_imreg = $ff; last_imreg = $ff;
@ -705,7 +709,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.21 2003-06-03 13:01:59 daniel Revision 1.22 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.21 2003/06/03 13:01:59 daniel
* Register allocator finished * Register allocator finished
Revision 1.20 2003/04/23 13:40:33 peter Revision 1.20 2003/04/23 13:40:33 peter

View File

@ -2351,7 +2351,7 @@ type
if not (block_type in [bt_const,bt_type]) then if not (block_type in [bt_const,bt_type]) then
include(current_procinfo.flags,pi_do_call); include(current_procinfo.flags,pi_do_call);
{$ifndef newra} {$ifndef newra}
rg.incrementintregisterpushed(all_intregisters); rg.incrementintregisterpushed(VOLATILE_INTREGISTERS);
{$endif} {$endif}
rg.incrementotherregisterpushed(all_registers); rg.incrementotherregisterpushed(all_registers);
end end
@ -2635,7 +2635,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.171 2003-06-15 16:47:33 jonas Revision 1.172 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.171 2003/06/15 16:47:33 jonas
* fixed revious commit * fixed revious commit
Revision 1.170 2003/06/15 15:10:57 jonas Revision 1.170 2003/06/15 15:10:57 jonas

View File

@ -441,10 +441,13 @@ implementation
end end
else else
begin begin
{$ifndef newra}
tg.gettemp(exprasmlist,pointer_size,tt_normal,href); tg.gettemp(exprasmlist,pointer_size,tt_normal,href);
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,r,href); cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,r,href);
{$ifdef newra}
cg.a_reg_dealloc(exprasmlist,r); cg.a_reg_dealloc(exprasmlist,r);
{$else newra}
hregister := rg.getaddressregister(exprasmlist);
cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,r,hregister);
{$endif newra} {$endif newra}
{ in case of a regular funcretnode with ret_in_param, the } { in case of a regular funcretnode with ret_in_param, the }
{ original funcretnode isn't touched -> make sure it's } { original funcretnode isn't touched -> make sure it's }
@ -454,11 +457,16 @@ implementation
location := tempnode.location; location := tempnode.location;
tempnode.free; tempnode.free;
cg.g_decrrefcount(exprasmlist,resulttype.def,location.reference, false); cg.g_decrrefcount(exprasmlist,resulttype.def,location.reference, false);
{$ifndef newra}
cg.a_load_ref_ref(exprasmlist,OS_ADDR,OS_ADDR,href,location.reference); cg.a_load_ref_ref(exprasmlist,OS_ADDR,OS_ADDR,href,location.reference);
{ since we used a normal temp, it won't be finalized or } { since we used a normal temp, it won't be finalized or }
{ decref'd later -> no need to zero it } { decref'd later -> no need to zero it }
tg.ungettemp(exprasmlist,href); tg.ungettemp(exprasmlist,href);
end; {$else newra}
cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
rg.ungetregisterint(exprasmlist,hregister);
{$endif newra}
end;
end end
else else
{ we have only to handle the result if it is used } { we have only to handle the result if it is used }
@ -647,6 +655,7 @@ implementation
{$ifdef newra} {$ifdef newra}
i:Tsuperregister; i:Tsuperregister;
regs_to_alloc,regs_to_free:Tsupregset; regs_to_alloc,regs_to_free:Tsupregset;
funcretloc: tparalocation;
{$else} {$else}
regs_to_push_int : Tsupregset; regs_to_push_int : Tsupregset;
pushedint : tpushedsavedint; pushedint : tpushedsavedint;
@ -712,17 +721,25 @@ implementation
{$ifdef newra} {$ifdef newra}
regs_to_alloc:=Tprocdef(procdefinition).usedintregisters; regs_to_alloc:=Tprocdef(procdefinition).usedintregisters;
{$ifndef cpu64bit}
if resulttype.def.size>sizeof(aword) then
begin
include(regs_to_alloc,RS_FUNCTION_RESULT64_LOW_REG);
include(regs_to_alloc,RS_FUNCTION_RESULT64_HIGH_REG);
end
else
{$endif cpu64bit}
if (not is_void(resulttype.def)) and if (not is_void(resulttype.def)) and
(not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
include(regs_to_alloc,RS_FUNCTION_RESULT_REG); begin
funcretloc := paramanager.getfuncretparaloc(procdefinition);
case funcretloc.loc of
LOC_REGISTER,LOC_CREGISTER:
begin
{$ifndef cpu64bit}
if funcretloc.size in [OS_S64,OS_64] then
begin
include(regs_to_alloc,funcretloc.registerlow.number shr 8);
include(regs_to_alloc,funcretloc.registerhigh.number shr 8);
end
else
{$endif cpu64bit}
include(regs_to_alloc,funcretloc.register.number shr 8);
end;
end;
end;
{$else} {$else}
{ save all used registers and possible registers { save all used registers and possible registers
used for the return value } used for the return value }
@ -762,20 +779,28 @@ implementation
begin begin
{No procedure is allowed to destroy ebp.} {No procedure is allowed to destroy ebp.}
{$ifdef newra} {$ifdef newra}
regs_to_alloc:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG]; regs_to_alloc:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
{$ifndef cpu64bit}
if resulttype.def.size>sizeof(aword) then
begin
include(regs_to_alloc,RS_FUNCTION_RESULT64_LOW_REG);
include(regs_to_alloc,RS_FUNCTION_RESULT64_HIGH_REG);
end
else
{$endif cpu64bit}
if (not is_void(resulttype.def)) and if (not is_void(resulttype.def)) and
(not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
include(regs_to_alloc,RS_FUNCTION_RESULT_REG); begin
funcretloc := paramanager.getfuncretparaloc(procdefinition);
case funcretloc.loc of
LOC_REGISTER,LOC_CREGISTER:
begin
{$ifndef cpu64bit}
if funcretloc.size in [OS_S64,OS_64] then
begin
include(regs_to_alloc,funcretloc.registerlow.number shr 8);
include(regs_to_alloc,funcretloc.registerhigh.number shr 8);
end
else
{$endif cpu64bit}
include(regs_to_alloc,funcretloc.register.number shr 8);
end;
end;
end;
{$else} {$else}
regs_to_push_int := all_intregisters-[RS_FRAME_POINTER_REG]; regs_to_push_int := VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int); rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
{$endif} {$endif}
{$ifdef i386} {$ifdef i386}
@ -987,7 +1012,7 @@ implementation
{$ifndef newra} {$ifndef newra}
helpref:=right.location.reference; helpref:=right.location.reference;
rg.saveintregvars(exprasmlist,ALL_INTREGISTERS); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
rg.saveotherregvars(exprasmlist,ALL_REGISTERS); rg.saveotherregvars(exprasmlist,ALL_REGISTERS);
if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
@ -1032,17 +1057,22 @@ implementation
{$ifdef newra} {$ifdef newra}
regs_to_free:=regs_to_alloc; regs_to_free:=regs_to_alloc;
if (not is_void(resulttype.def)) and if (not is_void(resulttype.def)) and
(not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
begin begin
case funcretloc.loc of
LOC_REGISTER,LOC_CREGISTER:
begin
{$ifndef cpu64bit} {$ifndef cpu64bit}
if resulttype.def.size>sizeof(aword) then if funcretloc.size in [OS_S64,OS_64] then
begin begin
exclude(regs_to_free,RS_FUNCTION_RESULT64_HIGH_REG); exclude(regs_to_free,funcretloc.registerlow.number shr 8);
exclude(regs_to_free,RS_FUNCTION_RESULT64_LOW_REG); exclude(regs_to_free,funcretloc.registerhigh.number shr 8);
end end
else else
{$endif cpu64bit} {$endif cpu64bit}
exclude(regs_to_free,RS_FUNCTION_RESULT_REG); exclude(regs_to_free,funcretloc.register.number shr 8);
end;
end;
end; end;
r.enum:=R_INTREGISTER; r.enum:=R_INTREGISTER;
for i:=first_supreg to last_supreg do for i:=first_supreg to last_supreg do
@ -1114,6 +1144,7 @@ implementation
pushedint : tpushedsavedint; pushedint : tpushedsavedint;
pushedregs : tmaybesave; pushedregs : tmaybesave;
{$endif} {$endif}
funcretloc: tparalocation;
oldpushedparasize : longint; oldpushedparasize : longint;
{ adress returned from an I/O-error } { adress returned from an I/O-error }
iolabel : tasmlabel; iolabel : tasmlabel;
@ -1277,19 +1308,25 @@ implementation
regs_to_push_int := tprocdef(procdefinition).usedintregisters; regs_to_push_int := tprocdef(procdefinition).usedintregisters;
regs_to_push_other := tprocdef(procdefinition).usedotherregisters; regs_to_push_other := tprocdef(procdefinition).usedotherregisters;
if (not is_void(resulttype.def)) and if (not is_void(resulttype.def)) and
(not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then not(paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
begin begin
include(regs_to_push_int,RS_FUNCTION_RESULT_REG); funcretloc := paramanager.getfuncretparaloc(procdefinition);
case funcretloc.loc of
LOC_REGISTER,LOC_CREGISTER:
begin
{$ifndef cpu64bit} {$ifndef cpu64bit}
if resulttype.def.size>sizeof(aword) then if funcretloc.size in [OS_S64,OS_64] then
begin begin
include(regs_to_push_int,RS_FUNCTION_RESULT64_LOW_REG); include(regs_to_push_int,funcretloc.registerlow.number shr 8);
include(regs_to_push_int,RS_FUNCTION_RESULT64_HIGH_REG); include(regs_to_push_int,funcretloc.registerhigh.number shr 8);
end end
else else
{$endif cpu64bit} {$endif cpu64bit}
include(regs_to_push_int,RS_FUNCTION_RESULT_REG); include(regs_to_push_int,funcretloc.register.number shr 8);
end; end;
end;
end;
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int); rg.saveusedintregisters(exprasmlist,pushedint,regs_to_push_int);
{$endif} {$endif}
@ -1494,7 +1531,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.94 2003-06-15 16:52:02 jonas Revision 1.95 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.94 2003/06/15 16:52:02 jonas
* release function result registers if the functino result isn't used * release function result registers if the functino result isn't used
* don't allocate function result register with -dnewra if there is none * don't allocate function result register with -dnewra if there is none
* some optimizations for non-x86 processor (don't save any registers * some optimizations for non-x86 processor (don't save any registers

View File

@ -516,7 +516,7 @@ implementation
if is_dynamic_array(left.resulttype.def) then if is_dynamic_array(left.resulttype.def) then
begin begin
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushed,all_intregisters); rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_param_loc(exprasmlist,right.location,paramanager.getintparaloc(exprasmlist,2)); cg.a_param_loc(exprasmlist,right.location,paramanager.getintparaloc(exprasmlist,2));
cg.a_param_loc(exprasmlist,left.location,paramanager.getintparaloc(exprasmlist,1)); cg.a_param_loc(exprasmlist,left.location,paramanager.getintparaloc(exprasmlist,1));
@ -529,7 +529,7 @@ implementation
rg.getexplicitregisterint(exprasmlist,hreg.number); rg.getexplicitregisterint(exprasmlist,hreg.number);
end; end;
{$else} {$else}
rg.saveintregvars(exprasmlist,all_intregisters); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_call_name(exprasmlist,'FPC_DYNARRAY_RANGECHECK'); cg.a_call_name(exprasmlist,'FPC_DYNARRAY_RANGECHECK');
paramanager.freeintparaloc(exprasmlist,2); paramanager.freeintparaloc(exprasmlist,2);
@ -577,7 +577,6 @@ implementation
else else
location_reset(location,LOC_REFERENCE,newsize); location_reset(location,LOC_REFERENCE,newsize);
{ an ansistring needs to be dereferenced } { an ansistring needs to be dereferenced }
if is_ansistring(left.resulttype.def) or if is_ansistring(left.resulttype.def) or
is_widestring(left.resulttype.def) then is_widestring(left.resulttype.def) then
@ -587,7 +586,7 @@ implementation
if left.location.loc<>LOC_REFERENCE then if left.location.loc<>LOC_REFERENCE then
internalerror(200304236); internalerror(200304236);
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushed,all_intregisters); rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_paramaddr_ref(exprasmlist,left.location.reference,paramanager.getintparaloc(exprasmlist,1)); cg.a_paramaddr_ref(exprasmlist,left.location.reference,paramanager.getintparaloc(exprasmlist,1));
{$ifdef newra} {$ifdef newra}
@ -599,7 +598,7 @@ implementation
rg.getexplicitregisterint(exprasmlist,hreg.number); rg.getexplicitregisterint(exprasmlist,hreg.number);
end; end;
{$else} {$else}
rg.saveintregvars(exprasmlist,all_intregisters); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE'); cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE');
paramanager.freeintparaloc(exprasmlist,1); paramanager.freeintparaloc(exprasmlist,1);
@ -635,7 +634,7 @@ implementation
if (cs_check_range in aktlocalswitches) then if (cs_check_range in aktlocalswitches) then
begin begin
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushed,all_intregisters); rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1)); cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,paramanager.getintparaloc(exprasmlist,1));
{$ifdef newra} {$ifdef newra}
@ -647,7 +646,7 @@ implementation
rg.getexplicitregisterint(exprasmlist,hreg.number); rg.getexplicitregisterint(exprasmlist,hreg.number);
end; end;
{$else} {$else}
rg.saveintregvars(exprasmlist,all_intregisters); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO'); cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
paramanager.freeintparaloc(exprasmlist,1); paramanager.freeintparaloc(exprasmlist,1);
@ -734,7 +733,7 @@ implementation
st_ansistring: st_ansistring:
begin begin
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushed,all_intregisters); rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,paramanager.getintparaloc(exprasmlist,2)); cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,paramanager.getintparaloc(exprasmlist,2));
href:=location.reference; href:=location.reference;
@ -749,7 +748,7 @@ implementation
rg.getexplicitregisterint(exprasmlist,hreg.number); rg.getexplicitregisterint(exprasmlist,hreg.number);
end; end;
{$else} {$else}
rg.saveintregvars(exprasmlist,all_intregisters); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
paramanager.freeintparaloc(exprasmlist,2); paramanager.freeintparaloc(exprasmlist,2);
@ -892,7 +891,7 @@ implementation
st_ansistring: st_ansistring:
begin begin
{$ifndef newra} {$ifndef newra}
rg.saveusedintregisters(exprasmlist,pushed,all_intregisters); rg.saveusedintregisters(exprasmlist,pushed,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_param_reg(exprasmlist,OS_INT,right.location.register,paramanager.getintparaloc(exprasmlist,2)); cg.a_param_reg(exprasmlist,OS_INT,right.location.register,paramanager.getintparaloc(exprasmlist,2));
href:=location.reference; href:=location.reference;
@ -907,7 +906,7 @@ implementation
rg.getexplicitregisterint(exprasmlist,hreg.number); rg.getexplicitregisterint(exprasmlist,hreg.number);
end; end;
{$else} {$else}
rg.saveintregvars(exprasmlist,all_intregisters); rg.saveintregvars(exprasmlist,VOLATILE_INTREGISTERS);
{$endif} {$endif}
cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
paramanager.freeintparaloc(exprasmlist,2); paramanager.freeintparaloc(exprasmlist,2);
@ -955,7 +954,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.62 2003-06-13 21:19:30 peter Revision 1.63 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.62 2003/06/13 21:19:30 peter
* current_procdef removed, use current_procinfo.procdef instead * current_procdef removed, use current_procinfo.procdef instead
Revision 1.61 2003/06/09 16:45:41 jonas Revision 1.61 2003/06/09 16:45:41 jonas

View File

@ -698,7 +698,15 @@ implementation
if (nf_callunique in flags) and if (nf_callunique in flags) and
(is_ansistring(left.resulttype.def) or (is_ansistring(left.resulttype.def) or
is_widestring(left.resulttype.def)) then is_widestring(left.resulttype.def)) then
include(current_procinfo.flags,pi_do_call); begin
left := ccallnode.createintern('fpc_'+tstringdef(left.resulttype.def).stringtypname+'_unique',
ccallparanode.create(
ctypeconvnode.create_explicit(left,voidpointertype),nil));
firstpass(left);
{ double resulttype passes somwhere else may cause this to be }
{ reset though :/ }
exclude(flags,nf_callunique);
end;
{ the register calculation is easy if a const index is used } { the register calculation is easy if a const index is used }
if right.nodetype=ordconstn then if right.nodetype=ordconstn then
@ -904,7 +912,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.57 2003-06-07 20:26:32 peter Revision 1.58 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.57 2003/06/07 20:26:32 peter
* re-resolving added instead of reloading from ppu * re-resolving added instead of reloading from ppu
* tderef object added to store deref info for resolving * tderef object added to store deref info for resolving

View File

@ -234,8 +234,11 @@ uses
RS_R27 = $1C; RS_R28 = $1D; RS_R29 = $1E; RS_R27 = $1C; RS_R28 = $1D; RS_R29 = $1E;
RS_R30 = $1F; RS_R31 = $20; RS_R30 = $1F; RS_R31 = $20;
first_supreg = $00; first_supreg = RS_R3;
last_supreg = $20; last_supreg = RS_R31;
{ registers which may be destroyed by calls }
VOLATILE_INTREGISTERS = [RS_R13..RS_R31];
{Number of first and last imaginary register.} {Number of first and last imaginary register.}
first_imreg = $21; first_imreg = $21;
last_imreg = $ff; last_imreg = $ff;
@ -877,7 +880,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.58 2003-06-14 22:32:43 jonas Revision 1.59 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.58 2003/06/14 22:32:43 jonas
* ppc compiles with -dnewra, haven't tried to compile anything with it * ppc compiles with -dnewra, haven't tried to compile anything with it
yet though yet though

View File

@ -363,16 +363,22 @@ unit cpupara;
classrefdef, classrefdef,
recorddef, recorddef,
objectdef, objectdef,
stringdef,
procvardef, procvardef,
filedef, filedef,
arraydef, arraydef,
errordef: stringdef:
begin begin
getfuncretparaloc.loc:=LOC_REGISTER; if (p.rettype.def.deftype <> stringdef) or
getfuncretparaloc.register.enum:=R_INTREGISTER; (is_ansistring(p.rettype.def) or
getfuncretparaloc.register.number:=NR_R3; is_widestring(p.rettype.def)) then
getfuncretparaloc.size:=OS_ADDR; begin
getfuncretparaloc.loc:=LOC_REGISTER;
getfuncretparaloc.register.enum:=R_INTREGISTER;
getfuncretparaloc.register.number:=NR_R3;
getfuncretparaloc.size:=OS_ADDR;
end
else
internalerror(2003061601);
end; end;
else else
internalerror(2002090903); internalerror(2002090903);
@ -385,7 +391,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.37 2003-06-09 14:54:26 jonas Revision 1.38 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.37 2003/06/09 14:54:26 jonas
* (de)allocation of registers for parameters is now performed properly * (de)allocation of registers for parameters is now performed properly
(and checked on the ppc) (and checked on the ppc)
- removed obsolete allocation of all parameter registers at the start - removed obsolete allocation of all parameter registers at the start

View File

@ -57,7 +57,7 @@ unit rgcpu;
implementation implementation
uses uses
cgobj, verbose; cgobj, verbose, cutils;
function trgcpu.getexplicitregisterint(list: taasmoutput; reg: Tnewregister): tregister; function trgcpu.getexplicitregisterint(list: taasmoutput; reg: Tnewregister): tregister;
@ -67,6 +67,7 @@ unit rgcpu;
begin begin
if (reg shr 8) in usedpararegs then if (reg shr 8) in usedpararegs then
internalerror(2003060701); internalerror(2003060701);
{ comment(v_warning,'Double allocation of register '+tostr((reg shr 8)-1));}
include(usedpararegs,reg shr 8); include(usedpararegs,reg shr 8);
result.enum:=R_INTREGISTER; result.enum:=R_INTREGISTER;
result.number:=reg; result.number:=reg;
@ -84,6 +85,7 @@ unit rgcpu;
begin begin
if not((reg.number shr 8) in usedpararegs) then if not((reg.number shr 8) in usedpararegs) then
internalerror(2003060702); internalerror(2003060702);
{ comment(v_warning,'Double free of register '+tostr((reg.number shr 8)-1));}
exclude(usedpararegs,reg.number shr 8); exclude(usedpararegs,reg.number shr 8);
cg.a_reg_dealloc(list,reg); cg.a_reg_dealloc(list,reg);
end end
@ -156,12 +158,17 @@ unit rgcpu;
end; end;
initialization initialization
rg := trgcpu.create(32); {PPC has 32 registers.} rg := trgcpu.create(last_supreg-first_supreg+1);
end. end.
{ {
$Log$ $Log$
Revision 1.11 2003-06-14 22:32:43 jonas Revision 1.12 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.11 2003/06/14 22:32:43 jonas
* ppc compiles with -dnewra, haven't tried to compile anything with it * ppc compiles with -dnewra, haven't tried to compile anything with it
yet though yet though

View File

@ -164,12 +164,14 @@ type
fname : string; fname : string;
fsize : integer; fsize : integer;
{$ifdef Test_Double_checksum} {$ifdef Test_Double_checksum}
public
crcindex, crcindex,
crc_index, crc_index,
crcindex2, crcindex2,
crc_index2 : cardinal; crc_index2 : cardinal;
crc_test, crc_test,
crc_test2 : pcrc_array; crc_test2 : pcrc_array;
private
{$endif def Test_Double_checksum} {$endif def Test_Double_checksum}
change_endian : boolean; change_endian : boolean;
buf : pchar; buf : pchar;
@ -983,7 +985,12 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.39 2003-06-07 20:26:32 peter Revision 1.40 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.39 2003/06/07 20:26:32 peter
* re-resolving added instead of reloading from ppu * re-resolving added instead of reloading from ppu
* tderef object added to store deref info for resolving * tderef object added to store deref info for resolving

View File

@ -844,7 +844,7 @@ implementation
end end
else else
begin begin
rg.used_in_proc_int:=ALL_INTREGISTERS; rg.used_in_proc_int:=VOLATILE_INTREGISTERS;
rg.used_in_proc_other:=ALL_OTHERREGISTERS; rg.used_in_proc_other:=ALL_OTHERREGISTERS;
end; end;
@ -1189,7 +1189,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.104 2003-06-13 21:19:31 peter Revision 1.105 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.104 2003/06/13 21:19:31 peter
* current_procdef removed, use current_procinfo.procdef instead * current_procdef removed, use current_procinfo.procdef instead
Revision 1.103 2003/06/09 18:27:14 peter Revision 1.103 2003/06/09 18:27:14 peter

View File

@ -659,7 +659,7 @@ implementation
{ now all the registers used are known } { now all the registers used are known }
{ Remove all imaginary registers from the used list.} { Remove all imaginary registers from the used list.}
{$ifdef newra} {$ifdef newra}
procdef.usedintregisters:=rg.used_in_proc_int*ALL_INTREGISTERS-rg.savedintbyproc; procdef.usedintregisters:=rg.used_in_proc_int*VOLATILE_INTREGISTERS-rg.savedintbyproc;
{$else} {$else}
procdef.usedintregisters:=rg.used_in_proc_int; procdef.usedintregisters:=rg.used_in_proc_int;
{$endif} {$endif}
@ -1251,7 +1251,12 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.128 2003-06-14 14:53:50 jonas Revision 1.129 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.128 2003/06/14 14:53:50 jonas
* fixed newra cycle for x86 * fixed newra cycle for x86
* added constants for indicating source and destination operands of the * added constants for indicating source and destination operands of the
"move reg,reg" instruction to aasmcpu (and use those in rgobj) "move reg,reg" instruction to aasmcpu (and use those in rgobj)

View File

@ -88,7 +88,6 @@ unit rgobj;
const const
ALL_INTREGISTERS=[first_supreg..last_supreg]-[RS_STACK_POINTER_REG];
ALL_OTHERREGISTERS=[firstreg..lastreg]; ALL_OTHERREGISTERS=[firstreg..lastreg];
type type
@ -523,7 +522,7 @@ unit rgobj;
resetusableregisters; resetusableregisters;
lastintreg:=0; lastintreg:=0;
maxintreg:=first_imreg; maxintreg:=first_imreg;
cpu_registers:=Acpu_registers; cpu_registers:={Acpu_registers}last_supreg-first_supreg+1;
{$ifdef TEMPREGDEBUG} {$ifdef TEMPREGDEBUG}
fillchar(reg_user,sizeof(reg_user),0); fillchar(reg_user,sizeof(reg_user),0);
fillchar(reg_releaser,sizeof(reg_releaser),0); fillchar(reg_releaser,sizeof(reg_releaser),0);
@ -889,7 +888,11 @@ unit rgobj;
unusedregsfpu:=usableregsfpu; unusedregsfpu:=usableregsfpu;
unusedregsmm:=usableregsmm; unusedregsmm:=usableregsmm;
{$ifdef newra} {$ifdef newra}
{$ifdef powerpc}
savedintbyproc:=[RS_R13..RS_R31];
{$else powerpc}
savedintbyproc:=[]; savedintbyproc:=[];
{$endif powerpc}
for i:=low(Tsuperregister) to high(Tsuperregister) do for i:=low(Tsuperregister) to high(Tsuperregister) do
begin begin
if igraph.adjlist[i]<>nil then if igraph.adjlist[i]<>nil then
@ -909,9 +912,9 @@ unit rgobj;
procedure trgobj.ungetreference(list : taasmoutput; const ref : treference); procedure trgobj.ungetreference(list : taasmoutput; const ref : treference);
begin begin
if ref.base.number<>NR_NO then if (ref.base.number<>NR_NO) and (ref.base.number<>NR_FRAME_POINTER_REG) then
ungetregisterint(list,ref.base); ungetregisterint(list,ref.base);
if ref.index.number<>NR_NO then if (ref.index.number<>NR_NO) and (ref.index.number<>NR_FRAME_POINTER_REG) then
ungetregisterint(list,ref.index); ungetregisterint(list,ref.index);
end; end;
@ -1941,7 +1944,7 @@ unit rgobj;
{Assume a spill by default...} {Assume a spill by default...}
spillednodes:=spillednodes+char(n); spillednodes:=spillednodes+char(n);
{Search for a colour not in this list.} {Search for a colour not in this list.}
for k:=1 to cpu_registers do for k:=first_supreg to last_supreg do
if not(k in adj_colours) then if not(k in adj_colours) then
begin begin
colour[n]:=k; colour[n]:=k;
@ -2453,7 +2456,12 @@ end.
{ {
$Log$ $Log$
Revision 1.55 2003-06-14 14:53:50 jonas Revision 1.56 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.55 2003/06/14 14:53:50 jonas
* fixed newra cycle for x86 * fixed newra cycle for x86
* added constants for indicating source and destination operands of the * added constants for indicating source and destination operands of the
"move reg,reg" instruction to aasmcpu (and use those in rgobj) "move reg,reg" instruction to aasmcpu (and use those in rgobj)

View File

@ -360,6 +360,11 @@ uses
first_supreg = $01; first_supreg = $01;
last_supreg = $20; last_supreg = $20;
{$warning FIXME!!}
{ registers which may be destroyed by calls }
VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
first_imreg = $21; first_imreg = $21;
last_imreg = $ff; last_imreg = $ff;
@ -1046,7 +1051,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.42 2003-06-13 21:08:30 peter Revision 1.43 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.42 2003/06/13 21:08:30 peter
* supreg_name added * supreg_name added
Revision 1.41 2003/06/12 19:11:34 jonas Revision 1.41 2003/06/12 19:11:34 jonas

View File

@ -3423,7 +3423,7 @@ implementation
end; end;
lastref:=defref; lastref:=defref;
{ first, we assume that all registers are used } { first, we assume that all registers are used }
usedintregisters:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG]; usedintregisters:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
usedotherregisters:=ALL_REGISTERS; usedotherregisters:=ALL_REGISTERS;
forwarddef:=true; forwarddef:=true;
interfacedef:=false; interfacedef:=false;
@ -3558,7 +3558,7 @@ implementation
{ set all registers to used for simplified compilation PM } { set all registers to used for simplified compilation PM }
if simplify_ppu then if simplify_ppu then
begin begin
usedintregisters:=ALL_INTREGISTERS-[RS_FRAME_POINTER_REG]; usedintregisters:=VOLATILE_INTREGISTERS-[RS_FRAME_POINTER_REG];
usedotherregisters:=ALL_REGISTERS; usedotherregisters:=ALL_REGISTERS;
end; end;
@ -5767,7 +5767,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.151 2003-06-08 11:41:21 peter Revision 1.152 2003-06-17 16:34:44 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.151 2003/06/08 11:41:21 peter
* set parast.next to the owner of the procdef * set parast.next to the owner of the procdef
Revision 1.150 2003/06/07 20:26:32 peter Revision 1.150 2003/06/07 20:26:32 peter

View File

@ -175,6 +175,10 @@ uses
{$else} {$else}
last_supreg = $08; last_supreg = $08;
{$endif} {$endif}
{ registers which may be destroyed by calls }
VOLATILE_INTREGISTERS = [first_supreg..last_supreg];
{Number of first and last imaginary register.} {Number of first and last imaginary register.}
first_imreg = $12; first_imreg = $12;
last_imreg = $ff; last_imreg = $ff;
@ -728,7 +732,12 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.9 2003-06-13 21:19:33 peter Revision 1.10 2003-06-17 16:34:45 jonas
* lots of newra fixes (need getfuncretparaloc implementation for i386)!
* renamed all_intregisters to volatile_intregisters and made it
processor dependent
Revision 1.9 2003/06/13 21:19:33 peter
* current_procdef removed, use current_procinfo.procdef instead * current_procdef removed, use current_procinfo.procdef instead
Revision 1.8 2003/06/12 19:11:34 jonas Revision 1.8 2003/06/12 19:11:34 jonas