summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaksen <laksen@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-09-09 14:02:54 +0000
committerlaksen <laksen@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-09-09 14:02:54 +0000
commit86edcc3c7d59ed940e52a15b845caf297d484eaf (patch)
treed64f5bb14a63ae90cc7717bd157eb87be9cac60e
parent2c17f115a938177f12b520b137171944d725b4ba (diff)
downloadfpc-86edcc3c7d59ed940e52a15b845caf297d484eaf.tar.gz
Removed reuse of src and dest registers in g_concatcopy as that
could modify registers used for other stuff(ex. framepointer). git-svn-id: https://svn.freepascal.org/svn/fpc/branches/laksen@39717 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--riscv_new/compiler/riscv64/cgcpu.pas36
1 files changed, 10 insertions, 26 deletions
diff --git a/riscv_new/compiler/riscv64/cgcpu.pas b/riscv_new/compiler/riscv64/cgcpu.pas
index 31c533f971..6f028d5448 100644
--- a/riscv_new/compiler/riscv64/cgcpu.pas
+++ b/riscv_new/compiler/riscv64/cgcpu.pas
@@ -519,14 +519,6 @@ implementation
src, dst, src2, dst2: TReference;
lab: tasmlabel;
Count, count2: aint;
-
- function reference_is_reusable(const ref: treference): boolean;
- begin
- result:=(ref.base<>NR_NO) and (ref.index=NR_NO) and
- (ref.symbol=nil) and
- is_imm12(ref.offset);
- end;
-
begin
src2:=source;
fixref(list,src2);
@@ -550,24 +542,16 @@ implementation
else
begin
Count := len div 8;
- if (count<=8) and reference_is_reusable(src2) then
- src:=src2
- else
- begin
- reference_reset(src,sizeof(aint),[]);
- { load the address of src2 into src.base }
- src.base := GetAddressRegister(list);
- a_loadaddr_ref_reg(list, src2, src.base);
- end;
- if (count<=8) and reference_is_reusable(dst2) then
- dst:=dst2
- else
- begin
- reference_reset(dst,sizeof(aint),[]);
- { load the address of dst2 into dst.base }
- dst.base := GetAddressRegister(list);
- a_loadaddr_ref_reg(list, dst2, dst.base);
- end;
+ reference_reset(src,sizeof(aint),[]);
+ { load the address of src2 into src.base }
+ src.base := GetAddressRegister(list);
+ a_loadaddr_ref_reg(list, src2, src.base);
+
+ reference_reset(dst,sizeof(aint),[]);
+ { load the address of dst2 into dst.base }
+ dst.base := GetAddressRegister(list);
+ a_loadaddr_ref_reg(list, dst2, dst.base);
+
{ generate a loop }
if Count > 4 then
begin