mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 22:50:24 +02:00
* Work on register conversion
This commit is contained in:
parent
491ab8dc3b
commit
7be2b727f2
@ -234,10 +234,12 @@ uses
|
||||
RS_32 = 3; {Like EAX}
|
||||
RS_64 = 4; {Like RAX}
|
||||
|
||||
type Tregister = packed record
|
||||
type Tnewregister=word;
|
||||
|
||||
Tregister = packed record
|
||||
enum:Toldregister;
|
||||
number:word; {This is a word for now, change to cardinal when
|
||||
the old register coding is away.}
|
||||
number:Tnewregister; {This is a word for now, change to cardinal
|
||||
when the old register coding is away.}
|
||||
end;
|
||||
{$packenum normal}
|
||||
|
||||
@ -251,6 +253,7 @@ uses
|
||||
|
||||
{# Set type definition for registers }
|
||||
tregisterset = set of Toldregister;
|
||||
Tsupregset = set of byte;
|
||||
|
||||
|
||||
const
|
||||
@ -711,7 +714,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.39 2003-01-09 20:41:00 daniel
|
||||
Revision 1.40 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.39 2003/01/09 20:41:00 daniel
|
||||
* Converted some code in cgx86.pas to new register numbering
|
||||
|
||||
Revision 1.38 2003/01/09 15:49:56 daniel
|
||||
|
@ -224,11 +224,13 @@ interface
|
||||
begin
|
||||
if extra_not then
|
||||
emit_reg(A_NOT,opsize,left.location.register);
|
||||
r.enum:=R_EDI;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
cg.a_load_loc_reg(exprasmlist,right.location,r);
|
||||
emit_reg_reg(op,opsize,left.location.register,r);
|
||||
emit_reg_reg(A_MOV,opsize,r,left.location.register);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
end
|
||||
else
|
||||
@ -269,11 +271,13 @@ interface
|
||||
begin
|
||||
if extra_not then
|
||||
begin
|
||||
r.enum:=R_EDI;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
cg.a_load_loc_reg(exprasmlist,right.location,r);
|
||||
emit_reg(A_NOT,S_L,r);
|
||||
emit_reg_reg(A_AND,S_L,r,left.location.register);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
end
|
||||
else
|
||||
@ -1025,8 +1029,9 @@ interface
|
||||
{ right.location<>LOC_REGISTER }
|
||||
if (nodetype=subn) and (nf_swaped in flags) then
|
||||
begin
|
||||
r.enum:=R_EDI;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
cg64.a_load64low_loc_reg(exprasmlist,right.location,r);
|
||||
emit_reg_reg(op1,opsize,left.location.registerlow,r);
|
||||
emit_reg_reg(A_MOV,opsize,r,left.location.registerlow);
|
||||
@ -1034,6 +1039,7 @@ interface
|
||||
{ the carry flag is still ok }
|
||||
emit_reg_reg(op2,opsize,left.location.registerhigh,r);
|
||||
emit_reg_reg(A_MOV,opsize,r,left.location.registerhigh);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
if right.location.loc<>LOC_CREGISTER then
|
||||
begin
|
||||
@ -1468,28 +1474,29 @@ interface
|
||||
{ used in either the left or the right location, excepts if }
|
||||
{they are regvars. It DOES contain them if they are used in }
|
||||
{ another location (JM) }
|
||||
r.enum:=R_INTREGISTER;
|
||||
if not(R_EAX in rg.unusedregsint) and
|
||||
(R_EAX in regstopush) then
|
||||
begin
|
||||
r.enum:=R_EAX;
|
||||
r.number:=NR_EAX;
|
||||
emit_reg(A_PUSH,S_L,r);
|
||||
popeax:=true;
|
||||
end;
|
||||
if not(R_EDX in rg.unusedregsint) and
|
||||
(R_EDX in regstopush) then
|
||||
begin
|
||||
r.enum:=R_EDX;
|
||||
r.number:=NR_EDX;
|
||||
emit_reg(A_PUSH,S_L,r);
|
||||
popedx:=true;
|
||||
end;
|
||||
{ left.location can be R_EAX !!! }
|
||||
r.enum:=R_EDI;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
{ load the left value }
|
||||
r.number:=NR_EDI;
|
||||
cg.a_load_loc_reg(exprasmlist,left.location,r);
|
||||
location_release(exprasmlist,left.location);
|
||||
{ allocate EAX }
|
||||
r.enum:=R_EAX;
|
||||
r.number:=NR_EAX;
|
||||
if R_EAX in rg.unusedregsint then
|
||||
exprasmList.concat(tai_regalloc.Alloc(r));
|
||||
{ load he right value }
|
||||
@ -1500,25 +1507,27 @@ interface
|
||||
exprasmList.concat(tai_regalloc.Alloc(r));
|
||||
{ also allocate EDX, since it is also modified by }
|
||||
{ a mul (JM) }
|
||||
r.enum:=R_EDX;
|
||||
r.number:=NR_EDX;
|
||||
if R_EDX in rg.unusedregsint then
|
||||
exprasmList.concat(tai_regalloc.Alloc(r));
|
||||
r.enum:=R_EDI;
|
||||
r.number:=NR_EDI;
|
||||
emit_reg(A_MUL,S_L,r);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
r.enum:=R_EDX;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDX;
|
||||
if R_EDX in rg.unusedregsint then
|
||||
exprasmList.concat(tai_regalloc.DeAlloc(r));
|
||||
r.enum:=R_EAX;
|
||||
r.number:=NR_EAX;
|
||||
if R_EAX in rg.unusedregsint then
|
||||
exprasmList.concat(tai_regalloc.DeAlloc(r));
|
||||
location.register:=rg.getregisterint(exprasmlist);
|
||||
r.enum:=R_EAX;
|
||||
r.number:=NR_EAX;
|
||||
emit_reg_reg(A_MOV,S_L,r,location.register);
|
||||
r.enum:=R_EDX;
|
||||
r.number:=NR_EDX;
|
||||
if popedx then
|
||||
emit_reg(A_POP,S_L,r);
|
||||
r.enum:=R_EAX;
|
||||
r.number:=NR_EAX;
|
||||
if popeax then
|
||||
emit_reg(A_POP,S_L,r);
|
||||
location_freetemp(exprasmlist,left.location);
|
||||
@ -1580,7 +1589,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.53 2003-01-08 18:43:57 daniel
|
||||
Revision 1.54 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.53 2003/01/08 18:43:57 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.52 2002/11/25 17:43:26 peter
|
||||
|
@ -1124,8 +1124,9 @@ implementation
|
||||
(aktoptprocessor=ClassP5) and
|
||||
(procinfo._class=nil) then
|
||||
begin
|
||||
r.enum:=R_EDI;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
emit_reg(A_POP,S_L,r);
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
r.enum:=R_ESI;
|
||||
@ -1276,7 +1277,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.79 2003-01-08 18:43:57 daniel
|
||||
Revision 1.80 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.79 2003/01/08 18:43:57 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.78 2002/12/15 21:30:12 florian
|
||||
|
@ -199,8 +199,10 @@ implementation
|
||||
begin
|
||||
emit_ref(A_FILD,S_IL,href);
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
r.enum:=R_EDI;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
emit_reg(A_POP,S_L,r);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
end;
|
||||
end;
|
||||
@ -428,7 +430,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.54 2003-01-08 18:43:57 daniel
|
||||
Revision 1.55 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.54 2003/01/08 18:43:57 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.53 2002/12/05 14:27:42 florian
|
||||
|
@ -814,7 +814,8 @@ implementation
|
||||
secondpass(left);
|
||||
location_reset(location,LOC_MMXREGISTER,OS_NO);
|
||||
{ prepare EDI }
|
||||
r.enum:=R_EDI;
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_EDI;
|
||||
r2.enum:=R_MM7;
|
||||
rg.getexplicitregisterint(exprasmlist,R_EDI);
|
||||
emit_const_reg(A_MOV,S_L,longint($ffffffff),r);
|
||||
@ -837,6 +838,7 @@ implementation
|
||||
end;
|
||||
{ load mask }
|
||||
emit_reg_reg(A_MOVD,S_NO,r,r2);
|
||||
r.enum:=R_EDI;
|
||||
rg.ungetregisterint(exprasmlist,r);
|
||||
{ lower 32 bit }
|
||||
emit_reg_reg(A_PXOR,S_D,r2,location.register);
|
||||
@ -875,7 +877,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 2003-01-13 14:54:34 daniel
|
||||
Revision 1.44 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.43 2003/01/13 14:54:34 daniel
|
||||
* Further work to convert codegenerator register convention;
|
||||
internalerror bug fixed.
|
||||
|
||||
|
@ -82,7 +82,10 @@ implementation
|
||||
begin
|
||||
inherited pass_2;
|
||||
if tpointerdef(left.resulttype.def).is_far then
|
||||
location.reference.segment.enum:=R_FS;
|
||||
begin
|
||||
location.reference.segment.enum:=R_INTREGISTER;
|
||||
location.reference.segment.number:=NR_FS;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -135,7 +138,10 @@ implementation
|
||||
inherited pass_2;
|
||||
|
||||
if nf_memseg in flags then
|
||||
location.reference.segment.enum:=R_FS;
|
||||
begin
|
||||
location.reference.segment.enum:=R_INTREGISTER;
|
||||
location.reference.segment.number:=NR_FS;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -146,7 +152,10 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.48 2003-01-08 18:43:57 daniel
|
||||
Revision 1.49 2003-01-13 18:37:44 daniel
|
||||
* Work on register conversion
|
||||
|
||||
Revision 1.48 2003/01/08 18:43:57 daniel
|
||||
* Tregister changed into a record
|
||||
|
||||
Revision 1.47 2002/12/03 22:14:12 carl
|
||||
|
Loading…
Reference in New Issue
Block a user