mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 08:51:10 +02:00
+ write references with registers for debugging purposes (to support asm output with -sr) in the LLVM-MC asm writer
git-svn-id: branches/wasm@47173 -
This commit is contained in:
parent
66c1a57ab4
commit
1d8c5edbcc
@ -177,8 +177,6 @@ implementation
|
|||||||
|
|
||||||
function getreferencestring(var ref : treference) : ansistring;
|
function getreferencestring(var ref : treference) : ansistring;
|
||||||
begin
|
begin
|
||||||
if (ref.index<>NR_NO) then
|
|
||||||
internalerror(2010122809);
|
|
||||||
if assigned(ref.symbol) then
|
if assigned(ref.symbol) then
|
||||||
begin
|
begin
|
||||||
// global symbol or field -> full type and name
|
// global symbol or field -> full type and name
|
||||||
@ -186,6 +184,10 @@ implementation
|
|||||||
// This register is not part of this instruction, it will have
|
// This register is not part of this instruction, it will have
|
||||||
// been placed on the stack by the previous one.
|
// been placed on the stack by the previous one.
|
||||||
result:=ref.symbol.name;
|
result:=ref.symbol.name;
|
||||||
|
if ref.base<>NR_NO then
|
||||||
|
result:=result+'+'+std_regname(ref.base);
|
||||||
|
if ref.index<>NR_NO then
|
||||||
|
result:=result+'+'+std_regname(ref.index);
|
||||||
if ref.offset>0 then
|
if ref.offset>0 then
|
||||||
result:=result+'+'+tostr(ref.offset)
|
result:=result+'+'+tostr(ref.offset)
|
||||||
else if ref.offset<0 then
|
else if ref.offset<0 then
|
||||||
@ -194,9 +196,25 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// local symbol -> stack slot, stored in offset
|
// local symbol -> stack slot, stored in offset
|
||||||
|
result:='';
|
||||||
if ref.base<>NR_STACK_POINTER_REG then
|
if ref.base<>NR_STACK_POINTER_REG then
|
||||||
internalerror(2010122810);
|
result:=std_regname(ref.base);
|
||||||
result:=tostr(ref.offset);
|
if ref.index<>NR_NO then
|
||||||
|
if result<>'' then
|
||||||
|
result:=result+'+'+std_regname(ref.index)
|
||||||
|
else
|
||||||
|
result:=std_regname(ref.index);
|
||||||
|
if ref.offset>0 then
|
||||||
|
begin
|
||||||
|
if result<>'' then
|
||||||
|
result:=result+'+'+tostr(ref.offset)
|
||||||
|
else
|
||||||
|
result:=tostr(ref.offset);
|
||||||
|
end
|
||||||
|
else if ref.offset<0 then
|
||||||
|
result:=result+tostr(ref.offset);
|
||||||
|
if result='' then
|
||||||
|
result:='0';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user