* make use of LA pseudo-instruction

This commit is contained in:
florian 2024-12-25 18:25:59 +01:00
parent 57da25581e
commit 64ba751ef1
4 changed files with 20 additions and 2 deletions

View File

@ -2987,6 +2987,9 @@ implementation
{$ifdef aarch64}
and not(r.refaddr in [addr_full,addr_gotpageoffset,addr_gotpage])
{$endif aarch64}
{$ifdef riscv}
and not(opcode=A_LA)
{$endif riscv}
then
internalerror(200502052);
{$endif not llvm}

View File

@ -480,7 +480,7 @@ uses cutils, cclasses;
// I type
A_JALR,
A_LB,A_LH,A_LW,A_LBU,A_LHU,
A_LA,A_LB,A_LH,A_LW,A_LBU,A_LHU,
A_ADDI,A_SLTI,A_SLTIU,
A_XORI,A_ORI,A_ANDI,
A_SLLI,A_SRLI,A_SRAI,

View File

@ -74,7 +74,7 @@ unit agrvgas;
else
begin
s :='';
if not(refaddr in [addr_no,addr_pic_no_got,addr_plt]) then
if not(refaddr in [addr_no,addr_pic_no_got,addr_plt,addr_full]) then
s := s+'(';
if assigned(symbol) then
begin

View File

@ -931,6 +931,12 @@ unit cgrv;
if assigned(ref.symbol) then
begin
{$ifdef unsed}
{ keeping the code for reference
we use the pseudo instruction LA below which is expanded by the assembler, doing
so results in more readable assembler and easier optimization of the assembler code
}
if cs_create_pic in current_settings.moduleswitches then
begin
reference_reset_symbol(href,ref.symbol,0,0,[]);
@ -969,6 +975,15 @@ unit cgrv;
href.refaddr:=addr_pcrel_lo12;
list.concat(taicpu.op_reg_reg_ref(A_ADDI,tmpreg,tmpreg,href));
end;
{$endif unsed}
reference_reset_symbol(href,ref.symbol,0,0,[]);
href.refaddr:=addr_full;
ref.symbol:=nil;
tmpreg:=getintregister(list,OS_ADDR);
list.concat(taicpu.op_reg_ref(A_LA,tmpreg,href));
if (ref.index<>NR_NO) and
(ref.base<>NR_NO) then