llvm-ir

Getting the original variable name for an LLVM Value

不羁岁月 提交于 2019-11-27 05:25:32
问题 The operands for an llvm::User (e.g. instruction) are llvm::Values. After the mem2reg pass, variables are in SSA form, and their names as corresponding to the original source code are lost. Value::getName() is only set for some things; for most variables, which are intermediaries, its not set. The instnamer pass can be run to give all the variables names like tmp1 and tmp2 , but this doesn't capture where they originally come from. Here's some LLVM IR beside the original C code: I am building