mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 17:29:33 +02:00
* External assemblers: moved some common code into the base class, 4 copies reduced to one.
git-svn-id: trunk@17561 -
This commit is contained in:
parent
fd491e8647
commit
5bda700410
@ -121,25 +121,6 @@ implementation
|
|||||||
{ Support routines }
|
{ Support routines }
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
|
|
||||||
function fixline(s:string):string;
|
|
||||||
{
|
|
||||||
return s with all leading and ending spaces and tabs removed
|
|
||||||
}
|
|
||||||
var
|
|
||||||
i,j,k : integer;
|
|
||||||
begin
|
|
||||||
i:=length(s);
|
|
||||||
while (i>0) and (s[i] in [#9,' ']) do
|
|
||||||
dec(i);
|
|
||||||
j:=1;
|
|
||||||
while (j<i) and (s[j] in [#9,' ']) do
|
|
||||||
inc(j);
|
|
||||||
for k:=j to i do
|
|
||||||
if s[k] in [#0..#31,#127..#255] then
|
|
||||||
s[k]:='.';
|
|
||||||
fixline:=Copy(s,j,i-j+1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function single2str(d : single) : string;
|
function single2str(d : single) : string;
|
||||||
var
|
var
|
||||||
hs : string;
|
hs : string;
|
||||||
@ -587,7 +568,6 @@ implementation
|
|||||||
var
|
var
|
||||||
ch : char;
|
ch : char;
|
||||||
hp : tai;
|
hp : tai;
|
||||||
hp1 : tailineinfo;
|
|
||||||
constdef : taiconst_type;
|
constdef : taiconst_type;
|
||||||
s,t : string;
|
s,t : string;
|
||||||
i,pos,l : longint;
|
i,pos,l : longint;
|
||||||
@ -618,52 +598,10 @@ implementation
|
|||||||
prefetch(pointer(hp.next)^);
|
prefetch(pointer(hp.next)^);
|
||||||
if not(hp.typ in SkipLineInfo) then
|
if not(hp.typ in SkipLineInfo) then
|
||||||
begin
|
begin
|
||||||
hp1 := hp as tailineinfo;
|
current_filepos:=tailineinfo(hp).fileinfo;
|
||||||
current_filepos:=hp1.fileinfo;
|
{ no line info for inlined code }
|
||||||
{ no line info for inlined code }
|
if do_line and (inlinelevel=0) then
|
||||||
if do_line and (inlinelevel=0) then
|
WriteSourceLine(hp as tailineinfo);
|
||||||
begin
|
|
||||||
{ load infile }
|
|
||||||
if lastfileinfo.fileindex<>hp1.fileinfo.fileindex then
|
|
||||||
begin
|
|
||||||
infile:=current_module.sourcefiles.get_file(hp1.fileinfo.fileindex);
|
|
||||||
if assigned(infile) then
|
|
||||||
begin
|
|
||||||
{ open only if needed !! }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) then
|
|
||||||
infile.open;
|
|
||||||
end;
|
|
||||||
{ avoid unnecessary reopens of the same file !! }
|
|
||||||
lastfileinfo.fileindex:=hp1.fileinfo.fileindex;
|
|
||||||
{ be sure to change line !! }
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
{ write source }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) and
|
|
||||||
assigned(infile) then
|
|
||||||
begin
|
|
||||||
if (infile<>lastinfile) then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(target_asm.comment+'['+infile.name^+']');
|
|
||||||
if assigned(lastinfile) then
|
|
||||||
lastinfile.close;
|
|
||||||
end;
|
|
||||||
if (hp1.fileinfo.line<>lastfileinfo.line) and
|
|
||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
|
||||||
begin
|
|
||||||
if (hp1.fileinfo.line<>0) and
|
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
|
||||||
AsmWriteLn(target_asm.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
|
||||||
{ set it to a negative value !
|
|
||||||
to make that is has been read already !! PM }
|
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
lastfileinfo:=hp1.fileinfo;
|
|
||||||
lastinfile:=infile;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case hp.typ of
|
case hp.typ of
|
||||||
@ -697,16 +635,7 @@ implementation
|
|||||||
ait_tempalloc :
|
ait_tempalloc :
|
||||||
begin
|
begin
|
||||||
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
||||||
begin
|
WriteTempalloc(tai_tempalloc(hp));
|
||||||
{$ifdef EXTDEBUG}
|
|
||||||
if assigned(tai_tempalloc(hp).problem) then
|
|
||||||
AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+' '+tai_tempalloc(hp).problem^)
|
|
||||||
else
|
|
||||||
{$endif EXTDEBUG}
|
|
||||||
AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+' '+tempallocstr[tai_tempalloc(hp).allocation]);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_align :
|
ait_align :
|
||||||
|
@ -81,6 +81,8 @@ interface
|
|||||||
lastinfile : tinputfile;
|
lastinfile : tinputfile;
|
||||||
{last section type written}
|
{last section type written}
|
||||||
lastsectype : TAsmSectionType;
|
lastsectype : TAsmSectionType;
|
||||||
|
procedure WriteSourceLine(hp: tailineinfo);
|
||||||
|
procedure WriteTempalloc(hp: tai_tempalloc);
|
||||||
public
|
public
|
||||||
{# Returns the complete path and executable name of the assembler
|
{# Returns the complete path and executable name of the assembler
|
||||||
program.
|
program.
|
||||||
@ -189,6 +191,24 @@ Implementation
|
|||||||
var
|
var
|
||||||
CAssembler : array[tasm] of TAssemblerClass;
|
CAssembler : array[tasm] of TAssemblerClass;
|
||||||
|
|
||||||
|
function fixline(s:string):string;
|
||||||
|
{
|
||||||
|
return s with all leading and ending spaces and tabs removed
|
||||||
|
}
|
||||||
|
var
|
||||||
|
i,j,k : integer;
|
||||||
|
begin
|
||||||
|
i:=length(s);
|
||||||
|
while (i>0) and (s[i] in [#9,' ']) do
|
||||||
|
dec(i);
|
||||||
|
j:=1;
|
||||||
|
while (j<i) and (s[j] in [#9,' ']) do
|
||||||
|
inc(j);
|
||||||
|
for k:=j to i do
|
||||||
|
if s[k] in [#0..#31,#127..#255] then
|
||||||
|
s[k]:='.';
|
||||||
|
fixline:=Copy(s,j,i-j+1);
|
||||||
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TAssembler
|
TAssembler
|
||||||
@ -603,6 +623,61 @@ Implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TExternalAssembler.WriteSourceLine(hp: tailineinfo);
|
||||||
|
begin
|
||||||
|
{ load infile }
|
||||||
|
if lastfileinfo.fileindex<>hp.fileinfo.fileindex then
|
||||||
|
begin
|
||||||
|
infile:=current_module.sourcefiles.get_file(hp.fileinfo.fileindex);
|
||||||
|
if assigned(infile) then
|
||||||
|
begin
|
||||||
|
{ open only if needed !! }
|
||||||
|
if (cs_asm_source in current_settings.globalswitches) then
|
||||||
|
infile.open;
|
||||||
|
end;
|
||||||
|
{ avoid unnecessary reopens of the same file !! }
|
||||||
|
lastfileinfo.fileindex:=hp.fileinfo.fileindex;
|
||||||
|
{ be sure to change line !! }
|
||||||
|
lastfileinfo.line:=-1;
|
||||||
|
end;
|
||||||
|
{ write source }
|
||||||
|
if (cs_asm_source in current_settings.globalswitches) and
|
||||||
|
assigned(infile) then
|
||||||
|
begin
|
||||||
|
if (infile<>lastinfile) then
|
||||||
|
begin
|
||||||
|
AsmWriteLn(target_asm.comment+'['+infile.name^+']');
|
||||||
|
if assigned(lastinfile) then
|
||||||
|
lastinfile.close;
|
||||||
|
end;
|
||||||
|
if (hp.fileinfo.line<>lastfileinfo.line) and
|
||||||
|
(hp.fileinfo.line<infile.maxlinebuf) then
|
||||||
|
begin
|
||||||
|
if (hp.fileinfo.line<>0) and
|
||||||
|
(infile.linebuf^[hp.fileinfo.line]>=0) then
|
||||||
|
AsmWriteLn(target_asm.comment+'['+tostr(hp.fileinfo.line)+'] '+
|
||||||
|
fixline(infile.GetLineStr(hp.fileinfo.line)));
|
||||||
|
{ set it to a negative value !
|
||||||
|
to make that is has been read already !! PM }
|
||||||
|
if (infile.linebuf^[hp.fileinfo.line]>=0) then
|
||||||
|
infile.linebuf^[hp.fileinfo.line]:=-infile.linebuf^[hp.fileinfo.line]-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
lastfileinfo:=hp.fileinfo;
|
||||||
|
lastinfile:=infile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TExternalAssembler.WriteTempalloc(hp: tai_tempalloc);
|
||||||
|
begin
|
||||||
|
{$ifdef EXTDEBUG}
|
||||||
|
if assigned(hp.problem) then
|
||||||
|
AsmWriteLn(target_asm.comment+'Temp '+tostr(hp.temppos)+','+
|
||||||
|
tostr(hp.tempsize)+' '+hp.problem^)
|
||||||
|
else
|
||||||
|
{$endif EXTDEBUG}
|
||||||
|
AsmWriteLn(target_asm.comment+'Temp '+tostr(hp.temppos)+','+
|
||||||
|
tostr(hp.tempsize)+' '+tempallocstr[hp.allocation]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TExternalAssembler.WriteTree(p:TAsmList);
|
procedure TExternalAssembler.WriteTree(p:TAsmList);
|
||||||
begin
|
begin
|
||||||
|
@ -78,26 +78,6 @@ interface
|
|||||||
result:=generic_regname(r);
|
result:=generic_regname(r);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function fixline(s:string):string;
|
|
||||||
{
|
|
||||||
return s with all leading and ending spaces and tabs removed
|
|
||||||
}
|
|
||||||
var
|
|
||||||
i,j,k : longint;
|
|
||||||
begin
|
|
||||||
i:=length(s);
|
|
||||||
while (i>0) and (s[i] in [#9,' ']) do
|
|
||||||
dec(i);
|
|
||||||
j:=1;
|
|
||||||
while (j<i) and (s[j] in [#9,' ']) do
|
|
||||||
inc(j);
|
|
||||||
for k:=j to i do
|
|
||||||
if s[k] in [#0..#31,#127..#255] then
|
|
||||||
s[k]:='.';
|
|
||||||
fixline:=Copy(s,j,i-j+1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function single2str(d : single) : string;
|
function single2str(d : single) : string;
|
||||||
var
|
var
|
||||||
hs : string;
|
hs : string;
|
||||||
@ -521,7 +501,6 @@ interface
|
|||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
hp : tai;
|
hp : tai;
|
||||||
hp1 : tailineinfo;
|
|
||||||
counter,
|
counter,
|
||||||
lines,
|
lines,
|
||||||
i,j,l : longint;
|
i,j,l : longint;
|
||||||
@ -546,55 +525,15 @@ interface
|
|||||||
hp:=tai(p.first);
|
hp:=tai(p.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
|
prefetch(pointer(hp.next)^);
|
||||||
if not(hp.typ in SkipLineInfo) then
|
if not(hp.typ in SkipLineInfo) then
|
||||||
begin
|
begin
|
||||||
hp1:=hp as tailineinfo;
|
current_filepos:=tailineinfo(hp).fileinfo;
|
||||||
current_filepos:=hp1.fileinfo;
|
{ no line info for inlined code }
|
||||||
if do_line and (InlineLevel=0) then
|
if do_line and (inlinelevel=0) then
|
||||||
begin
|
WriteSourceLine(hp as tailineinfo);
|
||||||
{ load infile }
|
end;
|
||||||
if lastfileinfo.fileindex<>hp1.fileinfo.fileindex then
|
|
||||||
begin
|
|
||||||
infile:=current_module.sourcefiles.get_file(hp1.fileinfo.fileindex);
|
|
||||||
if assigned(infile) then
|
|
||||||
begin
|
|
||||||
{ open only if needed !! }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) then
|
|
||||||
infile.open;
|
|
||||||
end;
|
|
||||||
{ avoid unnecessary reopens of the same file !! }
|
|
||||||
lastfileinfo.fileindex:=hp1.fileinfo.fileindex;
|
|
||||||
{ be sure to change line !! }
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
{ write source }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) and
|
|
||||||
assigned(infile) then
|
|
||||||
begin
|
|
||||||
if (infile<>lastinfile) then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(target_asm.comment+'['+infile.name^+']');
|
|
||||||
if assigned(lastinfile) then
|
|
||||||
lastinfile.close;
|
|
||||||
end;
|
|
||||||
if (hp1.fileinfo.line<>lastfileinfo.line) and
|
|
||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
|
||||||
begin
|
|
||||||
if (hp1.fileinfo.line<>0) and
|
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
|
||||||
AsmWriteLn(target_asm.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
|
||||||
{ set it to a negative value !
|
|
||||||
to make that is has been read already !! PM }
|
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
lastfileinfo:=hp1.fileinfo;
|
|
||||||
lastinfile:=infile;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
case hp.typ of
|
case hp.typ of
|
||||||
ait_comment :
|
ait_comment :
|
||||||
Begin
|
Begin
|
||||||
@ -613,16 +552,7 @@ interface
|
|||||||
ait_tempalloc :
|
ait_tempalloc :
|
||||||
begin
|
begin
|
||||||
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
||||||
begin
|
WriteTempalloc(tai_tempalloc(hp));
|
||||||
{$ifdef EXTDEBUG}
|
|
||||||
if assigned(tai_tempalloc(hp).problem) then
|
|
||||||
AsmWriteLn(target_asm.comment+tai_tempalloc(hp).problem^+' ('+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+')')
|
|
||||||
else
|
|
||||||
{$endif EXTDEBUG}
|
|
||||||
AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+tempallocstr[tai_tempalloc(hp).allocation]);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_section :
|
ait_section :
|
||||||
|
@ -479,25 +479,6 @@ interface
|
|||||||
t[3]:= b;
|
t[3]:= b;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function fixline(s:string):string;
|
|
||||||
{
|
|
||||||
return s with all leading and ending spaces and tabs removed
|
|
||||||
}
|
|
||||||
var
|
|
||||||
i,j,k : longint;
|
|
||||||
begin
|
|
||||||
i:=length(s);
|
|
||||||
while (i>0) and (s[i] in [#9,' ']) do
|
|
||||||
dec(i);
|
|
||||||
j:=1;
|
|
||||||
while (j<i) and (s[j] in [#9,' ']) do
|
|
||||||
inc(j);
|
|
||||||
for k:=j to i do
|
|
||||||
if s[k] in [#0..#31,#127..#255] then
|
|
||||||
s[k]:='.';
|
|
||||||
fixline:=Copy(s,j,i-j+1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
Function PadTabs(const p:string;addch:char):string;
|
Function PadTabs(const p:string;addch:char):string;
|
||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
@ -712,7 +693,6 @@ interface
|
|||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
hp : tai;
|
hp : tai;
|
||||||
hp1 : tailineinfo;
|
|
||||||
counter,
|
counter,
|
||||||
lines,
|
lines,
|
||||||
InlineLevel : longint;
|
InlineLevel : longint;
|
||||||
@ -735,54 +715,13 @@ interface
|
|||||||
hp:=tai(p.first);
|
hp:=tai(p.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if not(hp.typ in SkipLineInfo) and
|
prefetch(pointer(hp.next)^);
|
||||||
not DoNotSplitLine then
|
if not(hp.typ in SkipLineInfo) then
|
||||||
begin
|
begin
|
||||||
hp1 := hp as tailineinfo;
|
current_filepos:=tailineinfo(hp).fileinfo;
|
||||||
|
{ no line info for inlined code }
|
||||||
if do_line then
|
if do_line and (inlinelevel=0) and not DoNotSplitLine then
|
||||||
begin
|
WriteSourceLine(hp as tailineinfo);
|
||||||
{ load infile }
|
|
||||||
if lastfileinfo.fileindex<>hp1.fileinfo.fileindex then
|
|
||||||
begin
|
|
||||||
infile:=current_module.sourcefiles.get_file(hp1.fileinfo.fileindex);
|
|
||||||
if assigned(infile) then
|
|
||||||
begin
|
|
||||||
{ open only if needed !! }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) then
|
|
||||||
infile.open;
|
|
||||||
end;
|
|
||||||
{ avoid unnecessary reopens of the same file !! }
|
|
||||||
lastfileinfo.fileindex:=hp1.fileinfo.fileindex;
|
|
||||||
{ be sure to change line !! }
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
{ write source }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) and
|
|
||||||
assigned(infile) then
|
|
||||||
begin
|
|
||||||
if (infile<>lastinfile) then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(target_asm.comment+'['+infile.name^+']');
|
|
||||||
if assigned(lastinfile) then
|
|
||||||
lastinfile.close;
|
|
||||||
end;
|
|
||||||
if (hp1.fileinfo.line<>lastfileinfo.line) and
|
|
||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
|
||||||
begin
|
|
||||||
if (hp1.fileinfo.line<>0) and
|
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
|
||||||
AsmWriteLn(target_asm.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
|
||||||
{ set it to a negative value !
|
|
||||||
to make that is has been read already !! PM }
|
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
lastfileinfo:=hp1.fileinfo;
|
|
||||||
lastinfile:=infile;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DoNotSplitLine:=false;
|
DoNotSplitLine:=false;
|
||||||
|
@ -221,26 +221,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function fixline(s:string):string;
|
|
||||||
{
|
|
||||||
return s with all leading and ending spaces and tabs removed
|
|
||||||
}
|
|
||||||
var
|
|
||||||
i,j,k : longint;
|
|
||||||
begin
|
|
||||||
i:=length(s);
|
|
||||||
while (i>0) and (s[i] in [#9,' ']) do
|
|
||||||
dec(i);
|
|
||||||
j:=1;
|
|
||||||
while (j<i) and (s[j] in [#9,' ']) do
|
|
||||||
inc(j);
|
|
||||||
for k:=j to i do
|
|
||||||
if s[k] in [#0..#31,#127..#255] then
|
|
||||||
s[k]:='.';
|
|
||||||
fixline:=Copy(s,j,i-j+1);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
tx86IntelAssembler
|
tx86IntelAssembler
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -453,7 +433,6 @@ implementation
|
|||||||
prefix,
|
prefix,
|
||||||
suffix : string;
|
suffix : string;
|
||||||
hp : tai;
|
hp : tai;
|
||||||
hp1 : tailineinfo;
|
|
||||||
counter,
|
counter,
|
||||||
lines,
|
lines,
|
||||||
InlineLevel : longint;
|
InlineLevel : longint;
|
||||||
@ -473,52 +452,16 @@ implementation
|
|||||||
hp:=tai(p.first);
|
hp:=tai(p.first);
|
||||||
while assigned(hp) do
|
while assigned(hp) do
|
||||||
begin
|
begin
|
||||||
if do_line and not(hp.typ in SkipLineInfo) and
|
prefetch(pointer(hp.next)^);
|
||||||
not DoNotSplitLine and (InlineLevel=0) then
|
if not(hp.typ in SkipLineInfo) then
|
||||||
begin
|
begin
|
||||||
hp1:=hp as tailineinfo;
|
current_filepos:=tailineinfo(hp).fileinfo;
|
||||||
{ load infile }
|
{ no line info for inlined code }
|
||||||
if lastfileinfo.fileindex<>hp1.fileinfo.fileindex then
|
if do_line and (inlinelevel=0) and not DoNotSplitLine then
|
||||||
begin
|
WriteSourceLine(hp as tailineinfo);
|
||||||
infile:=current_module.sourcefiles.get_file(hp1.fileinfo.fileindex);
|
end;
|
||||||
if assigned(infile) then
|
|
||||||
begin
|
|
||||||
{ open only if needed !! }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) then
|
|
||||||
infile.open;
|
|
||||||
end;
|
|
||||||
{ avoid unnecessary reopens of the same file !! }
|
|
||||||
lastfileinfo.fileindex:=hp1.fileinfo.fileindex;
|
|
||||||
{ be sure to change line !! }
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
{ write source }
|
|
||||||
if (cs_asm_source in current_settings.globalswitches) and
|
|
||||||
assigned(infile) then
|
|
||||||
begin
|
|
||||||
if (infile<>lastinfile) then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(target_asm.comment+'['+infile.name^+']');
|
|
||||||
if assigned(lastinfile) then
|
|
||||||
lastinfile.close;
|
|
||||||
end;
|
|
||||||
if (hp1.fileinfo.line<>lastfileinfo.line) and
|
|
||||||
((hp1.fileinfo.line<infile.maxlinebuf) or (InlineLevel>0)) then
|
|
||||||
begin
|
|
||||||
if (hp1.fileinfo.line<>0) and
|
|
||||||
((infile.linebuf^[hp1.fileinfo.line]>=0) or (InlineLevel>0)) then
|
|
||||||
AsmWriteLn(target_asm.comment+'['+tostr(hp1.fileinfo.line)+'] '+
|
|
||||||
fixline(infile.GetLineStr(hp1.fileinfo.line)));
|
|
||||||
{ set it to a negative value !
|
|
||||||
to make that is has been read already !! PM }
|
|
||||||
if (infile.linebuf^[hp1.fileinfo.line]>=0) then
|
|
||||||
infile.linebuf^[hp1.fileinfo.line]:=-infile.linebuf^[hp1.fileinfo.line]-1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
lastfileinfo:=hp1.fileinfo;
|
|
||||||
lastinfile:=infile;
|
|
||||||
end;
|
|
||||||
DoNotSplitLine:=false;
|
DoNotSplitLine:=false;
|
||||||
|
|
||||||
case hp.typ of
|
case hp.typ of
|
||||||
ait_comment :
|
ait_comment :
|
||||||
Begin
|
Begin
|
||||||
@ -537,16 +480,7 @@ implementation
|
|||||||
ait_tempalloc :
|
ait_tempalloc :
|
||||||
begin
|
begin
|
||||||
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
if (cs_asm_tempalloc in current_settings.globalswitches) then
|
||||||
begin
|
WriteTempalloc(tai_tempalloc(hp));
|
||||||
{$ifdef EXTDEBUG}
|
|
||||||
if assigned(tai_tempalloc(hp).problem) then
|
|
||||||
AsmWriteLn(target_asm.comment+tai_tempalloc(hp).problem^+' ('+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+')')
|
|
||||||
else
|
|
||||||
{$endif EXTDEBUG}
|
|
||||||
AsmWriteLn(target_asm.comment+'Temp '+tostr(tai_tempalloc(hp).temppos)+','+
|
|
||||||
tostr(tai_tempalloc(hp).tempsize)+tempallocstr[tai_tempalloc(hp).allocation]);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ait_section :
|
ait_section :
|
||||||
|
Loading…
Reference in New Issue
Block a user