윤재구 via llvm-dev
2020-Dec-01 08:19 UTC
[llvm-dev] How to keep parameter's name when create the bc
Hi everyone. I want to analyze the function parameter's relationship between the real code and IR format on the ll/bc file. I checked several cases such as structed type parameter or return type can be included into the first parameter(sret) or can be flatted into the multiple parameters on the special cases. To match parameter betwen them, I decided to use the parameter name on the code if possible. When I created the bc file and disassembled into ll code via llvm-dis, I saw that function parameter names are matched well with the original code normally. However, somecases when I was disassembling the bc file already built through clang (it was built by others, but it is impossible to check exactly which options were given), the parameter names are not visible and is simply displayed in the form of an index(#0, #1 ...). It seems that this happens when the optimization technique is applied by an option. Please let me know if you know which option/feature do this. I try to find alternative way such as making a custom attribute to solve this. If someone already know the way, please let me know. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201201/44a28861/attachment.html>
David Blaikie via llvm-dev
2020-Dec-01 17:20 UTC
[llvm-dev] How to keep parameter's name when create the bc
Generally you shouldn't rely on the names of LLVM UIR values - they're only a debugging aid, essentially. But if you really want to force them to be emitted, I think ( according to https://reviews.llvm.org/D42887 ) that -fno-discard-value-names would do it. The "proper" way to implement this sort of thing is probably to look at the debug info metadata ( https://llvm.org/docs/SourceLevelDebugging.html ) to try to derive facts about the correlation between source code and the IR instructions. On Tue, Dec 1, 2020 at 12:19 AM 윤재구 via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi everyone. > > I want to analyze the function parameter's relationship between the real code and IR format on the ll/bc file. > I checked several cases such as structed type parameter or return type can be included into the first parameter(sret) or can be flatted into the multiple parameters on the special cases. > > To match parameter betwen them, I decided to use the parameter name on the code if possible. > > When I created the bc file and disassembled into ll code via llvm-dis, I saw that function parameter names are matched well with the original code normally. > However, somecases when I was disassembling the bc file already built through clang (it was built by others, but it is impossible to check exactly which options were given), the parameter names are not visible and is simply displayed in the form of an index(#0, #1 ...). > It seems that this happens when the optimization technique is applied by an option. > Please let me know if you know which option/feature do this. > > I try to find alternative way such as making a custom attribute to solve this. > If someone already know the way, please let me know. _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev