How to load a data from the address of unsiged long type

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

Hi Michael,

Now I have an address that present in a unsigned long address like the
following format:
Value* addr = CONST(0xc0008000)

what is the type of addr? For that matter, what is CONST - what does it do?

Ciao, Duncan.

Hi Michael,

Now I have an address that present in a unsigned long address like the
following format:
Value* addr = CONST(0xc0008000)

what is the type of addr? For that matter, what is CONST - what does it do?

Ciao, Duncan.

I forget to interpret the CONST macro .It is defined as the following:

ConstantInt::get(getIntegerType(s), v)

It is used to transform a C language int type to llvm Integer type.

Thanks
MK