From d37e72dbf98efe88c298b16ce2dbd9b371101f56 Mon Sep 17 00:00:00 2001 From: sergei Date: Mon, 22 Sep 2014 16:18:16 +0000 Subject: [PATCH] * ARM: instructions do modify the base register of pre/postindexed references. Report this fact in spilling_get_operation_type_ref and RegModifiedByInstruction functions. git-svn-id: trunk@28708 - --- compiler/arm/aasmcpu.pas | 11 ++++++++++- compiler/arm/aoptcpub.pas | 13 ++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/compiler/arm/aasmcpu.pas b/compiler/arm/aasmcpu.pas index 26298791bd..97954cc01b 100644 --- a/compiler/arm/aasmcpu.pas +++ b/compiler/arm/aasmcpu.pas @@ -212,7 +212,7 @@ uses function is_same_reg_move(regtype: Tregistertype):boolean; override; function spilling_get_operation_type(opnr: longint): topertype;override; - + function spilling_get_operation_type_ref(opnr: longint; reg: tregister): topertype;override; { assembler } public { the next will reset all instructions that can change in pass 2 } @@ -777,6 +777,15 @@ implementation end; + function taicpu.spilling_get_operation_type_ref(opnr: longint; reg: tregister): topertype; + begin + result := operand_read; + if (oper[opnr]^.ref^.base = reg) and + (oper[opnr]^.ref^.addressmode in [AM_PREINDEXED,AM_POSTINDEXED]) then + result := operand_readwrite; + end; + + procedure BuildInsTabCache; var i : longint; diff --git a/compiler/arm/aoptcpub.pas b/compiler/arm/aoptcpub.pas index aa60bfd624..28451ca028 100644 --- a/compiler/arm/aoptcpub.pas +++ b/compiler/arm/aoptcpub.pas @@ -124,11 +124,14 @@ Implementation begin result:=false; for i:=0 to taicpu(p1).ops-1 do - if (taicpu(p1).oper[i]^.typ=top_reg) and (taicpu(p1).oper[i]^.reg=Reg) and (taicpu(p1).spilling_get_operation_type(i) in [operand_write,operand_readwrite]) then - begin - result:=true; - exit; - end; + case taicpu(p1).oper[i]^.typ of + top_reg: + if (taicpu(p1).oper[i]^.reg=Reg) and (taicpu(p1).spilling_get_operation_type(i) in [operand_write,operand_readwrite]) then + exit(true); + top_ref: + if (taicpu(p1).spilling_get_operation_type_ref(i,Reg)<>operand_read) then + exit(true); + end; end; End.