public LLVMValueRef ToLLVMValueRef(LLVMModuleRef module) { LLVMValueRef valRef = IsFunction ? module.GetNamedFunction(SymbolName) : module.GetNamedGlobal(SymbolName); if (Offset != 0 && valRef.Handle != IntPtr.Zero) { var CreatePointer = LLVMTypeRef.CreatePointer(LLVMTypeRef.Int8, 0); var bitCast = LLVMValueRef.CreateConstBitCast(valRef, CreatePointer); LLVMValueRef[] index = new LLVMValueRef[] { LLVMValueRef.CreateConstInt(LLVMTypeRef.Int32, Offset, false) }; valRef = LLVMValueRef.CreateConstGEP(bitCast, index); } return(valRef); }