0

I've read many posts here and on other sites, but still didn't get clear answer.
Let's say I have instruction and I can print it out by

errs() << inst << "\n";

and I got:
%9 = add nsw i32 %7, %8
I want to get variables names behind %9, %7, %8.
Is it possible? and if it is, how?
Thank you :)

Dim
  • 25
  • 1
  • 4
  • 2
    On the IR level, these **are** instruction names. If you produced your IR from C or some other language, look into DebugInfo stuff. – arrowd Feb 28 '21 at 20:18
  • Does this answer your question? [In LLVM IR, how can I print the name of a unnamed value which is represented as an unsigned numeric value with their prefix such as %2?](https://stackoverflow.com/questions/30732839/in-llvm-ir-how-can-i-print-the-name-of-a-unnamed-value-which-is-represented-as) – Ismail Badawi Feb 28 '21 at 23:55

1 Answers1

0

From here How to save the variable name when use clang to generate llvm ir?

clang -fno-discard-value-names <your-command-line> 

does the job :)

Dim
  • 25
  • 1
  • 4