From 0a886833104abbbb3742c40aa8f965ab14547e12 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 25 May 2024 20:09:02 +0200 Subject: [PATCH] + do do_consttovar on RiscV --- compiler/optcse.pas | 4 ++-- compiler/riscv32/cpuinfo.pas | 2 +- compiler/riscv64/cpuinfo.pas | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/optcse.pas b/compiler/optcse.pas index f9bb0b4403..5e5eccac51 100644 --- a/compiler/optcse.pas +++ b/compiler/optcse.pas @@ -608,9 +608,9 @@ unit optcse; Result:=(n.nodetype=loadn) and (tloadnode(n).symtableentry.typ=staticvarsym) and ((vo_is_thread_var in tstaticvarsym(tloadnode(n).symtableentry).varoptions) or (cs_create_pic in current_settings.moduleswitches) -{$if defined(aarch64) or defined(sparc) or defined(sparc64)} +{$if defined(aarch64) or defined(sparc) or defined(sparc64) or defined(riscv)} or (not(tabstractvarsym(tloadnode(n).symtableentry).is_regvar(false))) -{$endif defined(aarch64) or defined(sparc) or defined(sparc64)} +{$endif defined(aarch64) or defined(sparc) or defined(sparc64) or defined(riscv)} ); end; diff --git a/compiler/riscv32/cpuinfo.pas b/compiler/riscv32/cpuinfo.pas index c43e6df7ad..93aa7d1620 100644 --- a/compiler/riscv32/cpuinfo.pas +++ b/compiler/riscv32/cpuinfo.pas @@ -189,7 +189,7 @@ Const cs_opt_stackframe]; level1optimizerswitches = genericlevel1optimizerswitches; - level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches + [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_nodecse,cs_opt_tailrecursion]; + level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches + [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_nodecse,cs_opt_tailrecursion,cs_opt_consts]; level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches; level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [cs_opt_stackframe]; diff --git a/compiler/riscv64/cpuinfo.pas b/compiler/riscv64/cpuinfo.pas index 7a076d34d9..752695b0d6 100644 --- a/compiler/riscv64/cpuinfo.pas +++ b/compiler/riscv64/cpuinfo.pas @@ -112,7 +112,7 @@ Const level1optimizerswitches = genericlevel1optimizerswitches; level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches + - [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_stackframe,cs_opt_nodecse,cs_opt_tailrecursion]; + [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_stackframe,cs_opt_nodecse,cs_opt_tailrecursion,cs_opt_consts]; level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches; level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [cs_opt_stackframe];