| 201 | } |
| 202 | |
| 203 | Value* ModuleBuilder::GetPointerValue(void* ptr) const { |
| 204 | CHECK_EQ(state_, kBuilding); |
| 205 | // No direct way of creating constant pointer values in LLVM, so |
| 206 | // first a constant int has to be created and then casted to a pointer |
| 207 | IntegerType* llvm_uintptr_t = Type::getIntNTy(*context_, 8 * sizeof(ptr)); |
| 208 | uintptr_t int_value = reinterpret_cast<uintptr_t>(ptr); |
| 209 | ConstantInt* llvm_int_value = ConstantInt::get(llvm_uintptr_t, |
| 210 | int_value, false); |
| 211 | Type* llvm_ptr_t = Type::getInt8PtrTy(*context_); |
| 212 | return ConstantExpr::getIntToPtr(llvm_int_value, llvm_ptr_t); |
| 213 | } |
| 214 | |
| 215 | |
| 216 | void ModuleBuilder::AddJITPromise(llvm::Function* llvm_f, |