[LLVMdev] Getting started with LLVM Passes
Sean Peisert
peisert at gmail.com
Tue Jul 12 14:29:03 PDT 2005
Chris,
I've now figured out how to track and single out specific
instructions, which was ridiculously easy. Thanks!
I'm now on to trying to find more detail about those instructions,
such as the values and addresses of the operands in memory (or, in
the case of operands which are pointers, trying to get the pointer
values, addresses, and values stored at location specified by the
pointer values, etc..).
Would you suggest having LLVM add code after each instruction to get
this, or is there another way to do this? I've tried writing some
code, as follows (where i is an inst_iterator, but the results are
not what I would have expected:
for (User::op_iterator j = i->op_begin(), f = i->op_end(); j != f; +
+j) {
std::cerr << "Operand: " << (j->getUser())->getOperand(0) << "\n";
}
or
for (User::op_iterator j = i->op_begin(), f = i->op_end(); j != f; +
+j) {
std::cerr << "Operand: " << j << "\n";
}
Thanks,
Sean
More information about the llvm-dev
mailing list