// peeph.def - PDK peephole rules

replace restart {
	mov	%1, %2
} by {
	; peephole 0 removed dead load into %1 from %2.
} if notUsed(%1)

replace restart {
	mov	%1, a
	mov	a, %1
} by {
	mov	%1, a
	; peephole 1 removed redundant load from %1 into a.
} if notVolatile(%1)


replace restart {
	mov	a, #%1
	ret
} by {
	; peephole 2 moved load to ret.
	ret	#%1
}

replace restart {
	xch	a, %1
	xch	a, %1
} by {
	; peephole 3 removed redundant double exchange between a and %1.
} if notVolatile(%1)

replace restart {
	mov	a, #0x00
	slc	a
	and	a, #0x01
} by {
	mov	a, #0x00
	slc	a
	; peephole 4 removed redundant and.
}

replace restart {
%1:
} by {
	; peephole j0 removed unused label %1.
} if labelRefCount(%1 0)

replace restart {
	ret	%1
	ret
} by {
	ret	%1
	; peephole j1 removed redundant ret after ret k.
}

