replace restart {
	ld  a,%1
    	add a,#0xFF
	ld  %1,a
	or  a, a
} by {
	dec %1
} if notUsed('a')

replace restart {
	ld	%1, %2
	di
	ld	%2, %1
} by {
	; peephole rule 1-with_DI removed dead load from %2 into %1.
	di
} if notVolatile(%1), notUsed(%1), notVolatile(%2)

replace restart {
	ld	%1, %2
	di
	ld	%3, %1
} by {
	; peephole rule 1b-with_DI loaded %2 into %3 directly instead of going through %1.
	ld	%3, %2
	di
} if canAssign(%3 %2), notVolatile(%1), notUsed(%1)

replace restart {
	ld	%1, %2 (%3)
	di
	ld	%4, %1
} by {
	; peephole rule 11-with_DI loaded %2 (%3) into %4 directly instead of going through %1.
	ld	%4, %2 (%3)
	di
} if canAssign(%4 %2 %3), notVolatile(%1), notUsed(%1)

replace {
	call	_SMS_crt0_RST08
} by {
	; peephole rule call_SMS_crt0_RST08
	rst	#0x08
}

replace {
	call	_SMS_crt0_RST18
} by {
	; peephole rule call_SMS_crt0_RST18
	rst	#0x18
}
