mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 21:20:29 +02:00
+ added ref2string debug helper function to the WebAssembly code generator
This commit is contained in:
parent
6ce57a1625
commit
bd1a6a60e8
@ -245,6 +245,10 @@ uses
|
|||||||
procedure resizestackfpuval(list: TAsmList; fromsize, tosize: tcgsize);
|
procedure resizestackfpuval(list: TAsmList; fromsize, tosize: tcgsize);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef extdebug}
|
||||||
|
function ref2string(const ref : treference) : string;
|
||||||
|
{$endif extdebug}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -296,6 +300,50 @@ implementation
|
|||||||
a_i64_rotr {OP_ROR rotate right }
|
a_i64_rotr {OP_ROR rotate right }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{$ifdef extdebug}
|
||||||
|
function ref2string(const ref : treference) : string;
|
||||||
|
const
|
||||||
|
tr: treference = (
|
||||||
|
offset: 0;
|
||||||
|
symbol: nil;
|
||||||
|
relsymbol: nil;
|
||||||
|
temppos: (val: 0);
|
||||||
|
base: NR_NO;
|
||||||
|
index: NR_NO;
|
||||||
|
refaddr: default(trefaddr);
|
||||||
|
scalefactor: 0;
|
||||||
|
volatility: [vol_read, vol_write];
|
||||||
|
alignment: 0;
|
||||||
|
);
|
||||||
|
|
||||||
|
function AsmSymbolName(sym: tasmsymbol): string;
|
||||||
|
begin
|
||||||
|
if assigned(sym) then
|
||||||
|
result := sym.name
|
||||||
|
else
|
||||||
|
result := 'nil';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function Volatility2String(vs: tvolatilityset): string;
|
||||||
|
var
|
||||||
|
v: tvolatility;
|
||||||
|
begin
|
||||||
|
result := '[';
|
||||||
|
for v in tvolatility do
|
||||||
|
if v in vs then
|
||||||
|
WriteStr(result, result, ',', v);
|
||||||
|
if length(result) > 1 then
|
||||||
|
delete(result, 2, 1);
|
||||||
|
result := result + ']';
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
WriteStr(result, '(offset: ', ref.offset, '; symbol: ', AsmSymbolName(ref.symbol), '; relsymbol: ', AsmSymbolName(ref.relsymbol), '; temppos: (val: ', ref.temppos.val,
|
||||||
|
'); base: ', std_regname(ref.base), '; index: ', std_regname(ref.index), '; refaddr: ', ref.refaddr, '; scalefactor: ', ref.scalefactor, '; volatility: ',
|
||||||
|
Volatility2String(ref.volatility), '; alignment: ', ref.alignment, ')');
|
||||||
|
end;
|
||||||
|
{$endif extdebug}
|
||||||
|
|
||||||
function thlcgwasm.is_methodptr_like_type(d:tdef): boolean;
|
function thlcgwasm.is_methodptr_like_type(d:tdef): boolean;
|
||||||
var
|
var
|
||||||
is_8byterecord, is_methodptr, is_nestedprocptr: Boolean;
|
is_8byterecord, is_methodptr, is_nestedprocptr: Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user