[PATCH] D21374: [RFC] Generate long nop instructions depending on function-specific subtarget info
Andrey Turetskiy via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 15 05:42:27 PDT 2016
aturetsk added a comment.
I've been thinking about a way to generate function-specific long nop instructions and here is what I came up with:
1. Function-specific subtarget info seems to be available only during machine function passes. However I don't think we can start generating long nops somewhere there, so during the pass which creates MCFragments (AsmPrinter) we store the info in the fragments which hold the function.
2. We generate long nops in MCAssembler as we've been doing so far, just additionally pass the function subtarget info to the writeNopData function.
3. Unfortunately I didn't find a better way to pass a module subtarget info to the writeNopData other that in the rejected http://reviews.llvm.org/D17573 (so to work correctly this patch is applied on top of it). Eric suggested to move writeNopData from AsmBackend somewhere else, but I didn't find a better place with module subtarget info available there. Also, I didn't find a way to reach module subtarget info from MCAssembler. I'd appreciate any advise on how to do that any other way than http://reviews.llvm.org/D17573.
The result of the patch you can see in the test - generated long nops differ from function to function depending on the specified targets.
More information about the llvm-commits