60/6300/360deg/rev=26.4us
per degree, which isn't much compared to
(per Math execution times for Arduino)
...so a degree-incrementing approach as in @noiasca's excellent #16 code might top out well before 6300RPM.
With a 4 operations x 3 cylinders, there's still 60/6300/12=794us
per operation. You could probably schedule the intervals when the speed changes, and then and toggle switches as scheduled.