diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-02-02 20:35:29 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2020-02-02 20:35:29 +0000 |
commit | 55a7a4d8850a46e5bd499edb6d1fcb201036602b (patch) | |
tree | b0177913bf89bc0cd0c724ba631d5e9750231c35 /compiler/avr/aoptcpu.pas | |
parent | 02f522397604e9b6066839a5919494a09eb13c72 (diff) | |
download | fpc-55a7a4d8850a46e5bd499edb6d1fcb201036602b.tar.gz |
* based on a patch by Christo Crause: more compiler fixes for avrtiny, resolves #36646
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@44103 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/avr/aoptcpu.pas')
-rw-r--r-- | compiler/avr/aoptcpu.pas | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/avr/aoptcpu.pas b/compiler/avr/aoptcpu.pas index c8b999808c..0a396c678d 100644 --- a/compiler/avr/aoptcpu.pas +++ b/compiler/avr/aoptcpu.pas @@ -433,18 +433,17 @@ Implementation (getsupreg(taicpu(p).oper[0]^.ref^.base)=RS_NO) and (getsupreg(taicpu(p).oper[0]^.ref^.index)=RS_NO) and (taicpu(p).oper[0]^.ref^.addressmode=AM_UNCHANGED) and - // avrxmega3 doesn't map registers into data space so no offset to subtract - (((current_settings.cputype = cpu_avrxmega3) and + (((CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype]) and (taicpu(p).oper[0]^.ref^.offset>=0) and (taicpu(p).oper[0]^.ref^.offset<=63)) or - ((current_settings.cputype <> cpu_avrxmega3) and + (not(CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype]) and (taicpu(p).oper[0]^.ref^.offset>=32) and (taicpu(p).oper[0]^.ref^.offset<=95))) then begin DebugMsg('Peephole Sts2Out performed', p); taicpu(p).opcode:=A_OUT; - if current_settings.cputype = cpu_avrxmega3 then + if CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype] then taicpu(p).loadconst(0,taicpu(p).oper[0]^.ref^.offset) else taicpu(p).loadconst(0,taicpu(p).oper[0]^.ref^.offset-32); @@ -455,18 +454,17 @@ Implementation (getsupreg(taicpu(p).oper[1]^.ref^.base)=RS_NO) and (getsupreg(taicpu(p).oper[1]^.ref^.index)=RS_NO) and (taicpu(p).oper[1]^.ref^.addressmode=AM_UNCHANGED) and - // avrxmega3 doesn't map registers into data space so no offset to subtract - (((current_settings.cputype = cpu_avrxmega3) and + (((CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype]) and (taicpu(p).oper[1]^.ref^.offset>=0) and (taicpu(p).oper[1]^.ref^.offset<=63)) or - ((current_settings.cputype <> cpu_avrxmega3) and + (not(CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype]) and (taicpu(p).oper[1]^.ref^.offset>=32) and (taicpu(p).oper[1]^.ref^.offset<=95))) then begin DebugMsg('Peephole Lds2In performed', p); taicpu(p).opcode:=A_IN; - if current_settings.cputype = cpu_avrxmega3 then + if CPUAVR_NOMEMMAPPED_REGS in cpu_capabilities[current_settings.cputype] then taicpu(p).loadconst(1,taicpu(p).oper[1]^.ref^.offset) else taicpu(p).loadconst(1,taicpu(p).oper[1]^.ref^.offset-32); @@ -784,7 +782,8 @@ Implementation GetNextInstruction(hp2,hp3) and MatchInstruction(hp3,A_POP) then begin - if (getsupreg(taicpu(hp1).oper[0]^.reg)=getsupreg(taicpu(p).oper[0]^.reg)+1) and + if (CPUAVR_HAS_MOVW in cpu_capabilities[current_settings.cputype]) and + (getsupreg(taicpu(hp1).oper[0]^.reg)=getsupreg(taicpu(p).oper[0]^.reg)+1) and ((getsupreg(taicpu(p).oper[0]^.reg) mod 2)=0) and (getsupreg(taicpu(hp2).oper[0]^.reg)=getsupreg(taicpu(hp3).oper[0]^.reg)+1) and ((getsupreg(taicpu(hp3).oper[0]^.reg) mod 2)=0) then |