* improve ldr*/str* handling for arm thumb

git-svn-id: trunk@28583 -
This commit is contained in:
florian 2014-09-02 19:37:45 +00:00
parent 9991ee4165
commit 3f71b059e5

View File

@ -4057,30 +4057,30 @@ unit cgcpu;
tmpreg : TRegister; tmpreg : TRegister;
begin begin
href:=ref; href:=ref;
if (op in [A_STR,A_STRB,A_STRH]) and if { LDR/STR limitations }
(abs(ref.offset)>124) then (
begin (((op=A_LDR) and (oppostfix=PF_None)) or
tmpreg:=getintregister(list,OS_ADDR); ((op=A_STR) and (oppostfix=PF_None))) and
a_loadaddr_ref_reg(list,ref,tmpreg);
reference_reset_base(href,tmpreg,0,ref.alignment);
end
else if ((op=A_LDR) and (oppostfix in [PF_None]) and
(ref.base<>NR_STACK_POINTER_REG) and (ref.base<>NR_STACK_POINTER_REG) and
(abs(ref.offset)>124)) or (abs(ref.offset)>124)
{ LDRB limitations } ) or
{ LDRB/STRB limitations }
( (
(((op=A_LDR) and (oppostfix=PF_B)) or (((op=A_LDR) and (oppostfix=PF_B)) or
((op=A_LDRB) and (oppostfix=PF_None))) and ((op=A_LDRB) and (oppostfix=PF_None)) or
((op=A_STR) and (oppostfix=PF_B)) or
((op=A_STRB) and (oppostfix=PF_None))) and
((ref.base=NR_STACK_POINTER_REG) or ((ref.base=NR_STACK_POINTER_REG) or
(ref.index=NR_STACK_POINTER_REG) or (ref.index=NR_STACK_POINTER_REG) or
(abs(ref.offset)>31) (abs(ref.offset)>31)
) )
) or ) or
{ LDRH limitations } { LDRH/STRH limitations }
( (
(((op=A_LDR) and (oppostfix=PF_H)) or (((op=A_LDR) and (oppostfix=PF_H)) or
((op=A_LDRH) and (oppostfix=PF_None))) and ((op=A_LDRH) and (oppostfix=PF_None)) or
((op=A_STR) and (oppostfix=PF_H)) or
((op=A_STRH) and (oppostfix=PF_None))) and
((ref.base=NR_STACK_POINTER_REG) or ((ref.base=NR_STACK_POINTER_REG) or
(ref.index=NR_STACK_POINTER_REG) or (ref.index=NR_STACK_POINTER_REG) or
(abs(ref.offset)>62) or (abs(ref.offset)>62) or