我正在尝试检测 LLVM IR 调用指令。我想要实现的是获取函数调用的参数。如果参数是指针类型,那么我想获取指针指向的元素/变量。我知道如果我有论据,我可以使用
getPointerElementType to get the type of element the pointer is pointing to.
但是如何访问元素的值呢?
我正在尝试检测 LLVM IR 调用指令。我想要实现的是获取函数调用的参数。如果参数是指针类型,那么我想获取指针指向的元素/变量。我知道如果我有论据,我可以使用
getPointerElementType to get the type of element the pointer is pointing to.
但是如何访问元素的值呢?
You want to
get the element/variable that pointer is pointing to
This is also called "dereferencing a pointer". This is not something you can do at compile time, but what you can do is insert an instruction which does the dereferencing - in other words, a load
instruction.