This thing: https://github.com/djipi/Jwarn
From a quick look, it doesn't seem to impossible to implement inside riscasm.c. Some rules want to peek ahead to the next instruction, but we can probably inverse the logic to peek at the previous instruction.
It makes sense to have a Jwarn integrated to Rmac instead to have a standalone Jwarn application (which doesn't really work with the Rmac output asm anyway). For the record, I would like to add here the short discussion about the tool.