From bded0d999a1ece0178e631bf75f788e720036fe0 Mon Sep 17 00:00:00 2001 From: Emil Lenngren Date: Tue, 26 Jun 2012 21:08:37 +0000 Subject: [PATCH] [GB.JIT] * BUG: Maybe fix reading global boolean variables. git-svn-id: svn://localhost/gambas/trunk@4862 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.jit/src/jit_codegen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gb.jit/src/jit_codegen.cpp b/gb.jit/src/jit_codegen.cpp index 92017dd5e..6ebf3c9e7 100644 --- a/gb.jit/src/jit_codegen.cpp +++ b/gb.jit/src/jit_codegen.cpp @@ -1327,7 +1327,9 @@ llvm::Value* PushLastExpression::codegen_get_value(){ static llvm::Value* read_variable(TYPE type, char* addr){ llvm::Value* ret; - if (type < T_STRING || type == T_POINTER) + if (type == T_BOOLEAN) + ret = builder->CreateTrunc(read_global(addr, llvmType(getInt8Ty)), llvmType(getInt1Ty)); + else if (type < T_STRING || type == T_POINTER) ret = read_global(addr, TYPE_llvm(type)); else if (type == T_STRING){ llvm::Value* ad = read_global(addr); @@ -1394,7 +1396,9 @@ llvm::Value* ReadVariableExpression::codegen_get_value(){ //FIXME this is almost same as array_read, only difference is in variant static llvm::Value* read_variable(TYPE type, llvm::Value* addr){ llvm::Value* ret; - if (type < T_STRING || type == T_POINTER) + if (type == T_BOOLEAN) + ret = builder->CreateTrunc(builder->CreateLoad(builder->CreateBitCast(addr, llvmType(getInt8PtrTy))), llvmType(getInt1Ty)); + else if (type < T_STRING || type == T_POINTER) ret = builder->CreateLoad(builder->CreateBitCast(addr, pointer_t(TYPE_llvm(type)))); else if (type == T_STRING){ llvm::Value* ad = builder->CreateLoad(builder->CreateBitCast(addr, charPP));