mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 15:39:26 +01:00
+ tempalloc
+ -at to show temp alloc info in .s file
This commit is contained in:
parent
2df973753e
commit
61eee61f9a
@ -64,8 +64,8 @@ unit aasm;
|
||||
ait_force_line,
|
||||
ait_stab_function_name,
|
||||
ait_cut, { used to split into tiny assembler files }
|
||||
ait_regalloc,
|
||||
ait_regdealloc,
|
||||
ait_regalloc, { for register,temp allocation debugging }
|
||||
ait_tempalloc,
|
||||
ait_marker,
|
||||
{ never used, makes insertation of new ait_ easier to type }
|
||||
ait_dummy);
|
||||
@ -1013,7 +1013,11 @@ uses
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.38 1999-04-14 09:14:44 peter
|
||||
Revision 1.39 1999-04-16 11:49:36 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.38 1999/04/14 09:14:44 peter
|
||||
* first things to store the symbol/def number in the ppu
|
||||
|
||||
Revision 1.37 1999/03/10 13:25:42 pierre
|
||||
|
||||
@ -391,8 +391,8 @@ unit ag386int;
|
||||
AsmWritePChar(pai_asm_comment(hp)^.str);
|
||||
AsmLn;
|
||||
End;
|
||||
ait_regalloc,
|
||||
ait_regdealloc :;
|
||||
ait_regalloc,
|
||||
ait_tempalloc : ;
|
||||
ait_section : begin
|
||||
if LastSec<>sec_none then
|
||||
AsmWriteLn('_'+ait_section2masmstr[LastSec]+#9#9'ENDS');
|
||||
@ -795,7 +795,11 @@ ait_stab_function_name : ;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.31 1999-04-16 10:00:55 pierre
|
||||
Revision 1.32 1999-04-16 11:49:39 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.31 1999/04/16 10:00:55 pierre
|
||||
+ ifdef USE_OP3 code :
|
||||
added all missing op_... constructors for tai386 needed
|
||||
for SHRD,SHLD and IMUL code in assembler readers
|
||||
|
||||
@ -402,8 +402,8 @@ unit ag386nsm;
|
||||
AsmWritePChar(pai_asm_comment(hp)^.str);
|
||||
AsmLn;
|
||||
End;
|
||||
ait_regalloc,
|
||||
ait_regdealloc :;
|
||||
ait_regalloc,
|
||||
ait_tempalloc : ;
|
||||
ait_section : begin
|
||||
if pai_section(hp)^.sec<>sec_none then
|
||||
begin
|
||||
@ -740,7 +740,11 @@ ait_stab_function_name : ;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.26 1999-04-16 10:00:56 pierre
|
||||
Revision 1.27 1999-04-16 11:49:40 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.26 1999/04/16 10:00:56 pierre
|
||||
+ ifdef USE_OP3 code :
|
||||
added all missing op_... constructors for tai386 needed
|
||||
for SHRD,SHLD and IMUL code in assembler readers
|
||||
|
||||
@ -87,7 +87,7 @@ Const
|
||||
{$ifdef GDB}
|
||||
,ait_stabs, ait_stabn, ait_stab_function_name
|
||||
{$endif GDB}
|
||||
,ait_regalloc, ait_regdealloc
|
||||
,ait_regalloc,ait_tempalloc
|
||||
];
|
||||
|
||||
{the maximum number of things (registers, memory, ...) a single instruction
|
||||
@ -756,26 +756,29 @@ Begin
|
||||
End;
|
||||
|
||||
Function FindRegAlloc(Reg: TRegister; StartPai: Pai): Boolean;
|
||||
{Returns true if a ait_regalloc object for Reg is found in the block of Pai's
|
||||
{Returns true if a ait_alloc object for Reg is found in the block of Pai's
|
||||
starting with StartPai and ending with the next "real" instruction}
|
||||
Var TmpResult: Boolean;
|
||||
Begin
|
||||
TmpResult := False;
|
||||
FindRegAlloc:=False;
|
||||
Repeat
|
||||
While Assigned(StartPai) And
|
||||
((StartPai^.typ in (SkipInstr - [ait_RegAlloc])) Or
|
||||
((StartPai^.typ in (SkipInstr - [ait_regAlloc])) Or
|
||||
((StartPai^.typ = ait_label) and
|
||||
Not(Pai_Label(StartPai)^.l^.Is_Used))) Do
|
||||
StartPai := Pai(StartPai^.Next);
|
||||
If Assigned(StartPai) And
|
||||
(StartPai^.typ = ait_RegAlloc) Then
|
||||
(StartPai^.typ = ait_regAlloc) and (PairegAlloc(StartPai)^.allocation) Then
|
||||
Begin
|
||||
TmpResult := (PaiRegAlloc(StartPai)^.Reg = Reg);
|
||||
if PairegAlloc(StartPai)^.Reg = Reg then
|
||||
begin
|
||||
FindRegAlloc:=true;
|
||||
exit;
|
||||
end;
|
||||
StartPai := Pai(StartPai^.Next);
|
||||
End;
|
||||
Until Not(Assigned(StartPai)) Or
|
||||
Not(StartPai^.typ in SkipInstr) or TmpResult;
|
||||
FindRegAlloc := TmpResult;
|
||||
End
|
||||
else
|
||||
exit;
|
||||
Until false;
|
||||
End;
|
||||
|
||||
Procedure BuildLabelTableAndFixRegAlloc(AsmL: PAasmOutput; Var LabelTable: PLabelTable; LowLabel: Longint;
|
||||
@ -802,45 +805,48 @@ Begin
|
||||
ait_Label:
|
||||
If Pai_Label(p)^.l^.is_used Then
|
||||
LabelTable^[Pai_Label(p)^.l^.nb-LowLabel].PaiObj := p;
|
||||
ait_RegAlloc:
|
||||
Begin
|
||||
If Not(PaiRegAlloc(p)^.Reg in UsedRegs) Then
|
||||
UsedRegs := UsedRegs + [PaiRegAlloc(p)^.Reg]
|
||||
Else
|
||||
ait_regAlloc:
|
||||
begin
|
||||
if PairegAlloc(p)^.Allocation then
|
||||
Begin
|
||||
If Not(PaiRegAlloc(p)^.Reg in UsedRegs) Then
|
||||
UsedRegs := UsedRegs + [PaiRegAlloc(p)^.Reg]
|
||||
Else
|
||||
Begin
|
||||
hp1 := p;
|
||||
hp2 := nil;
|
||||
While GetLastInstruction(hp1, hp1) And
|
||||
Not(RegInInstruction(PaiRegAlloc(p)^.Reg, hp1)) Do
|
||||
hp2 := hp1;
|
||||
If hp2 <> nil Then
|
||||
Begin
|
||||
hp1 := New(PaiRegAlloc, DeAlloc(PaiRegAlloc(p)^.Reg));
|
||||
InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp1);
|
||||
End;
|
||||
End;
|
||||
End
|
||||
else
|
||||
Begin
|
||||
UsedRegs := UsedRegs - [PaiRegAlloc(p)^.Reg];
|
||||
hp1 := p;
|
||||
hp2 := nil;
|
||||
While GetLastInstruction(hp1, hp1) And
|
||||
Not(RegInInstruction(PaiRegAlloc(p)^.Reg, hp1)) Do
|
||||
While Not(FindRegAlloc(PaiRegAlloc(p)^.Reg, Pai(hp1^.Next))) And
|
||||
GetNextInstruction(hp1, hp1) And
|
||||
RegInInstruction(PaiRegAlloc(p)^.Reg, hp1) Do
|
||||
hp2 := hp1;
|
||||
If hp2 <> nil Then
|
||||
Begin
|
||||
hp1 := New(PaiRegDeAlloc, Init(PaiRegAlloc(p)^.Reg));
|
||||
InsertLLItem(AsmL, Pai(hp2^.previous), hp2, hp1);
|
||||
End;
|
||||
If hp2 <> nil Then
|
||||
Begin
|
||||
hp1 := Pai(p^.previous);
|
||||
AsmL^.Remove(p);
|
||||
InsertLLItem(AsmL, hp2, Pai(hp2^.Next), p);
|
||||
p := hp1;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
ait_RegDeAlloc:
|
||||
Begin
|
||||
UsedRegs := UsedRegs - [PaiRegDeAlloc(p)^.Reg];
|
||||
hp1 := p;
|
||||
hp2 := nil;
|
||||
While Not(FindRegAlloc(PaiRegDeAlloc(p)^.Reg, Pai(hp1^.Next))) And
|
||||
GetNextInstruction(hp1, hp1) And
|
||||
RegInInstruction(PaiRegDeAlloc(p)^.Reg, hp1) Do
|
||||
hp2 := hp1;
|
||||
If hp2 <> nil Then
|
||||
Begin
|
||||
hp1 := Pai(p^.previous);
|
||||
AsmL^.Remove(p);
|
||||
InsertLLItem(AsmL, hp2, Pai(hp2^.Next), p);
|
||||
p := hp1;
|
||||
End;
|
||||
End;
|
||||
end;
|
||||
End;
|
||||
P := Pai(p^.Next);
|
||||
While Assigned(p) And
|
||||
(p^.typ in (SkipInstr - [ait_regdealloc,ait_regalloc])) Do
|
||||
(p^.typ in (SkipInstr - [ait_regalloc])) Do
|
||||
P := Pai(P^.Next);
|
||||
End;
|
||||
{$IfDef TP}
|
||||
@ -1240,17 +1246,17 @@ Procedure UpdateUsedRegs(Var UsedRegs: TRegSet; p: Pai);
|
||||
Begin
|
||||
Repeat
|
||||
While Assigned(p) And
|
||||
((p^.typ in (SkipInstr - [ait_RegAlloc, ait_RegDealloc])) or
|
||||
((p^.typ in (SkipInstr - [ait_RegAlloc])) or
|
||||
((p^.typ = ait_label) And
|
||||
Not(Pai_Label(p)^.l^.is_used))) Do
|
||||
p := Pai(p^.next);
|
||||
While Assigned(p) And
|
||||
(p^.typ in [ait_RegAlloc, ait_RegDealloc]) Do
|
||||
(p^.typ=ait_RegAlloc) Do
|
||||
Begin
|
||||
Case p^.typ Of
|
||||
ait_RegAlloc: UsedRegs := UsedRegs + [PaiRegAlloc(p)^.Reg];
|
||||
ait_regdealloc: UsedRegs := UsedRegs - [PaiRegDeAlloc(p)^.Reg];
|
||||
End;
|
||||
if pairegalloc(p)^.allocation then
|
||||
UsedRegs := UsedRegs + [PaiRegAlloc(p)^.Reg]
|
||||
else
|
||||
UsedRegs := UsedRegs - [PaiRegAlloc(p)^.Reg];
|
||||
p := pai(p^.next);
|
||||
End;
|
||||
Until Not(Assigned(p)) Or
|
||||
@ -2227,7 +2233,11 @@ End.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.39 1999-02-26 00:48:18 peter
|
||||
Revision 1.40 1999-04-16 11:49:41 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.39 1999/02/26 00:48:18 peter
|
||||
* assembler writers fixed for ag386bin
|
||||
|
||||
Revision 1.38 1999/02/25 21:02:34 peter
|
||||
|
||||
@ -66,7 +66,8 @@ interface
|
||||
{ debugger }
|
||||
cs_gdb_dbx,cs_gdb_gsym,cs_gdb_heaptrc,
|
||||
{ assembling }
|
||||
cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,cs_asm_regalloc,
|
||||
cs_asm_leave,cs_asm_extern,cs_asm_pipe,cs_asm_source,
|
||||
cs_asm_regalloc,cs_asm_tempalloc,
|
||||
{ linking }
|
||||
cs_link_extern,cs_link_shared,cs_link_static,cs_link_deffile
|
||||
);
|
||||
@ -108,7 +109,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 1999-04-10 16:15:01 peter
|
||||
Revision 1.6 1999-04-16 11:49:42 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.5 1999/04/10 16:15:01 peter
|
||||
* fixed browcol
|
||||
+ -ar to show regalloc info in .s file
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
$Id$
|
||||
Copyright (c) 1995-98 by Florian Klaempfl
|
||||
|
||||
@ -381,21 +381,23 @@ unit i386;
|
||||
end;
|
||||
|
||||
pairegalloc = ^tairegalloc;
|
||||
|
||||
tairegalloc = object(tai)
|
||||
reg : tregister;
|
||||
constructor init(r : tregister);
|
||||
allocation : boolean;
|
||||
reg : tregister;
|
||||
constructor alloc(r : tregister);
|
||||
constructor dealloc(r : tregister);
|
||||
end;
|
||||
|
||||
pairegdealloc = ^tairegdealloc;
|
||||
|
||||
tairegdealloc = object(tai)
|
||||
reg : tregister;
|
||||
constructor init(r : tregister);
|
||||
paitempalloc = ^taitempalloc;
|
||||
taitempalloc = object(tai)
|
||||
allocation : boolean;
|
||||
temppos,
|
||||
tempsize : longint;
|
||||
constructor alloc(pos,size:longint);
|
||||
constructor dealloc(pos,size:longint);
|
||||
end;
|
||||
|
||||
pai386 = ^tai386;
|
||||
|
||||
tai386 = object(tai)
|
||||
opcode : tasmop;
|
||||
opsize:topsize;
|
||||
@ -1399,22 +1401,45 @@ unit i386;
|
||||
objects for register de/allocation
|
||||
****************************************************************************}
|
||||
|
||||
constructor tairegalloc.init(r : tregister);
|
||||
|
||||
constructor tairegalloc.alloc(r : tregister);
|
||||
begin
|
||||
inherited init;
|
||||
typ:=ait_regalloc;
|
||||
reg:=r;
|
||||
inherited init;
|
||||
typ:=ait_regalloc;
|
||||
allocation:=true;
|
||||
reg:=r;
|
||||
end;
|
||||
|
||||
constructor tairegdealloc.init(r : tregister);
|
||||
|
||||
constructor tairegalloc.dealloc(r : tregister);
|
||||
begin
|
||||
inherited init;
|
||||
typ:=ait_regdealloc;
|
||||
reg:=r;
|
||||
inherited init;
|
||||
typ:=ait_regalloc;
|
||||
allocation:=false;
|
||||
reg:=r;
|
||||
end;
|
||||
|
||||
|
||||
constructor taitempalloc.alloc(pos,size:longint);
|
||||
begin
|
||||
inherited init;
|
||||
typ:=ait_tempalloc;
|
||||
allocation:=true;
|
||||
temppos:=pos;
|
||||
tempsize:=size;
|
||||
end;
|
||||
|
||||
|
||||
constructor taitempalloc.dealloc(pos,size:longint);
|
||||
begin
|
||||
inherited init;
|
||||
typ:=ait_tempalloc;
|
||||
allocation:=false;
|
||||
temppos:=pos;
|
||||
tempsize:=size;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
TAI386
|
||||
****************************************************************************}
|
||||
@ -2041,7 +2066,11 @@ Begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.40 1999-04-16 10:00:57 pierre
|
||||
Revision 1.41 1999-04-16 11:49:43 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.40 1999/04/16 10:00:57 pierre
|
||||
+ ifdef USE_OP3 code :
|
||||
added all missing op_... constructors for tai386 needed
|
||||
for SHRD,SHLD and IMUL code in assembler readers
|
||||
|
||||
@ -27,7 +27,7 @@ unit temp_gen;
|
||||
uses
|
||||
{$ifdef i386}
|
||||
{$ifdef ag386bin}
|
||||
i386base,
|
||||
i386base,i386asm,
|
||||
{$else}
|
||||
i386,
|
||||
{$endif}
|
||||
@ -236,6 +236,7 @@ unit temp_gen;
|
||||
{$ifdef EXTDEBUG}
|
||||
tl^.posinfo:=aktfilepos;
|
||||
{$endif}
|
||||
exprasmlist^.concat(new(paitempalloc,alloc(ofs,size)));
|
||||
gettempofsize:=ofs;
|
||||
end;
|
||||
|
||||
@ -424,7 +425,7 @@ unit temp_gen;
|
||||
size:=size+(4-(size mod 4));
|
||||
if size = 0 then
|
||||
exit;
|
||||
|
||||
exprasmlist^.concat(new(paitempalloc,dealloc(pos,size)));
|
||||
if pos<=lastoccupied then
|
||||
if pos=lastoccupied then
|
||||
begin
|
||||
@ -635,7 +636,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 1999-04-14 09:10:46 peter
|
||||
Revision 1.17 1999-04-16 11:49:45 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.16 1999/04/14 09:10:46 peter
|
||||
* fixed tempansi which set wrong pos in free temp
|
||||
|
||||
Revision 1.15 1999/04/09 13:05:45 pierre
|
||||
|
||||
@ -214,7 +214,7 @@ implementation
|
||||
unused:=unused+[r];
|
||||
inc(usablereg32);
|
||||
end;
|
||||
exprasmlist^.concat(new(pairegdealloc,init(r)));
|
||||
exprasmlist^.concat(new(pairegalloc,dealloc(r)));
|
||||
end;
|
||||
|
||||
{$ifdef SUPPORT_MMX}
|
||||
@ -287,28 +287,28 @@ implementation
|
||||
unused:=unused-[R_EAX];
|
||||
usedinproc:=usedinproc or ($80 shr byte(R_EAX));
|
||||
getregister32:=R_EAX;
|
||||
exprasmlist^.concat(new(pairegalloc,init(R_EAX)));
|
||||
exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
|
||||
end
|
||||
else if R_EDX in unused then
|
||||
begin
|
||||
unused:=unused-[R_EDX];
|
||||
usedinproc:=usedinproc or ($80 shr byte(R_EDX));
|
||||
getregister32:=R_EDX;
|
||||
exprasmlist^.concat(new(pairegalloc,init(R_EDX)));
|
||||
exprasmlist^.concat(new(pairegalloc,alloc(R_EDX)));
|
||||
end
|
||||
else if R_EBX in unused then
|
||||
begin
|
||||
unused:=unused-[R_EBX];
|
||||
usedinproc:=usedinproc or ($80 shr byte(R_EBX));
|
||||
getregister32:=R_EBX;
|
||||
exprasmlist^.concat(new(pairegalloc,init(R_EBX)));
|
||||
exprasmlist^.concat(new(pairegalloc,alloc(R_EBX)));
|
||||
end
|
||||
else if R_ECX in unused then
|
||||
begin
|
||||
unused:=unused-[R_ECX];
|
||||
usedinproc:=usedinproc or ($80 shr byte(R_ECX));
|
||||
getregister32:=R_ECX;
|
||||
exprasmlist^.concat(new(pairegalloc,init(R_ECX)));
|
||||
exprasmlist^.concat(new(pairegalloc,alloc(R_ECX)));
|
||||
end
|
||||
else internalerror(10);
|
||||
end;
|
||||
@ -322,7 +322,7 @@ implementation
|
||||
unused:=unused-[r];
|
||||
usedinproc:=usedinproc or ($80 shr byte(r));
|
||||
getexplicitregister32:=R_ECX;
|
||||
exprasmlist^.concat(new(pairegalloc,init(r)));
|
||||
exprasmlist^.concat(new(pairegalloc,alloc(r)));
|
||||
getexplicitregister32:=r;
|
||||
end
|
||||
else
|
||||
@ -373,7 +373,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.20 1999-02-25 21:02:55 peter
|
||||
Revision 1.21 1999-04-16 11:49:47 peter
|
||||
+ tempalloc
|
||||
+ -at to show temp alloc info in .s file
|
||||
|
||||
Revision 1.20 1999/02/25 21:02:55 peter
|
||||
* ag386bin updates
|
||||
+ coff writer
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user