[LLVMdev] How to load a data from the address of unsiged long type
Michael.Kang
blackfin.kang at gmail.com
Mon Mar 14 02:09:03 PDT 2011
Now I have an address that present in a unsigned long address like the
following format:
Value* addr = CONST(0xc0008000)
But I do not know how to read the data from the above addr varaible. I
tried the following three kind of code:
1. Code:
Value* addr = CONST(0xc0008000);
Value* data = new LoadInst(addr, "", false, bb);
Error:
Segmentation fault
2. Code( use BotVastInst to vern):
Value* addr = CONST(0xc0008000);
a = new BitCastInst(a, PointerType::get(XgetType(Int32Ty), 0), "", bb);
Value* data = new LoadInst(addr, "", false, bb);
Error:
Bitcast requires types of same width
3. Code:
Type const *intptr_type =
cpu->dyncom_engine->exec_engine->getTargetData()->getIntPtrType(_CTX());
Value* ptr = new IntToPtrInst(a, intptr_type, "", bb);
Value* data = new LoadInst(ptr, "", false, bb);
Error:
Segmentation fault
Any person can give me some hints for my case?
Thanks
MK
--
www.skyeye.org
More information about the llvm-dev
mailing list