Jeff <[EMAIL PROTECTED]> writes: > It would be cleaner if I know how to modify the gcc source code and > let it insert a nop to each basic block. This shouldn't be a hard job > for an experienced gcc developer, should this?
It's doable but it's probably harder than you seem to think it is. gcc is not in the practice of inserting instructions which do nothing but must not be removed. One simple approach would be to automatically insert the internal equivalent of asm volatile ("nop"); into each basic block. That would be relatively simple, but it would significantly change the generated code, because those volatile asms would be preventing all sorts of optimizations. If you don't care whether the generated code changes, then do that. The place to do it would be expand_gimple_basic_block. If you don't want to change the generated code other than inserting the nops, and you can restrict yourself to a processor which does not need to track addresses to avoid out-of-range branches, then you could approximate what you want by emitting a nop in final_scan_insn when you see a CODE_LABEL, after the label. You'll need to also emit a nop in the first basic block in the function. That probably won't be the precise set of basic blocks as the compiler sees them, but basic block is a somewhat nebulous concept and that may be good enough for your purposes, whatever they are. Ian