From 7840b4657affeadd971da5261f538a213afb112c Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 6 Sep 2012 15:12:17 +0000 Subject: [PATCH] * the improved arm optimizer might move instructions around so the old hacky test if a label with its data has been already embedded into the code by checking if the offset is 0 does not work anymore so a new field for tai_label has been introduced for this purpose git-svn-id: trunk@22345 - --- compiler/aasmtai.pas | 13 +++++++++---- compiler/arm/aasmcpu.pas | 4 +++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index 769780d427..bfa2e0baa4 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -426,13 +426,13 @@ interface procedure derefimpl;override; end; - tai_ent = class(tai) - Name : string; + tai_ent = class(tai) + Name : string; Constructor Create (const ProcName : String); end; tai_ent_end = class(tai) - Name : string; + Name : string; Constructor Create (const ProcName : String); end; @@ -446,8 +446,13 @@ interface { Generates an assembler label } tai_label = class(tai) - is_global : boolean; labsym : tasmlabel; + is_global : boolean; +{$ifdef arm} + { set to true when the label has been moved by insertpcrelativedata to the correct location + so one label can be used multiple times } + moved : boolean; +{$endif arm} constructor Create(_labsym : tasmlabel); constructor ppuload(t:taitype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; diff --git a/compiler/arm/aasmcpu.pas b/compiler/arm/aasmcpu.pas index 7de38c467a..b2da9b1432 100644 --- a/compiler/arm/aasmcpu.pas +++ b/compiler/arm/aasmcpu.pas @@ -818,6 +818,7 @@ implementation penalty, lastinspos, { increased for every data element > 4 bytes inserted } + currentsize, extradataoffset, limit: longint; curop : longint; @@ -851,8 +852,9 @@ implementation curdatatai:=tai(taicpu(curtai).oper[curop]^.ref^.symboldata); if assigned(curdatatai) and { move only if we're at the first reference of a label } - (taicpu(curtai).oper[curop]^.ref^.offset=0) then + not(tai_label(curdatatai).moved) then begin + tai_label(curdatatai).moved:=true; { check if symbol already used. } { if yes, reuse the symbol } hp:=tai(curdatatai.next);