| 1163 | } |
| 1164 | |
| 1165 | Value* GenerateCompareToZero(Value *V, TypeInfo *typeInfo) |
| 1166 | { |
| 1167 | Value *zeroV = ConstantInt::get(getGlobalContext(), APInt(32, 0, true)); |
| 1168 | if(typeInfo == typeObject) |
| 1169 | { |
| 1170 | DUMP(V->getType()); |
| 1171 | Value *arrTemp = CreateEntryBlockAlloca(F, "autoref_tmp", V->getType()); |
| 1172 | DUMP(arrTemp->getType()); |
| 1173 | Builder.CreateStore(V, arrTemp); |
| 1174 | |
| 1175 | V = Builder.CreateStructGEP(arrTemp, 1, "autoref_ptr"); |
| 1176 | DUMP(V->getType()); |
| 1177 | V = Builder.CreateLoad(V); |
| 1178 | DUMP(V->getType()); |
| 1179 | V = Builder.CreatePtrToInt(V, Type::getInt32Ty(getGlobalContext()), "as_int"); |
| 1180 | DUMP(V->getType()); |
| 1181 | }else if(typeInfo->refLevel){ |
| 1182 | DUMP(V->getType()); |
| 1183 | zeroV = ConstantPointerNull::get((PointerType*)V->getType()); |
| 1184 | }else if(typeInfo != typeInt){ |
| 1185 | DUMP(V->getType()); |
| 1186 | V = PromoteToStackType(V, typeInfo); |
| 1187 | DUMP(V->getType()); |
| 1188 | V = Builder.CreateIntCast(V, Type::getInt32Ty(getGlobalContext()), true, "as_int"); |
| 1189 | DUMP(V->getType()); |
| 1190 | } |
| 1191 | return Builder.CreateICmpNE(V, zeroV, "cond_value"); |
| 1192 | } |
| 1193 | |
| 1194 | void NodeIfElseExpr::CompileLLVM() |
| 1195 | { |
no test coverage detected