mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 01:29:29 +02:00
+ TLLVMModuleInlineAssemblyDecorator to decorate inline module-level
assembly git-svn-id: trunk@31632 -
This commit is contained in:
parent
55e84df094
commit
5c69d57674
@ -33,6 +33,12 @@ interface
|
||||
type
|
||||
TLLVMInstrWriter = class;
|
||||
|
||||
TLLVMModuleInlineAssemblyDecorator = class(TObject,IExternalAssemblerOutputFileDecorator)
|
||||
function LinePrefix: AnsiString;
|
||||
function LinePostfix: AnsiString;
|
||||
function LineFilter(const s: AnsiString): AnsiString;
|
||||
end;
|
||||
|
||||
TLLVMAssember=class(texternalassembler)
|
||||
protected
|
||||
fdecllevel: longint;
|
||||
@ -131,6 +137,42 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************}
|
||||
{ Decorator for module-level inline assembly }
|
||||
{****************************************************************************}
|
||||
|
||||
function TLLVMModuleInlineAssemblyDecorator.LinePrefix: AnsiString;
|
||||
begin
|
||||
result:='module asm "';
|
||||
end;
|
||||
|
||||
|
||||
function TLLVMModuleInlineAssemblyDecorator.LinePostfix: AnsiString;
|
||||
begin
|
||||
result:='"';
|
||||
end;
|
||||
|
||||
|
||||
function TLLVMModuleInlineAssemblyDecorator.LineFilter(const s: AnsiString): AnsiString;
|
||||
var
|
||||
i: longint;
|
||||
begin
|
||||
result:='';
|
||||
for i:=1 to length(s) do
|
||||
begin
|
||||
case s[i] of
|
||||
#0..#31,
|
||||
#127..#255,
|
||||
'"','\':
|
||||
result:=result+
|
||||
'\'+
|
||||
chr((ord(s[i]) shr 4)+ord('0'))+
|
||||
chr((ord(s[i]) and $f)+ord('0'));
|
||||
else
|
||||
result:=result+s[i];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user