| 403 | } |
| 404 | |
| 405 | Value* ConvertFirstToSecond(Value *V, TypeInfo *firstType, TypeInfo *secondType) |
| 406 | { |
| 407 | asmDataType fDT = firstType->dataType, sDT = secondType->dataType; |
| 408 | asmStackType first = stackTypeForDataType(fDT), second = stackTypeForDataType(sDT); |
| 409 | if(second == STYPE_DOUBLE) |
| 410 | { |
| 411 | if(first == STYPE_INT) |
| 412 | return Builder.CreateSIToFP(V, (Type*)secondType->llvmType, "tmp_itod"); |
| 413 | else if(first == STYPE_LONG) |
| 414 | return Builder.CreateSIToFP(V, (Type*)secondType->llvmType, "tmp_ltod"); |
| 415 | else if(fDT != sDT) |
| 416 | return Builder.CreateFPCast(V, (Type*)secondType->llvmType, "tmp_fpcast"); |
| 417 | }else if(second == STYPE_LONG){ |
| 418 | if(first == STYPE_INT) |
| 419 | return Builder.CreateIntCast(V, (Type*)secondType->llvmType, true, "tmp_itol"); |
| 420 | else if(first == STYPE_DOUBLE) |
| 421 | return Builder.CreateFPToSI(V, (Type*)secondType->llvmType, "tmp_dtol"); |
| 422 | else if(fDT != sDT) |
| 423 | return Builder.CreateIntCast(V, (Type*)secondType->llvmType, true, "tmp_lcast"); |
| 424 | }else if(second == STYPE_INT){ |
| 425 | if(first == STYPE_DOUBLE) |
| 426 | return Builder.CreateFPToSI(V, (Type*)secondType->llvmType, "tmp_dtoi"); |
| 427 | else if(first == STYPE_LONG) |
| 428 | return Builder.CreateIntCast(V, (Type*)secondType->llvmType, true, "tmp_ltoi"); |
| 429 | else if(fDT != sDT) |
| 430 | return Builder.CreateIntCast(V, (Type*)secondType->llvmType, true, "tmp_icast"); |
| 431 | } |
| 432 | return V; |
| 433 | } |
| 434 | |
| 435 | Value* ConvertFirstForSecond(Value *V, TypeInfo *firstType, TypeInfo *secondType) |
| 436 | { |
no test coverage detected