diff --git a/compiler/aoptbase.pas b/compiler/aoptbase.pas index 06ad0413c0..3b92defdd9 100644 --- a/compiler/aoptbase.pas +++ b/compiler/aoptbase.pas @@ -188,11 +188,11 @@ unit aoptbase; Current := tai(Current.Next); While Assigned(Current) And ((Current.typ In SkipInstr) or -{$if defined(SPARCGEN) or defined(MIPS)} +{$ifdef cpudelayslot} ((Current.typ=ait_instruction) and (taicpu(Current).opcode=A_NOP) ) or -{$endif SPARCGEN or MIPS} +{$endif cpudelayslot} ((Current.typ = ait_label) And labelCanBeSkipped(Tai_Label(Current)))) Do Current := tai(Current.Next); diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas index 866990ef9f..952bd28bb6 100644 --- a/compiler/aoptobj.pas +++ b/compiler/aoptobj.pas @@ -1049,9 +1049,9 @@ Unit AoptObj; Repeat While Assigned(StartPai) And ((StartPai.typ in (SkipInstr - [ait_regAlloc])) Or -{$if defined(MIPS) or defined(SPARCGEN)} +{$ifdef cpudelayslot} ((startpai.typ=ait_instruction) and (taicpu(startpai).opcode=A_NOP)) or -{$endif MIPS or SPARC} +{$endif cpudelayslot} ((StartPai.typ = ait_label) and Not(Tai_Label(StartPai).labsym.Is_Used))) Do StartPai := Tai(StartPai.Next); @@ -1398,10 +1398,10 @@ Unit AoptObj; no-line-info-start/end etc } if hp1.typ<>ait_marker then begin -{$if defined(SPARC) or defined(MIPS) } +{$ifdef cpudelayslot} if (hp1.typ=ait_instruction) and (taicpu(hp1).is_jmp) then RemoveDelaySlot(hp1); -{$endif SPARC or MIPS } +{$endif cpudelayslot} asml.remove(hp1); hp1.free; stoploop:=false; @@ -1421,9 +1421,9 @@ Unit AoptObj; (p<>blockstart) then begin tasmlabel(JumpTargetOp(taicpu(p))^.ref^.symbol).decrefs; -{$if defined(SPARC) or defined(MIPS)} +{$ifdef cpudelayslot} RemoveDelaySlot(p); -{$endif SPARC or MIPS} +{$endif cpudelayslot} hp2:=tai(hp1.next); asml.remove(p); p.free; @@ -1468,9 +1468,9 @@ Unit AoptObj; taicpu(p).oper[0]^.ref^.symbol.increfs; } -{$if defined(SPARC) or defined(MIPS)} +{$ifdef cpudelayslot} RemoveDelaySlot(hp1); -{$endif SPARC or MIPS} +{$endif cpudelayslot} asml.remove(hp1); hp1.free; stoploop:=false; diff --git a/compiler/fpcdefs.inc b/compiler/fpcdefs.inc index 234fdc6cc9..b531136252 100644 --- a/compiler/fpcdefs.inc +++ b/compiler/fpcdefs.inc @@ -109,6 +109,7 @@ {$define cpuflags} {$define cputargethasfixedstack} {$define cpurefshaveindexreg} + {$define cpudelayslot} {$define SUPPORT_SAFECALL} {$define sparcgen} @@ -124,6 +125,7 @@ {$define cpuflags} {$define cputargethasfixedstack} {$define cpurefshaveindexreg} + {$define cpudelayslot} {$define SUPPORT_SAFECALL} {$define sparcgen} {$endif sparc64} @@ -238,6 +240,7 @@ {$define cpurequiresproperalignment} { define cpumm} {$define cpurefshaveindexreg} + {$define cpudelayslot} {$define SUPPORT_GET_FRAME} {$define SUPPORT_SAFECALL} {$endif mips}