I found myself wanting a “scheduling barrier” in LLVM. In my specific circumstances I only want it to mean that TargetInstrInfoImpl::isSchedulingBoundary() would return true.
I added SchedulingBarrier to MCID in MCInstrDesc.h and pushed it through TD attributes down to isSchedulingBoundary(). Is this something of general interest, or is there another mechanism for implementing barriers that I missed?
I don't think you need both a SchedulingBarrier MCID and a special TargetInstrInfo hook. isSchedulingBoundary is a currently target hook because it's fairly specific to a CodeGen pass, we want to make general queries here like isTerminator and isCall, and the answer may vary depending on some attribute of the function. You can always add a target specific barrier opcode and check for it within the target hook without changing the MC API.