[LLVMdev] getting object from BitCastInst?

ret val retval386 at gmail.com
Tue Oct 11 20:46:18 PDT 2011

My pass is looking at StoreInsts acting on global variable that happen
to be function pointers. From these StoreInsts I would like to get
useful information(the function used if a direct assignment, function
pointer used, etc) from the  getValueOperand() method. Looking through
several examples I see that this can return several things like:
GlobalVariable, Function, LoadInst or BitCastInst depending on how
much "indirection" is used.

In the case of BitCastInst my dump shows "%ptr.addr = alloca i8*,
align 8", I would like to isolate this just to "ptr". Ive tried doing
another dyn_cast to AllocaInt, but I couldn't find any relevant
methods. How Can I do this?

                                        BitCastInst *bitcastRHS =
					if(bitcastRHS != NULL) {
						LoadInst *load = dyn_cast<LoadInst>(bitcastRHS->getOperand(0));
						if(load != NULL) {
							rhs = load->getPointerOperand();

More information about the llvm-dev mailing list