mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 01:39:27 +02:00
* support for overriding the line ending character in external assembler
writer decorators (for LLVM function-level inline assembly: there newline has to be replaced by the character sequence '\0A') git-svn-id: trunk@34854 -
This commit is contained in:
parent
20a152d4e9
commit
646385e966
@ -68,6 +68,7 @@ interface
|
||||
function LinePrefix: AnsiString;
|
||||
function LinePostfix: AnsiString;
|
||||
function LineFilter(const s: AnsiString): AnsiString;
|
||||
function LineEnding(const deflineending: ShortString): ShortString;
|
||||
end;
|
||||
|
||||
TExternalAssemblerOutputFile=class
|
||||
@ -569,23 +570,28 @@ Implementation
|
||||
Procedure TExternalAssemblerOutputFile.AsmLn;
|
||||
var
|
||||
newline: pshortstring;
|
||||
newlineres: shortstring;
|
||||
index: longint;
|
||||
begin
|
||||
MaybeAddLinePostfix;
|
||||
if OutCnt>=AsmOutSize-2 then
|
||||
AsmFlush;
|
||||
if (cs_link_on_target in current_settings.globalswitches) then
|
||||
newline:=@target_info.newline
|
||||
else
|
||||
newline:=@source_info.newline;
|
||||
OutBuf[OutCnt]:=newline^[1];
|
||||
inc(OutCnt);
|
||||
inc(AsmSize);
|
||||
if length(newline^)>1 then
|
||||
if assigned(decorator) then
|
||||
begin
|
||||
OutBuf[OutCnt]:=newline^[2];
|
||||
inc(OutCnt);
|
||||
inc(AsmSize);
|
||||
newlineres:=decorator.LineEnding(newline^);
|
||||
newline:=@newlineres;
|
||||
end;
|
||||
if OutCnt>=AsmOutSize-length(newline^) then
|
||||
AsmFlush;
|
||||
index:=1;
|
||||
repeat
|
||||
OutBuf[OutCnt]:=newline^[index];
|
||||
inc(OutCnt);
|
||||
inc(AsmSize);
|
||||
inc(index);
|
||||
until index>length(newline^);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -37,6 +37,7 @@ interface
|
||||
function LinePrefix: AnsiString;
|
||||
function LinePostfix: AnsiString;
|
||||
function LineFilter(const s: AnsiString): AnsiString;
|
||||
function LineEnding(const deflineending: ShortString): ShortString;
|
||||
end;
|
||||
|
||||
TLLVMAssember=class(texternalassembler)
|
||||
@ -176,6 +177,12 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function TLLVMModuleInlineAssemblyDecorator.LineEnding(const deflineending: ShortString): ShortString;
|
||||
begin
|
||||
result:=deflineending
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************}
|
||||
{ LLVM Instruction writer }
|
||||
{****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user