Skip the stage that no functional units are required in ScoreboardHazardRecognizer::getHazardType. If not, this function will always return Hazard by default, leading to endless loop when running the post-RA-sched pass.
Originally, I defined an itinerary like this:
InstrItinData< IIC_MOVI, [ InstrStage<1, []>, InstrStage<1, [FU_ALU]> ]>,
indicates that the second stage occupies FU_ALU for 1 cycle and that this stage starts 2 cycles from the issue point.
In our case, we also make use of the TargetInstrInfo::getInstrLatency to compute the instruction latency of a given instruction. Then, the SchedulePostRATDList::ListScheduleTopDown will never exit once it is called.
Later, I have modified this itinerary like this:
InstrItinData< IIC_MOVI, [ InstrStage<0, [], 1>, InstrStage<1, [FU_ALU]> ]>,
Then, the SchedulePostRATDList::ListScheduleTopDown works well.
So, whether this problem described above is really a problem? Maybe it's my falult.