Hello, I am new to this mailing list.
We have implemented Hazard Recognizer for our backend that targets an SIMD architecture. It is implemented similarly to what ARM and PowerPC have done in lib/Target/ARM/HazardRecognizer.cpp or lib/Target/PowerPC/PPCHazardRecognizers.cpp.
We detect read-after-write hazards for consecutive instructions and when the defining instruction has a latency of 2 cycles; we have an Hazard.
We use the standard pre-RA scheduler and post-RA scheduler, implemented in lib/CodeGen/ScheduleDAGRList.cpp and lib/CodeGen/PostRASchedulerList.cpp respectively, and use post-RA scheduling (with ScoreboardHazardRecognizer), but even if I return Hazard or NoopHazard, the scheduler does not always insert NOP.
The scheduler does currently avoid creating hazards by scheduling consecutive instructions without a RAW hazard. However, when it has no instructions to choose from other than instructions with a RAW hazard, the scheduler with hazard recognizer (derived from ScoreboardHazardRecognizer) is cycling in an infinite loop, by calling getHazards() over and over.
1. Does the scheduler not know what a NOP is?
2. Is there a method that I can override to insert a NOP when a data hazard has been identified?
3. Has anybody encountered this problem as well?
Should I make a machine pass before RA to insert these nops, or is there a simpler solution?