| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "OpRuleConversionManager.h" | ||
| 4 | |||
| 5 | #include <llvm/IR/Module.h> | ||
| 6 | |||
| 7 | #include <SourceFile.h> | ||
| 8 | #include <ast/ASTNodes.h> | ||
| 9 | #include <driver/Driver.h> | ||
| 10 | #include <global/GlobalResourceManager.h> | ||
| 11 | #include <irgenerator/IRGenerator.h> | ||
| 12 | #include <symboltablebuilder/Scope.h> | ||
| 13 | |||
| 14 | namespace spice::compiler { | ||
| 15 | |||
| 16 | 891 | OpRuleConversionManager::OpRuleConversionManager(SourceFile *sourceFile, IRGenerator *irGenerator) | |
| 17 |
2/2✓ Branch 0 (2→3) taken 2 times.
✓ Branch 1 (2→4) taken 889 times.
|
891 | : context(irGenerator->cliOptions.useLTO ? irGenerator->resourceManager.ltoContext : sourceFile->context), |
| 18 | 891 | builder(sourceFile->builder), irGenerator(irGenerator), stdFunctionManager(irGenerator->stdFunctionManager) {} | |
| 19 | |||
| 20 | 243 | LLVMExprResult OpRuleConversionManager::getPlusEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 21 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 22 |
1/2✓ Branch 0 (2→3) taken 243 times.
✗ Branch 1 (2→151) not taken.
|
389 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 23 |
1/2✓ Branch 0 (3→4) taken 243 times.
✗ Branch 1 (3→152) not taken.
|
399 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 24 | 340 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 25 | 330 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 26 |
1/2✓ Branch 0 (6→7) taken 243 times.
✗ Branch 1 (6→153) not taken.
|
243 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 27 |
1/2✓ Branch 0 (7→8) taken 243 times.
✗ Branch 1 (7→154) not taken.
|
243 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 28 |
1/2✓ Branch 0 (8→9) taken 243 times.
✗ Branch 1 (8→189) not taken.
|
243 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 29 | |||
| 30 | // Handle operator overloads | ||
| 31 |
3/4✓ Branch 0 (9→10) taken 243 times.
✗ Branch 1 (9→189) not taken.
✓ Branch 2 (10→11) taken 97 times.
✓ Branch 3 (10→19) taken 146 times.
|
243 | if (callsOverloadedOpFct(node, opIdx)) |
| 32 | 97 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 33 | |||
| 34 |
7/12✓ Branch 0 (19→20) taken 146 times.
✗ Branch 1 (19→189) not taken.
✓ Branch 2 (20→21) taken 21 times.
✓ Branch 3 (20→27) taken 17 times.
✓ Branch 4 (20→39) taken 7 times.
✗ Branch 5 (20→54) not taken.
✗ Branch 6 (20→69) not taken.
✗ Branch 7 (20→81) not taken.
✓ Branch 8 (20→96) taken 5 times.
✓ Branch 9 (20→111) taken 95 times.
✓ Branch 10 (20→123) taken 1 times.
✗ Branch 11 (20→137) not taken.
|
146 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 35 | 21 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 36 |
4/8✓ Branch 0 (21→22) taken 21 times.
✗ Branch 1 (21→163) not taken.
✓ Branch 2 (22→23) taken 21 times.
✗ Branch 3 (22→163) not taken.
✓ Branch 4 (23→24) taken 21 times.
✗ Branch 5 (23→163) not taken.
✓ Branch 6 (24→25) taken 21 times.
✗ Branch 7 (24→163) not taken.
|
21 | return {.value = builder.CreateFAdd(lhsV(), rhsV())}; |
| 37 | 17 | case COMB(TY_INT, TY_INT): | |
| 38 |
8/16✓ Branch 0 (27→28) taken 17 times.
✗ Branch 1 (27→189) not taken.
✓ Branch 2 (28→29) taken 17 times.
✗ Branch 3 (28→32) not taken.
✓ Branch 4 (29→30) taken 17 times.
✗ Branch 5 (29→189) not taken.
✓ Branch 6 (30→31) taken 17 times.
✗ Branch 7 (30→32) not taken.
✓ Branch 8 (33→34) taken 17 times.
✗ Branch 9 (33→164) not taken.
✓ Branch 10 (34→35) taken 17 times.
✗ Branch 11 (34→164) not taken.
✓ Branch 12 (35→36) taken 17 times.
✗ Branch 13 (35→164) not taken.
✓ Branch 14 (36→37) taken 17 times.
✗ Branch 15 (36→164) not taken.
|
17 | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 39 | 7 | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 40 | case COMB(TY_INT, TY_LONG): { | ||
| 41 |
4/8✓ Branch 0 (39→40) taken 7 times.
✗ Branch 1 (39→165) not taken.
✓ Branch 2 (40→41) taken 7 times.
✗ Branch 3 (40→165) not taken.
✓ Branch 4 (41→42) taken 7 times.
✗ Branch 5 (41→165) not taken.
✓ Branch 6 (42→43) taken 7 times.
✗ Branch 7 (42→165) not taken.
|
7 | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 42 |
7/14✓ Branch 0 (43→44) taken 7 times.
✗ Branch 1 (43→189) not taken.
✓ Branch 2 (44→45) taken 7 times.
✗ Branch 3 (44→48) not taken.
✓ Branch 4 (45→46) taken 7 times.
✗ Branch 5 (45→189) not taken.
✓ Branch 6 (46→47) taken 7 times.
✗ Branch 7 (46→48) not taken.
✓ Branch 8 (49→50) taken 7 times.
✗ Branch 9 (49→166) not taken.
✓ Branch 10 (50→51) taken 7 times.
✗ Branch 11 (50→166) not taken.
✓ Branch 12 (51→52) taken 7 times.
✗ Branch 13 (51→166) not taken.
|
7 | return {.value = builder.CreateAdd(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 43 | } | ||
| 44 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 45 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 46 | ✗ | return {.value = builder.CreateAdd(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 47 | } | ||
| 48 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 49 | ✗ | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 50 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 51 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 52 | ✗ | return {.value = builder.CreateAdd(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 53 | } | ||
| 54 | 5 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 55 | case COMB(TY_LONG, TY_SHORT): { | ||
| 56 |
4/8✓ Branch 0 (96→97) taken 5 times.
✗ Branch 1 (96→172) not taken.
✓ Branch 2 (97→98) taken 5 times.
✗ Branch 3 (97→172) not taken.
✓ Branch 4 (98→99) taken 5 times.
✗ Branch 5 (98→172) not taken.
✓ Branch 6 (99→100) taken 5 times.
✗ Branch 7 (99→172) not taken.
|
5 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 57 |
8/14✓ Branch 0 (100→101) taken 5 times.
✗ Branch 1 (100→189) not taken.
✓ Branch 2 (101→102) taken 1 times.
✓ Branch 3 (101→105) taken 4 times.
✓ Branch 4 (102→103) taken 1 times.
✗ Branch 5 (102→189) not taken.
✗ Branch 6 (103→104) not taken.
✓ Branch 7 (103→105) taken 1 times.
✓ Branch 8 (106→107) taken 5 times.
✗ Branch 9 (106→173) not taken.
✓ Branch 10 (107→108) taken 5 times.
✗ Branch 11 (107→173) not taken.
✓ Branch 12 (108→109) taken 5 times.
✗ Branch 13 (108→173) not taken.
|
5 | return {.value = builder.CreateAdd(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 58 | } | ||
| 59 | 95 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 60 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 61 | case COMB(TY_CHAR, TY_CHAR): | ||
| 62 |
9/16✓ Branch 0 (111→112) taken 95 times.
✗ Branch 1 (111→189) not taken.
✓ Branch 2 (112→113) taken 4 times.
✓ Branch 3 (112→116) taken 91 times.
✓ Branch 4 (113→114) taken 4 times.
✗ Branch 5 (113→189) not taken.
✓ Branch 6 (114→115) taken 4 times.
✗ Branch 7 (114→116) not taken.
✓ Branch 8 (117→118) taken 95 times.
✗ Branch 9 (117→174) not taken.
✓ Branch 10 (118→119) taken 95 times.
✗ Branch 11 (118→174) not taken.
✓ Branch 12 (119→120) taken 95 times.
✗ Branch 13 (119→174) not taken.
✓ Branch 14 (120→121) taken 95 times.
✗ Branch 15 (120→174) not taken.
|
95 | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 63 | 1 | case COMB(TY_PTR, TY_INT): // fallthrough | |
| 64 | case COMB(TY_PTR, TY_SHORT): // fallthrough | ||
| 65 | case COMB(TY_PTR, TY_LONG): { | ||
| 66 |
2/4✓ Branch 0 (123→124) taken 1 times.
✗ Branch 1 (123→175) not taken.
✓ Branch 2 (124→125) taken 1 times.
✗ Branch 3 (124→175) not taken.
|
1 | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); |
| 67 |
5/10✓ Branch 0 (125→126) taken 1 times.
✗ Branch 1 (125→176) not taken.
✓ Branch 2 (126→127) taken 1 times.
✗ Branch 3 (126→176) not taken.
✓ Branch 4 (127→128) taken 1 times.
✗ Branch 5 (127→176) not taken.
✓ Branch 6 (128→129) taken 1 times.
✗ Branch 7 (128→176) not taken.
✓ Branch 8 (129→130) taken 1 times.
✗ Branch 9 (129→176) not taken.
|
1 | llvm::Value *rhsVExt = builder.CreateIntCast(rhsV(), builder.getInt64Ty(), rhsSTy.isSigned()); |
| 68 |
3/6✓ Branch 0 (131→132) taken 1 times.
✗ Branch 1 (131→178) not taken.
✓ Branch 2 (133→134) taken 1 times.
✗ Branch 3 (133→177) not taken.
✓ Branch 4 (134→135) taken 1 times.
✗ Branch 5 (134→177) not taken.
|
1 | return {.value = builder.CreateGEP(elementTy, lhsV(), rhsVExt)}; |
| 69 | } | ||
| 70 | − | default: // GCOV_EXCL_LINE | |
| 71 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: +="); // GCOV_EXCL_LINE | |
| 72 | } | ||
| 73 |
5/14✓ Branch 0 (11→12) taken 97 times.
✗ Branch 1 (11→157) not taken.
✓ Branch 2 (12→13) taken 97 times.
✗ Branch 3 (12→157) not taken.
✓ Branch 4 (13→14) taken 97 times.
✗ Branch 5 (13→157) not taken.
✓ Branch 6 (14→15) taken 97 times.
✗ Branch 7 (14→157) not taken.
✓ Branch 8 (15→16) taken 97 times.
✗ Branch 9 (15→155) not taken.
✗ Branch 10 (157→158) not taken.
✗ Branch 11 (157→161) not taken.
✗ Branch 12 (159→160) not taken.
✗ Branch 13 (159→161) not taken.
|
340 | } |
| 74 | |||
| 75 | 32 | LLVMExprResult OpRuleConversionManager::getMinusEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 76 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 77 |
1/2✓ Branch 0 (2→3) taken 32 times.
✗ Branch 1 (2→153) not taken.
|
57 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 78 |
1/2✓ Branch 0 (3→4) taken 32 times.
✗ Branch 1 (3→154) not taken.
|
64 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 79 | 39 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 80 | 32 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 81 |
1/2✓ Branch 0 (6→7) taken 32 times.
✗ Branch 1 (6→155) not taken.
|
32 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 82 |
1/2✓ Branch 0 (7→8) taken 32 times.
✗ Branch 1 (7→156) not taken.
|
32 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 83 |
1/2✓ Branch 0 (8→9) taken 32 times.
✗ Branch 1 (8→192) not taken.
|
32 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 84 | |||
| 85 | // Handle operator overloads | ||
| 86 |
3/4✓ Branch 0 (9→10) taken 32 times.
✗ Branch 1 (9→192) not taken.
✓ Branch 2 (10→11) taken 7 times.
✓ Branch 3 (10→19) taken 25 times.
|
32 | if (callsOverloadedOpFct(node, opIdx)) |
| 87 | 7 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 88 | |||
| 89 |
8/12✓ Branch 0 (19→20) taken 25 times.
✗ Branch 1 (19→192) not taken.
✓ Branch 2 (20→21) taken 2 times.
✓ Branch 3 (20→27) taken 4 times.
✓ Branch 4 (20→39) taken 2 times.
✗ Branch 5 (20→54) not taken.
✓ Branch 6 (20→69) taken 2 times.
✗ Branch 7 (20→81) not taken.
✓ Branch 8 (20→96) taken 8 times.
✓ Branch 9 (20→111) taken 6 times.
✓ Branch 10 (20→123) taken 1 times.
✗ Branch 11 (20→139) not taken.
|
25 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 90 | 2 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 91 |
4/8✓ Branch 0 (21→22) taken 2 times.
✗ Branch 1 (21→165) not taken.
✓ Branch 2 (22→23) taken 2 times.
✗ Branch 3 (22→165) not taken.
✓ Branch 4 (23→24) taken 2 times.
✗ Branch 5 (23→165) not taken.
✓ Branch 6 (24→25) taken 2 times.
✗ Branch 7 (24→165) not taken.
|
2 | return {.value = builder.CreateFSub(lhsV(), rhsV())}; |
| 92 | 4 | case COMB(TY_INT, TY_INT): | |
| 93 |
8/16✓ Branch 0 (27→28) taken 4 times.
✗ Branch 1 (27→192) not taken.
✓ Branch 2 (28→29) taken 4 times.
✗ Branch 3 (28→32) not taken.
✓ Branch 4 (29→30) taken 4 times.
✗ Branch 5 (29→192) not taken.
✓ Branch 6 (30→31) taken 4 times.
✗ Branch 7 (30→32) not taken.
✓ Branch 8 (33→34) taken 4 times.
✗ Branch 9 (33→166) not taken.
✓ Branch 10 (34→35) taken 4 times.
✗ Branch 11 (34→166) not taken.
✓ Branch 12 (35→36) taken 4 times.
✗ Branch 13 (35→166) not taken.
✓ Branch 14 (36→37) taken 4 times.
✗ Branch 15 (36→166) not taken.
|
4 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 94 | 2 | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 95 | case COMB(TY_INT, TY_LONG): { | ||
| 96 |
4/8✓ Branch 0 (39→40) taken 2 times.
✗ Branch 1 (39→167) not taken.
✓ Branch 2 (40→41) taken 2 times.
✗ Branch 3 (40→167) not taken.
✓ Branch 4 (41→42) taken 2 times.
✗ Branch 5 (41→167) not taken.
✓ Branch 6 (42→43) taken 2 times.
✗ Branch 7 (42→167) not taken.
|
2 | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 97 |
7/14✓ Branch 0 (43→44) taken 2 times.
✗ Branch 1 (43→192) not taken.
✓ Branch 2 (44→45) taken 2 times.
✗ Branch 3 (44→48) not taken.
✓ Branch 4 (45→46) taken 2 times.
✗ Branch 5 (45→192) not taken.
✓ Branch 6 (46→47) taken 2 times.
✗ Branch 7 (46→48) not taken.
✓ Branch 8 (49→50) taken 2 times.
✗ Branch 9 (49→168) not taken.
✓ Branch 10 (50→51) taken 2 times.
✗ Branch 11 (50→168) not taken.
✓ Branch 12 (51→52) taken 2 times.
✗ Branch 13 (51→168) not taken.
|
2 | return {.value = builder.CreateSub(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 98 | } | ||
| 99 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 100 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 101 | ✗ | return {.value = builder.CreateSub(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 102 | } | ||
| 103 | 2 | case COMB(TY_SHORT, TY_SHORT): | |
| 104 |
8/16✓ Branch 0 (69→70) taken 2 times.
✗ Branch 1 (69→192) not taken.
✓ Branch 2 (70→71) taken 2 times.
✗ Branch 3 (70→74) not taken.
✓ Branch 4 (71→72) taken 2 times.
✗ Branch 5 (71→192) not taken.
✓ Branch 6 (72→73) taken 2 times.
✗ Branch 7 (72→74) not taken.
✓ Branch 8 (75→76) taken 2 times.
✗ Branch 9 (75→171) not taken.
✓ Branch 10 (76→77) taken 2 times.
✗ Branch 11 (76→171) not taken.
✓ Branch 12 (77→78) taken 2 times.
✗ Branch 13 (77→171) not taken.
✓ Branch 14 (78→79) taken 2 times.
✗ Branch 15 (78→171) not taken.
|
2 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 105 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 106 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 107 | ✗ | return {.value = builder.CreateSub(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 108 | } | ||
| 109 | 8 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 110 | case COMB(TY_LONG, TY_SHORT): { | ||
| 111 |
4/8✓ Branch 0 (96→97) taken 8 times.
✗ Branch 1 (96→174) not taken.
✓ Branch 2 (97→98) taken 8 times.
✗ Branch 3 (97→174) not taken.
✓ Branch 4 (98→99) taken 8 times.
✗ Branch 5 (98→174) not taken.
✓ Branch 6 (99→100) taken 8 times.
✗ Branch 7 (99→174) not taken.
|
8 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 112 |
8/14✓ Branch 0 (100→101) taken 8 times.
✗ Branch 1 (100→192) not taken.
✓ Branch 2 (101→102) taken 4 times.
✓ Branch 3 (101→105) taken 4 times.
✓ Branch 4 (102→103) taken 4 times.
✗ Branch 5 (102→192) not taken.
✓ Branch 6 (103→104) taken 4 times.
✗ Branch 7 (103→105) not taken.
✓ Branch 8 (106→107) taken 8 times.
✗ Branch 9 (106→175) not taken.
✓ Branch 10 (107→108) taken 8 times.
✗ Branch 11 (107→175) not taken.
✓ Branch 12 (108→109) taken 8 times.
✗ Branch 13 (108→175) not taken.
|
8 | return {.value = builder.CreateSub(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 113 | } | ||
| 114 | 6 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 115 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 116 | case COMB(TY_CHAR, TY_CHAR): | ||
| 117 |
9/16✓ Branch 0 (111→112) taken 6 times.
✗ Branch 1 (111→192) not taken.
✓ Branch 2 (112→113) taken 4 times.
✓ Branch 3 (112→116) taken 2 times.
✓ Branch 4 (113→114) taken 4 times.
✗ Branch 5 (113→192) not taken.
✓ Branch 6 (114→115) taken 4 times.
✗ Branch 7 (114→116) not taken.
✓ Branch 8 (117→118) taken 6 times.
✗ Branch 9 (117→176) not taken.
✓ Branch 10 (118→119) taken 6 times.
✗ Branch 11 (118→176) not taken.
✓ Branch 12 (119→120) taken 6 times.
✗ Branch 13 (119→176) not taken.
✓ Branch 14 (120→121) taken 6 times.
✗ Branch 15 (120→176) not taken.
|
6 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 118 | 1 | case COMB(TY_PTR, TY_INT): // fallthrough | |
| 119 | case COMB(TY_PTR, TY_SHORT): // fallthrough | ||
| 120 | case COMB(TY_PTR, TY_LONG): { | ||
| 121 |
2/4✓ Branch 0 (123→124) taken 1 times.
✗ Branch 1 (123→177) not taken.
✓ Branch 2 (124→125) taken 1 times.
✗ Branch 3 (124→177) not taken.
|
1 | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); |
| 122 |
5/10✓ Branch 0 (125→126) taken 1 times.
✗ Branch 1 (125→178) not taken.
✓ Branch 2 (126→127) taken 1 times.
✗ Branch 3 (126→178) not taken.
✓ Branch 4 (127→128) taken 1 times.
✗ Branch 5 (127→178) not taken.
✓ Branch 6 (128→129) taken 1 times.
✗ Branch 7 (128→178) not taken.
✓ Branch 8 (129→130) taken 1 times.
✗ Branch 9 (129→178) not taken.
|
1 | llvm::Value *rhsVExt = builder.CreateIntCast(rhsV(), builder.getInt64Ty(), rhsSTy.isSigned()); |
| 123 |
2/4✓ Branch 0 (130→131) taken 1 times.
✗ Branch 1 (130→179) not taken.
✓ Branch 2 (131→132) taken 1 times.
✗ Branch 3 (131→179) not taken.
|
1 | llvm::Value *rhsVNeg = builder.CreateNeg(rhsVExt); |
| 124 |
3/6✓ Branch 0 (133→134) taken 1 times.
✗ Branch 1 (133→181) not taken.
✓ Branch 2 (135→136) taken 1 times.
✗ Branch 3 (135→180) not taken.
✓ Branch 4 (136→137) taken 1 times.
✗ Branch 5 (136→180) not taken.
|
1 | return {.value = builder.CreateGEP(elementTy, lhsV(), rhsVNeg)}; |
| 125 | } | ||
| 126 | − | default: // GCOV_EXCL_LINE | |
| 127 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: -="); // GCOV_EXCL_LINE | |
| 128 | } | ||
| 129 |
5/14✓ Branch 0 (11→12) taken 7 times.
✗ Branch 1 (11→159) not taken.
✓ Branch 2 (12→13) taken 7 times.
✗ Branch 3 (12→159) not taken.
✓ Branch 4 (13→14) taken 7 times.
✗ Branch 5 (13→159) not taken.
✓ Branch 6 (14→15) taken 7 times.
✗ Branch 7 (14→159) not taken.
✓ Branch 8 (15→16) taken 7 times.
✗ Branch 9 (15→157) not taken.
✗ Branch 10 (159→160) not taken.
✗ Branch 11 (159→163) not taken.
✗ Branch 12 (161→162) not taken.
✗ Branch 13 (161→163) not taken.
|
39 | } |
| 130 | |||
| 131 | 39 | LLVMExprResult OpRuleConversionManager::getMulEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 132 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 133 |
1/2✓ Branch 0 (2→3) taken 39 times.
✗ Branch 1 (2→137) not taken.
|
76 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 134 |
1/2✓ Branch 0 (3→4) taken 39 times.
✗ Branch 1 (3→138) not taken.
|
78 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 135 | 41 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 136 | 39 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 137 |
1/2✓ Branch 0 (6→7) taken 39 times.
✗ Branch 1 (6→139) not taken.
|
39 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 138 |
1/2✓ Branch 0 (7→8) taken 39 times.
✗ Branch 1 (7→140) not taken.
|
39 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 139 |
1/2✓ Branch 0 (8→9) taken 39 times.
✗ Branch 1 (8→170) not taken.
|
39 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 140 | |||
| 141 | // Handle operator overloads | ||
| 142 |
3/4✓ Branch 0 (9→10) taken 39 times.
✗ Branch 1 (9→170) not taken.
✓ Branch 2 (10→11) taken 2 times.
✓ Branch 3 (10→19) taken 37 times.
|
39 | if (callsOverloadedOpFct(node, opIdx)) |
| 143 | 2 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 144 | |||
| 145 |
5/11✓ Branch 0 (19→20) taken 37 times.
✗ Branch 1 (19→170) not taken.
✓ Branch 2 (20→21) taken 12 times.
✓ Branch 3 (20→27) taken 1 times.
✓ Branch 4 (20→39) taken 2 times.
✗ Branch 5 (20→54) not taken.
✗ Branch 6 (20→69) not taken.
✗ Branch 7 (20→81) not taken.
✗ Branch 8 (20→96) not taken.
✓ Branch 9 (20→111) taken 22 times.
✗ Branch 10 (20→123) not taken.
|
37 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 146 | 12 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 147 |
4/8✓ Branch 0 (21→22) taken 12 times.
✗ Branch 1 (21→149) not taken.
✓ Branch 2 (22→23) taken 12 times.
✗ Branch 3 (22→149) not taken.
✓ Branch 4 (23→24) taken 12 times.
✗ Branch 5 (23→149) not taken.
✓ Branch 6 (24→25) taken 12 times.
✗ Branch 7 (24→149) not taken.
|
12 | return {.value = builder.CreateFMul(lhsV(), rhsV())}; |
| 148 | 1 | case COMB(TY_INT, TY_INT): | |
| 149 |
8/16✓ Branch 0 (27→28) taken 1 times.
✗ Branch 1 (27→170) not taken.
✓ Branch 2 (28→29) taken 1 times.
✗ Branch 3 (28→32) not taken.
✓ Branch 4 (29→30) taken 1 times.
✗ Branch 5 (29→170) not taken.
✓ Branch 6 (30→31) taken 1 times.
✗ Branch 7 (30→32) not taken.
✓ Branch 8 (33→34) taken 1 times.
✗ Branch 9 (33→150) not taken.
✓ Branch 10 (34→35) taken 1 times.
✗ Branch 11 (34→150) not taken.
✓ Branch 12 (35→36) taken 1 times.
✗ Branch 13 (35→150) not taken.
✓ Branch 14 (36→37) taken 1 times.
✗ Branch 15 (36→150) not taken.
|
1 | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 150 | 2 | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 151 | case COMB(TY_INT, TY_LONG): { | ||
| 152 |
4/8✓ Branch 0 (39→40) taken 2 times.
✗ Branch 1 (39→151) not taken.
✓ Branch 2 (40→41) taken 2 times.
✗ Branch 3 (40→151) not taken.
✓ Branch 4 (41→42) taken 2 times.
✗ Branch 5 (41→151) not taken.
✓ Branch 6 (42→43) taken 2 times.
✗ Branch 7 (42→151) not taken.
|
2 | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 153 |
7/14✓ Branch 0 (43→44) taken 2 times.
✗ Branch 1 (43→170) not taken.
✓ Branch 2 (44→45) taken 2 times.
✗ Branch 3 (44→48) not taken.
✓ Branch 4 (45→46) taken 2 times.
✗ Branch 5 (45→170) not taken.
✓ Branch 6 (46→47) taken 2 times.
✗ Branch 7 (46→48) not taken.
✓ Branch 8 (49→50) taken 2 times.
✗ Branch 9 (49→152) not taken.
✓ Branch 10 (50→51) taken 2 times.
✗ Branch 11 (50→152) not taken.
✓ Branch 12 (51→52) taken 2 times.
✗ Branch 13 (51→152) not taken.
|
2 | return {.value = builder.CreateMul(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 154 | } | ||
| 155 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 156 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 157 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 158 | } | ||
| 159 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 160 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 161 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 162 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 163 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 164 | } | ||
| 165 | ✗ | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 166 | case COMB(TY_LONG, TY_SHORT): { | ||
| 167 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 168 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 169 | } | ||
| 170 | 22 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 171 | case COMB(TY_BYTE, TY_BYTE): | ||
| 172 |
9/16✓ Branch 0 (111→112) taken 22 times.
✗ Branch 1 (111→170) not taken.
✓ Branch 2 (112→113) taken 1 times.
✓ Branch 3 (112→116) taken 21 times.
✓ Branch 4 (113→114) taken 1 times.
✗ Branch 5 (113→170) not taken.
✓ Branch 6 (114→115) taken 1 times.
✗ Branch 7 (114→116) not taken.
✓ Branch 8 (117→118) taken 22 times.
✗ Branch 9 (117→160) not taken.
✓ Branch 10 (118→119) taken 22 times.
✗ Branch 11 (118→160) not taken.
✓ Branch 12 (119→120) taken 22 times.
✗ Branch 13 (119→160) not taken.
✓ Branch 14 (120→121) taken 22 times.
✗ Branch 15 (120→160) not taken.
|
22 | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 173 | − | default: // GCOV_EXCL_LINE | |
| 174 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: *="); // GCOV_EXCL_LINE | |
| 175 | } | ||
| 176 |
5/14✓ Branch 0 (11→12) taken 2 times.
✗ Branch 1 (11→143) not taken.
✓ Branch 2 (12→13) taken 2 times.
✗ Branch 3 (12→143) not taken.
✓ Branch 4 (13→14) taken 2 times.
✗ Branch 5 (13→143) not taken.
✓ Branch 6 (14→15) taken 2 times.
✗ Branch 7 (14→143) not taken.
✓ Branch 8 (15→16) taken 2 times.
✗ Branch 9 (15→141) not taken.
✗ Branch 10 (143→144) not taken.
✗ Branch 11 (143→147) not taken.
✗ Branch 12 (145→146) not taken.
✗ Branch 13 (145→147) not taken.
|
41 | } |
| 177 | |||
| 178 | 44 | LLVMExprResult OpRuleConversionManager::getDivEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 179 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 180 |
1/2✓ Branch 0 (2→3) taken 44 times.
✗ Branch 1 (2→83) not taken.
|
51 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 181 |
1/2✓ Branch 0 (3→4) taken 44 times.
✗ Branch 1 (3→84) not taken.
|
88 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 182 | 81 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 183 | 44 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 184 |
1/2✓ Branch 0 (6→7) taken 44 times.
✗ Branch 1 (6→85) not taken.
|
44 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 185 |
1/2✓ Branch 0 (7→8) taken 44 times.
✗ Branch 1 (7→86) not taken.
|
44 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 186 |
1/2✓ Branch 0 (8→9) taken 44 times.
✗ Branch 1 (8→110) not taken.
|
44 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 187 | |||
| 188 | // Handle operator overloads | ||
| 189 |
3/4✓ Branch 0 (9→10) taken 44 times.
✗ Branch 1 (9→110) not taken.
✓ Branch 2 (10→11) taken 37 times.
✓ Branch 3 (10→19) taken 7 times.
|
44 | if (callsOverloadedOpFct(node, opIdx)) |
| 190 | 37 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 191 | |||
| 192 |
4/11✓ Branch 0 (19→20) taken 7 times.
✗ Branch 1 (19→110) not taken.
✓ Branch 2 (20→21) taken 4 times.
✗ Branch 3 (20→27) not taken.
✓ Branch 4 (20→31) taken 2 times.
✗ Branch 5 (20→38) not taken.
✗ Branch 6 (20→45) not taken.
✗ Branch 7 (20→51) not taken.
✗ Branch 8 (20→58) not taken.
✓ Branch 9 (20→65) taken 1 times.
✗ Branch 10 (20→69) not taken.
|
7 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 193 | 4 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 194 |
4/8✓ Branch 0 (21→22) taken 4 times.
✗ Branch 1 (21→95) not taken.
✓ Branch 2 (22→23) taken 4 times.
✗ Branch 3 (22→95) not taken.
✓ Branch 4 (23→24) taken 4 times.
✗ Branch 5 (23→95) not taken.
✓ Branch 6 (24→25) taken 4 times.
✗ Branch 7 (24→95) not taken.
|
4 | return {.value = builder.CreateFDiv(lhsV(), rhsV())}; |
| 195 | ✗ | case COMB(TY_INT, TY_INT): | |
| 196 | ✗ | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 197 | 2 | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 198 | case COMB(TY_INT, TY_LONG): { | ||
| 199 |
4/8✓ Branch 0 (31→32) taken 2 times.
✗ Branch 1 (31→96) not taken.
✓ Branch 2 (32→33) taken 2 times.
✗ Branch 3 (32→96) not taken.
✓ Branch 4 (33→34) taken 2 times.
✗ Branch 5 (33→96) not taken.
✓ Branch 6 (34→35) taken 2 times.
✗ Branch 7 (34→96) not taken.
|
2 | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 200 |
2/4✓ Branch 0 (35→36) taken 2 times.
✗ Branch 1 (35→110) not taken.
✓ Branch 2 (36→37) taken 2 times.
✗ Branch 3 (36→110) not taken.
|
2 | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsInt)}; |
| 201 | } | ||
| 202 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 203 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 204 | ✗ | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsShort)}; | |
| 205 | } | ||
| 206 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 207 | ✗ | return {.value = builder.CreateSDiv(lhsV(), rhsV())}; | |
| 208 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 209 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 210 | ✗ | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsShort)}; | |
| 211 | } | ||
| 212 | ✗ | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 213 | case COMB(TY_LONG, TY_SHORT): { | ||
| 214 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 215 | ✗ | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsLong)}; | |
| 216 | } | ||
| 217 | 1 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 218 | case COMB(TY_BYTE, TY_BYTE): | ||
| 219 |
3/6✓ Branch 0 (65→66) taken 1 times.
✗ Branch 1 (65→110) not taken.
✓ Branch 2 (66→67) taken 1 times.
✗ Branch 3 (66→110) not taken.
✓ Branch 4 (67→68) taken 1 times.
✗ Branch 5 (67→110) not taken.
|
1 | return {.value = generateDiv(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 220 | − | default: // GCOV_EXCL_LINE | |
| 221 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: /="); // GCOV_EXCL_LINE | |
| 222 | } | ||
| 223 |
5/14✓ Branch 0 (11→12) taken 37 times.
✗ Branch 1 (11→89) not taken.
✓ Branch 2 (12→13) taken 37 times.
✗ Branch 3 (12→89) not taken.
✓ Branch 4 (13→14) taken 37 times.
✗ Branch 5 (13→89) not taken.
✓ Branch 6 (14→15) taken 37 times.
✗ Branch 7 (14→89) not taken.
✓ Branch 8 (15→16) taken 37 times.
✗ Branch 9 (15→87) not taken.
✗ Branch 10 (89→90) not taken.
✗ Branch 11 (89→93) not taken.
✗ Branch 12 (91→92) not taken.
✗ Branch 13 (91→93) not taken.
|
81 | } |
| 224 | |||
| 225 | 5 | LLVMExprResult OpRuleConversionManager::getRemEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 226 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 227 |
1/2✓ Branch 0 (2→3) taken 5 times.
✗ Branch 1 (2→73) not taken.
|
10 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 228 |
1/2✓ Branch 0 (3→4) taken 5 times.
✗ Branch 1 (3→74) not taken.
|
10 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 229 |
1/2✓ Branch 0 (4→5) taken 5 times.
✗ Branch 1 (4→75) not taken.
|
5 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 230 |
1/2✓ Branch 0 (5→6) taken 5 times.
✗ Branch 1 (5→76) not taken.
|
5 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 231 |
1/2✓ Branch 0 (6→7) taken 5 times.
✗ Branch 1 (6→94) not taken.
|
5 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 232 | |||
| 233 |
3/11✓ Branch 0 (7→8) taken 5 times.
✗ Branch 1 (7→94) not taken.
✗ Branch 2 (8→9) not taken.
✓ Branch 3 (8→15) taken 1 times.
✗ Branch 4 (8→21) not taken.
✗ Branch 5 (8→30) not taken.
✗ Branch 6 (8→37) not taken.
✗ Branch 7 (8→43) not taken.
✗ Branch 8 (8→50) not taken.
✓ Branch 9 (8→57) taken 4 times.
✗ Branch 10 (8→61) not taken.
|
5 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 234 | ✗ | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 235 | ✗ | return {.value = builder.CreateFRem(lhsV(), rhsV())}; | |
| 236 | 1 | case COMB(TY_INT, TY_INT): | |
| 237 |
4/8✓ Branch 0 (15→16) taken 1 times.
✗ Branch 1 (15→78) not taken.
✓ Branch 2 (16→17) taken 1 times.
✗ Branch 3 (16→78) not taken.
✓ Branch 4 (17→18) taken 1 times.
✗ Branch 5 (17→78) not taken.
✓ Branch 6 (18→19) taken 1 times.
✗ Branch 7 (18→78) not taken.
|
1 | return {.value = builder.CreateSRem(lhsV(), rhsV())}; |
| 238 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 239 | case COMB(TY_INT, TY_LONG): { | ||
| 240 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 241 | ✗ | return {.value = builder.CreateSRem(lhsV(), rhsInt)}; | |
| 242 | } | ||
| 243 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 244 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 245 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsShort)}; | |
| 246 | } | ||
| 247 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 248 | ✗ | return {.value = builder.CreateSRem(lhsV(), rhsV())}; | |
| 249 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 250 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 251 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsShort)}; | |
| 252 | } | ||
| 253 | ✗ | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 254 | case COMB(TY_LONG, TY_SHORT): { | ||
| 255 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 256 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsLong)}; | |
| 257 | } | ||
| 258 | 4 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 259 | case COMB(TY_BYTE, TY_BYTE): | ||
| 260 |
3/6✓ Branch 0 (57→58) taken 4 times.
✗ Branch 1 (57→94) not taken.
✓ Branch 2 (58→59) taken 4 times.
✗ Branch 3 (58→94) not taken.
✓ Branch 4 (59→60) taken 4 times.
✗ Branch 5 (59→94) not taken.
|
4 | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 261 | − | default: // GCOV_EXCL_LINE | |
| 262 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: %="); // GCOV_EXCL_LINE | |
| 263 | } | ||
| 264 | 5 | } | |
| 265 | |||
| 266 | 1 | LLVMExprResult OpRuleConversionManager::getSHLEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 267 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 268 |
1/2✓ Branch 0 (2→3) taken 1 times.
✗ Branch 1 (2→57) not taken.
|
2 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 269 |
1/2✓ Branch 0 (3→4) taken 1 times.
✗ Branch 1 (3→58) not taken.
|
2 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 270 |
1/2✓ Branch 0 (4→5) taken 1 times.
✗ Branch 1 (4→59) not taken.
|
1 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 271 |
1/2✓ Branch 0 (5→6) taken 1 times.
✗ Branch 1 (5→60) not taken.
|
1 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 272 |
1/2✓ Branch 0 (6→7) taken 1 times.
✗ Branch 1 (6→77) not taken.
|
1 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 273 | |||
| 274 |
2/8✓ Branch 0 (7→8) taken 1 times.
✗ Branch 1 (7→77) not taken.
✓ Branch 2 (8→9) taken 1 times.
✗ Branch 3 (8→15) not taken.
✗ Branch 4 (8→24) not taken.
✗ Branch 5 (8→30) not taken.
✗ Branch 6 (8→39) not taken.
✗ Branch 7 (8→45) not taken.
|
1 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 275 | 1 | case COMB(TY_INT, TY_INT): | |
| 276 |
4/8✓ Branch 0 (9→10) taken 1 times.
✗ Branch 1 (9→61) not taken.
✓ Branch 2 (10→11) taken 1 times.
✗ Branch 3 (10→61) not taken.
✓ Branch 4 (11→12) taken 1 times.
✗ Branch 5 (11→61) not taken.
✓ Branch 6 (12→13) taken 1 times.
✗ Branch 7 (12→61) not taken.
|
1 | return {.value = builder.CreateShl(lhsV(), rhsV())}; |
| 277 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 278 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 279 | case COMB(TY_SHORT, TY_INT): { | ||
| 280 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 281 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsInt)}; | |
| 282 | } | ||
| 283 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 284 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsV())}; | |
| 285 | ✗ | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 286 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 287 | case COMB(TY_LONG, TY_SHORT): { | ||
| 288 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 289 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsLong)}; | |
| 290 | } | ||
| 291 | ✗ | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 292 | case COMB(TY_BYTE, TY_BYTE): | ||
| 293 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsV())}; | |
| 294 | − | default: // GCOV_EXCL_LINE | |
| 295 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <<="); // GCOV_EXCL_LINE | |
| 296 | } | ||
| 297 | 1 | } | |
| 298 | |||
| 299 | 2 | LLVMExprResult OpRuleConversionManager::getSHREqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 300 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 301 |
1/2✓ Branch 0 (2→3) taken 2 times.
✗ Branch 1 (2→49) not taken.
|
4 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 302 |
1/2✓ Branch 0 (3→4) taken 2 times.
✗ Branch 1 (3→50) not taken.
|
4 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 303 |
1/2✓ Branch 0 (4→5) taken 2 times.
✗ Branch 1 (4→51) not taken.
|
2 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 304 |
1/2✓ Branch 0 (5→6) taken 2 times.
✗ Branch 1 (5→52) not taken.
|
2 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 305 |
1/2✓ Branch 0 (6→7) taken 2 times.
✗ Branch 1 (6→65) not taken.
|
2 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 306 | |||
| 307 |
3/8✓ Branch 0 (7→8) taken 2 times.
✗ Branch 1 (7→65) not taken.
✓ Branch 2 (8→9) taken 1 times.
✗ Branch 3 (8→13) not taken.
✗ Branch 4 (8→20) not taken.
✓ Branch 5 (8→26) taken 1 times.
✗ Branch 6 (8→33) not taken.
✗ Branch 7 (8→37) not taken.
|
2 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 308 | 1 | case COMB(TY_INT, TY_INT): | |
| 309 |
3/6✓ Branch 0 (9→10) taken 1 times.
✗ Branch 1 (9→65) not taken.
✓ Branch 2 (10→11) taken 1 times.
✗ Branch 3 (10→65) not taken.
✓ Branch 4 (11→12) taken 1 times.
✗ Branch 5 (11→65) not taken.
|
1 | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 310 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 311 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 312 | case COMB(TY_SHORT, TY_INT): { | ||
| 313 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 314 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 315 | } | ||
| 316 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 317 | ✗ | return {.value = builder.CreateLShr(lhsV(), rhsV())}; | |
| 318 | 1 | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 319 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 320 | case COMB(TY_LONG, TY_SHORT): { | ||
| 321 |
4/8✓ Branch 0 (26→27) taken 1 times.
✗ Branch 1 (26→55) not taken.
✓ Branch 2 (27→28) taken 1 times.
✗ Branch 3 (27→55) not taken.
✓ Branch 4 (28→29) taken 1 times.
✗ Branch 5 (28→55) not taken.
✓ Branch 6 (29→30) taken 1 times.
✗ Branch 7 (29→55) not taken.
|
1 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 322 |
2/4✓ Branch 0 (30→31) taken 1 times.
✗ Branch 1 (30→65) not taken.
✓ Branch 2 (31→32) taken 1 times.
✗ Branch 3 (31→65) not taken.
|
1 | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsLong)}; |
| 323 | } | ||
| 324 | ✗ | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 325 | case COMB(TY_BYTE, TY_BYTE): | ||
| 326 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 327 | − | default: // GCOV_EXCL_LINE | |
| 328 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >>="); // GCOV_EXCL_LINE | |
| 329 | } | ||
| 330 | 2 | } | |
| 331 | |||
| 332 | 1 | LLVMExprResult OpRuleConversionManager::getAndEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 333 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 334 |
1/2✓ Branch 0 (2→3) taken 1 times.
✗ Branch 1 (2→57) not taken.
|
2 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 335 |
1/2✓ Branch 0 (3→4) taken 1 times.
✗ Branch 1 (3→58) not taken.
|
2 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 336 |
1/2✓ Branch 0 (4→5) taken 1 times.
✗ Branch 1 (4→59) not taken.
|
1 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 337 |
1/2✓ Branch 0 (5→6) taken 1 times.
✗ Branch 1 (5→60) not taken.
|
1 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 338 |
1/2✓ Branch 0 (6→7) taken 1 times.
✗ Branch 1 (6→77) not taken.
|
1 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 339 | |||
| 340 |
2/8✓ Branch 0 (7→8) taken 1 times.
✗ Branch 1 (7→77) not taken.
✓ Branch 2 (8→9) taken 1 times.
✗ Branch 3 (8→15) not taken.
✗ Branch 4 (8→24) not taken.
✗ Branch 5 (8→30) not taken.
✗ Branch 6 (8→39) not taken.
✗ Branch 7 (8→45) not taken.
|
1 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 341 | 1 | case COMB(TY_INT, TY_INT): | |
| 342 |
4/8✓ Branch 0 (9→10) taken 1 times.
✗ Branch 1 (9→61) not taken.
✓ Branch 2 (10→11) taken 1 times.
✗ Branch 3 (10→61) not taken.
✓ Branch 4 (11→12) taken 1 times.
✗ Branch 5 (11→61) not taken.
✓ Branch 6 (12→13) taken 1 times.
✗ Branch 7 (12→61) not taken.
|
1 | return {.value = builder.CreateAnd(lhsV(), rhsV())}; |
| 343 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 344 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 345 | case COMB(TY_SHORT, TY_INT): { | ||
| 346 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 347 | ✗ | return {.value = builder.CreateAnd(lhsV(), rhsInt)}; | |
| 348 | } | ||
| 349 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 350 | ✗ | return {.value = builder.CreateAnd(lhsV(), rhsV())}; | |
| 351 | ✗ | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 352 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 353 | case COMB(TY_LONG, TY_SHORT): { | ||
| 354 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 355 | ✗ | return {.value = builder.CreateAnd(lhsV(), rhsLong)}; | |
| 356 | } | ||
| 357 | ✗ | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 358 | case COMB(TY_BYTE, TY_BYTE): | ||
| 359 | ✗ | return {.value = builder.CreateAnd(lhsV(), rhsV())}; | |
| 360 | − | default: // GCOV_EXCL_LINE | |
| 361 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: &="); // GCOV_EXCL_LINE | |
| 362 | } | ||
| 363 | 1 | } | |
| 364 | |||
| 365 | 1 | LLVMExprResult OpRuleConversionManager::getOrEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 366 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 367 |
1/2✓ Branch 0 (2→3) taken 1 times.
✗ Branch 1 (2→57) not taken.
|
2 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 368 |
1/2✓ Branch 0 (3→4) taken 1 times.
✗ Branch 1 (3→58) not taken.
|
2 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 369 |
1/2✓ Branch 0 (4→5) taken 1 times.
✗ Branch 1 (4→59) not taken.
|
1 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 370 |
1/2✓ Branch 0 (5→6) taken 1 times.
✗ Branch 1 (5→60) not taken.
|
1 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 371 |
1/2✓ Branch 0 (6→7) taken 1 times.
✗ Branch 1 (6→77) not taken.
|
1 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 372 | |||
| 373 |
2/8✓ Branch 0 (7→8) taken 1 times.
✗ Branch 1 (7→77) not taken.
✓ Branch 2 (8→9) taken 1 times.
✗ Branch 3 (8→15) not taken.
✗ Branch 4 (8→24) not taken.
✗ Branch 5 (8→30) not taken.
✗ Branch 6 (8→39) not taken.
✗ Branch 7 (8→45) not taken.
|
1 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 374 | 1 | case COMB(TY_INT, TY_INT): | |
| 375 |
4/8✓ Branch 0 (9→10) taken 1 times.
✗ Branch 1 (9→61) not taken.
✓ Branch 2 (10→11) taken 1 times.
✗ Branch 3 (10→61) not taken.
✓ Branch 4 (11→12) taken 1 times.
✗ Branch 5 (11→61) not taken.
✓ Branch 6 (12→13) taken 1 times.
✗ Branch 7 (12→61) not taken.
|
1 | return {.value = builder.CreateOr(lhsV(), rhsV())}; |
| 376 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 377 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 378 | case COMB(TY_SHORT, TY_INT): { | ||
| 379 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 380 | ✗ | return {.value = builder.CreateOr(lhsV(), rhsInt)}; | |
| 381 | } | ||
| 382 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 383 | ✗ | return {.value = builder.CreateOr(lhsV(), rhsV())}; | |
| 384 | ✗ | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 385 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 386 | case COMB(TY_LONG, TY_SHORT): { | ||
| 387 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 388 | ✗ | return {.value = builder.CreateOr(lhsV(), rhsLong)}; | |
| 389 | } | ||
| 390 | ✗ | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 391 | case COMB(TY_BYTE, TY_BYTE): | ||
| 392 | ✗ | return {.value = builder.CreateOr(lhsV(), rhsV())}; | |
| 393 | − | default: // GCOV_EXCL_LINE | |
| 394 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: |="); // GCOV_EXCL_LINE | |
| 395 | } | ||
| 396 | 1 | } | |
| 397 | |||
| 398 | 300 | LLVMExprResult OpRuleConversionManager::getXorEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 399 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 400 |
1/2✓ Branch 0 (2→3) taken 300 times.
✗ Branch 1 (2→57) not taken.
|
600 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 401 |
1/2✓ Branch 0 (3→4) taken 300 times.
✗ Branch 1 (3→58) not taken.
|
600 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 402 |
1/2✓ Branch 0 (4→5) taken 300 times.
✗ Branch 1 (4→59) not taken.
|
300 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 403 |
1/2✓ Branch 0 (5→6) taken 300 times.
✗ Branch 1 (5→60) not taken.
|
300 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 404 |
1/2✓ Branch 0 (6→7) taken 300 times.
✗ Branch 1 (6→77) not taken.
|
300 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 405 | |||
| 406 |
2/8✓ Branch 0 (7→8) taken 300 times.
✗ Branch 1 (7→77) not taken.
✗ Branch 2 (8→9) not taken.
✗ Branch 3 (8→15) not taken.
✗ Branch 4 (8→24) not taken.
✗ Branch 5 (8→30) not taken.
✓ Branch 6 (8→39) taken 300 times.
✗ Branch 7 (8→45) not taken.
|
300 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 407 | ✗ | case COMB(TY_INT, TY_INT): | |
| 408 | ✗ | return {.value = builder.CreateXor(lhsV(), rhsV())}; | |
| 409 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 410 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 411 | case COMB(TY_SHORT, TY_INT): { | ||
| 412 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 413 | ✗ | return {.value = builder.CreateXor(lhsV(), rhsInt)}; | |
| 414 | } | ||
| 415 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 416 | ✗ | return {.value = builder.CreateXor(lhsV(), rhsV())}; | |
| 417 | ✗ | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 418 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 419 | case COMB(TY_LONG, TY_SHORT): { | ||
| 420 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 421 | ✗ | return {.value = builder.CreateXor(lhsV(), rhsLong)}; | |
| 422 | } | ||
| 423 | 300 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 424 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 425 | case COMB(TY_CHAR, TY_CHAR): | ||
| 426 |
4/8✓ Branch 0 (39→40) taken 300 times.
✗ Branch 1 (39→67) not taken.
✓ Branch 2 (40→41) taken 300 times.
✗ Branch 3 (40→67) not taken.
✓ Branch 4 (41→42) taken 300 times.
✗ Branch 5 (41→67) not taken.
✓ Branch 6 (42→43) taken 300 times.
✗ Branch 7 (42→67) not taken.
|
300 | return {.value = builder.CreateXor(lhsV(), rhsV())}; |
| 427 | − | default: // GCOV_EXCL_LINE | |
| 428 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ^="); // GCOV_EXCL_LINE | |
| 429 | } | ||
| 430 | 300 | } | |
| 431 | |||
| 432 | 77 | LLVMExprResult OpRuleConversionManager::getBitwiseOrInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 433 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 434 |
1/2✓ Branch 0 (2→3) taken 77 times.
✗ Branch 1 (2→25) not taken.
|
154 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 435 |
1/2✓ Branch 0 (3→4) taken 77 times.
✗ Branch 1 (3→26) not taken.
|
154 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 436 |
1/2✓ Branch 0 (4→5) taken 77 times.
✗ Branch 1 (4→27) not taken.
|
77 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 437 |
1/2✓ Branch 0 (5→6) taken 77 times.
✗ Branch 1 (5→28) not taken.
|
77 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 438 | |||
| 439 |
2/4✓ Branch 0 (6→7) taken 77 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 77 times.
✗ Branch 3 (7→16) not taken.
|
77 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 440 | 77 | case COMB(TY_INT, TY_INT): // fallthrough | |
| 441 | case COMB(TY_SHORT, TY_SHORT): // fallthrough | ||
| 442 | case COMB(TY_LONG, TY_LONG): // fallthrough | ||
| 443 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 444 | case COMB(TY_BOOL, TY_BOOL): | ||
| 445 |
4/8✓ Branch 0 (8→9) taken 77 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 77 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 77 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 77 times.
✗ Branch 7 (11→29) not taken.
|
154 | return {.value = builder.CreateOr(lhsV(), rhsV())}; |
| 446 | − | default: // GCOV_EXCL_LINE | |
| 447 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: |"); // GCOV_EXCL_LINE | |
| 448 | } | ||
| 449 | 77 | } | |
| 450 | |||
| 451 | 10 | LLVMExprResult OpRuleConversionManager::getBitwiseXorInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 452 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 453 |
1/2✓ Branch 0 (2→3) taken 10 times.
✗ Branch 1 (2→25) not taken.
|
20 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 454 |
1/2✓ Branch 0 (3→4) taken 10 times.
✗ Branch 1 (3→26) not taken.
|
20 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 455 |
1/2✓ Branch 0 (4→5) taken 10 times.
✗ Branch 1 (4→27) not taken.
|
10 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 456 |
1/2✓ Branch 0 (5→6) taken 10 times.
✗ Branch 1 (5→28) not taken.
|
10 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 457 | |||
| 458 |
2/4✓ Branch 0 (6→7) taken 10 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 10 times.
✗ Branch 3 (7→16) not taken.
|
10 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 459 | 10 | case COMB(TY_INT, TY_INT): // fallthrough | |
| 460 | case COMB(TY_SHORT, TY_SHORT): // fallthrough | ||
| 461 | case COMB(TY_LONG, TY_LONG): // fallthrough | ||
| 462 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 463 | case COMB(TY_BOOL, TY_BOOL): | ||
| 464 |
4/8✓ Branch 0 (8→9) taken 10 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 10 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 10 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 10 times.
✗ Branch 7 (11→29) not taken.
|
20 | return {.value = builder.CreateXor(lhsV(), rhsV())}; |
| 465 | − | default: // GCOV_EXCL_LINE | |
| 466 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ^"); // GCOV_EXCL_LINE | |
| 467 | } | ||
| 468 | 10 | } | |
| 469 | |||
| 470 | 26 | LLVMExprResult OpRuleConversionManager::getBitwiseAndInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 471 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 472 |
1/2✓ Branch 0 (2→3) taken 26 times.
✗ Branch 1 (2→25) not taken.
|
52 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 473 |
1/2✓ Branch 0 (3→4) taken 26 times.
✗ Branch 1 (3→26) not taken.
|
52 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 474 |
1/2✓ Branch 0 (4→5) taken 26 times.
✗ Branch 1 (4→27) not taken.
|
26 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 475 |
1/2✓ Branch 0 (5→6) taken 26 times.
✗ Branch 1 (5→28) not taken.
|
26 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 476 | |||
| 477 |
2/4✓ Branch 0 (6→7) taken 26 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 26 times.
✗ Branch 3 (7→16) not taken.
|
26 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 478 | 26 | case COMB(TY_INT, TY_INT): // fallthrough | |
| 479 | case COMB(TY_SHORT, TY_SHORT): // fallthrough | ||
| 480 | case COMB(TY_LONG, TY_LONG): // fallthrough | ||
| 481 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 482 | case COMB(TY_BOOL, TY_BOOL): | ||
| 483 |
4/8✓ Branch 0 (8→9) taken 26 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 26 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 26 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 26 times.
✗ Branch 7 (11→29) not taken.
|
52 | return {.value = builder.CreateAnd(lhsV(), rhsV())}; |
| 484 | − | default: // GCOV_EXCL_LINE | |
| 485 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: &"); // GCOV_EXCL_LINE | |
| 486 | } | ||
| 487 | 26 | } | |
| 488 | |||
| 489 | 3446 | LLVMExprResult OpRuleConversionManager::getEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 490 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 491 |
1/2✓ Branch 0 (2→3) taken 3446 times.
✗ Branch 1 (2→266) not taken.
|
6567 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 492 |
1/2✓ Branch 0 (3→4) taken 3446 times.
✗ Branch 1 (3→267) not taken.
|
6631 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 493 | 3771 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 494 | 3707 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 495 |
1/2✓ Branch 0 (6→7) taken 3446 times.
✗ Branch 1 (6→268) not taken.
|
3446 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 496 |
1/2✓ Branch 0 (7→8) taken 3446 times.
✗ Branch 1 (7→269) not taken.
|
3446 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 497 |
1/2✓ Branch 0 (8→9) taken 3446 times.
✗ Branch 1 (8→338) not taken.
|
3446 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 498 |
1/2✓ Branch 0 (9→10) taken 3446 times.
✗ Branch 1 (9→338) not taken.
|
3446 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 499 | |||
| 500 | // Handle operator overloads | ||
| 501 |
3/4✓ Branch 0 (10→11) taken 3446 times.
✗ Branch 1 (10→338) not taken.
✓ Branch 2 (11→12) taken 384 times.
✓ Branch 3 (11→20) taken 3062 times.
|
3446 | if (callsOverloadedOpFct(node, opIdx)) |
| 502 | 384 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 503 | |||
| 504 | // Check if both values are of type pointer | ||
| 505 |
7/10✓ Branch 0 (20→21) taken 3062 times.
✗ Branch 1 (20→338) not taken.
✓ Branch 2 (21→22) taken 837 times.
✓ Branch 3 (21→25) taken 2225 times.
✓ Branch 4 (22→23) taken 837 times.
✗ Branch 5 (22→338) not taken.
✓ Branch 6 (23→24) taken 837 times.
✗ Branch 7 (23→25) not taken.
✓ Branch 8 (26→27) taken 837 times.
✓ Branch 9 (26→33) taken 2225 times.
|
3062 | if (lhsSTy.isPtr() && rhsSTy.isPtr()) |
| 506 |
4/8✓ Branch 0 (27→28) taken 837 times.
✗ Branch 1 (27→278) not taken.
✓ Branch 2 (28→29) taken 837 times.
✗ Branch 3 (28→278) not taken.
✓ Branch 4 (29→30) taken 837 times.
✗ Branch 5 (29→278) not taken.
✓ Branch 6 (30→31) taken 837 times.
✗ Branch 7 (30→278) not taken.
|
837 | return {.value = builder.CreateICmpEQ(lhsV(), rhsV())}; |
| 507 | |||
| 508 | // Check if lhs is of type pointer and rhs is of type int | ||
| 509 |
5/8✓ Branch 0 (34→35) taken 133 times.
✓ Branch 1 (34→38) taken 2092 times.
✓ Branch 2 (35→36) taken 133 times.
✗ Branch 3 (35→338) not taken.
✗ Branch 4 (36→37) not taken.
✓ Branch 5 (36→38) taken 133 times.
✗ Branch 6 (39→40) not taken.
✓ Branch 7 (39→48) taken 2225 times.
|
2225 | if (lhsT->isPointerTy() && rhsT->isIntegerTy(32)) { |
| 510 | ✗ | llvm::Value *lhsInt = builder.CreatePtrToInt(lhsV(), rhsT); | |
| 511 | ✗ | return {.value = builder.CreateICmpEQ(lhsInt, rhsV())}; | |
| 512 | } | ||
| 513 | |||
| 514 | // Check if one value is a string and the other one is a char* | ||
| 515 |
8/18✓ Branch 0 (48→49) taken 2225 times.
✗ Branch 1 (48→338) not taken.
✓ Branch 2 (49→50) taken 133 times.
✓ Branch 3 (49→52) taken 2092 times.
✓ Branch 4 (50→51) taken 133 times.
✗ Branch 5 (50→338) not taken.
✓ Branch 6 (51→52) taken 133 times.
✗ Branch 7 (51→56) not taken.
✓ Branch 8 (52→53) taken 2225 times.
✗ Branch 9 (52→338) not taken.
✗ Branch 10 (53→54) not taken.
✓ Branch 11 (53→57) taken 2225 times.
✗ Branch 12 (54→55) not taken.
✗ Branch 13 (54→338) not taken.
✗ Branch 14 (55→56) not taken.
✗ Branch 15 (55→57) not taken.
✗ Branch 16 (58→59) not taken.
✓ Branch 17 (58→67) taken 2225 times.
|
2225 | if ((lhsSTy.is(TY_STRING) && rhsSTy.isPtrTo(TY_CHAR)) || (lhsSTy.isPtrTo(TY_CHAR) && rhsSTy.is(TY_STRING))) { |
| 516 | // Generate call to the function isRawEqual(string, string) of the string std | ||
| 517 | ✗ | llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct(); | |
| 518 | ✗ | llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()}); | |
| 519 | ✗ | return {.value = result}; | |
| 520 | } | ||
| 521 | |||
| 522 | // Check for primitive type combinations | ||
| 523 |
12/25✓ Branch 0 (67→68) taken 2225 times.
✗ Branch 1 (67→338) not taken.
✓ Branch 2 (68→69) taken 37 times.
✗ Branch 3 (68→75) not taken.
✓ Branch 4 (68→82) taken 6 times.
✓ Branch 5 (68→89) taken 249 times.
✗ Branch 6 (68→95) not taken.
✗ Branch 7 (68→104) not taken.
✗ Branch 8 (68→113) not taken.
✗ Branch 9 (68→122) not taken.
✓ Branch 10 (68→129) taken 7 times.
✓ Branch 11 (68→138) taken 13 times.
✗ Branch 12 (68→144) not taken.
✗ Branch 13 (68→153) not taken.
✗ Branch 14 (68→162) not taken.
✓ Branch 15 (68→169) taken 188 times.
✓ Branch 16 (68→178) taken 1016 times.
✗ Branch 17 (68→184) not taken.
✓ Branch 18 (68→193) taken 18 times.
✗ Branch 19 (68→202) not taken.
✗ Branch 20 (68→211) not taken.
✓ Branch 21 (68→220) taken 538 times.
✓ Branch 22 (68→226) taken 133 times.
✓ Branch 23 (68→234) taken 20 times.
✗ Branch 24 (68→252) not taken.
|
2225 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 524 | 37 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 525 |
4/8✓ Branch 0 (69→70) taken 37 times.
✗ Branch 1 (69→285) not taken.
✓ Branch 2 (70→71) taken 37 times.
✗ Branch 3 (70→285) not taken.
✓ Branch 4 (71→72) taken 37 times.
✗ Branch 5 (71→285) not taken.
✓ Branch 6 (72→73) taken 37 times.
✗ Branch 7 (72→285) not taken.
|
37 | return {.value = builder.CreateFCmpOEQ(lhsV(), rhsV())}; |
| 526 | ✗ | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 527 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 528 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 529 | ✗ | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); | |
| 530 | ✗ | return {.value = builder.CreateFCmpOEQ(lhsV(), rhsFP)}; | |
| 531 | } | ||
| 532 | 6 | case COMB(TY_INT, TY_DOUBLE): { | |
| 533 |
2/4✓ Branch 0 (82→83) taken 6 times.
✗ Branch 1 (82→338) not taken.
✓ Branch 2 (83→84) taken 6 times.
✗ Branch 3 (83→338) not taken.
|
6 | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); |
| 534 |
3/6✓ Branch 0 (84→85) taken 6 times.
✗ Branch 1 (84→287) not taken.
✓ Branch 2 (85→86) taken 6 times.
✗ Branch 3 (85→287) not taken.
✓ Branch 4 (86→87) taken 6 times.
✗ Branch 5 (86→287) not taken.
|
6 | return {.value = builder.CreateFCmpOEQ(lhsFP, rhsV())}; |
| 535 | } | ||
| 536 | 249 | case COMB(TY_INT, TY_INT): | |
| 537 |
4/8✓ Branch 0 (89→90) taken 249 times.
✗ Branch 1 (89→288) not taken.
✓ Branch 2 (90→91) taken 249 times.
✗ Branch 3 (90→288) not taken.
✓ Branch 4 (91→92) taken 249 times.
✗ Branch 5 (91→288) not taken.
✓ Branch 6 (92→93) taken 249 times.
✗ Branch 7 (92→288) not taken.
|
249 | return {.value = builder.CreateICmpEQ(lhsV(), rhsV())}; |
| 538 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 539 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 540 | ✗ | return {.value = builder.CreateICmpEQ(lhsV(), rhsInt)}; | |
| 541 | } | ||
| 542 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 543 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 544 | ✗ | return {.value = builder.CreateICmpEQ(lhsLong, rhsV())}; | |
| 545 | } | ||
| 546 | ✗ | case COMB(TY_INT, TY_BYTE): // fallthrough | |
| 547 | case COMB(TY_INT, TY_CHAR): { | ||
| 548 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 549 | ✗ | return {.value = builder.CreateICmpEQ(lhsV(), rhsInt)}; | |
| 550 | } | ||
| 551 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 552 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), lhsT); | |
| 553 | ✗ | return {.value = builder.CreateFCmpOEQ(lhsFP, rhsV())}; | |
| 554 | } | ||
| 555 | 7 | case COMB(TY_SHORT, TY_INT): { | |
| 556 |
4/8✓ Branch 0 (129→130) taken 7 times.
✗ Branch 1 (129→296) not taken.
✓ Branch 2 (130→131) taken 7 times.
✗ Branch 3 (130→296) not taken.
✓ Branch 4 (131→132) taken 7 times.
✗ Branch 5 (131→296) not taken.
✓ Branch 6 (132→133) taken 7 times.
✗ Branch 7 (132→296) not taken.
|
7 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 557 |
3/6✓ Branch 0 (133→134) taken 7 times.
✗ Branch 1 (133→297) not taken.
✓ Branch 2 (134→135) taken 7 times.
✗ Branch 3 (134→297) not taken.
✓ Branch 4 (135→136) taken 7 times.
✗ Branch 5 (135→297) not taken.
|
7 | return {.value = builder.CreateICmpEQ(lhsInt, rhsV())}; |
| 558 | } | ||
| 559 | 13 | case COMB(TY_SHORT, TY_SHORT): | |
| 560 |
4/8✓ Branch 0 (138→139) taken 13 times.
✗ Branch 1 (138→298) not taken.
✓ Branch 2 (139→140) taken 13 times.
✗ Branch 3 (139→298) not taken.
✓ Branch 4 (140→141) taken 13 times.
✗ Branch 5 (140→298) not taken.
✓ Branch 6 (141→142) taken 13 times.
✗ Branch 7 (141→298) not taken.
|
13 | return {.value = builder.CreateICmpEQ(lhsV(), rhsV())}; |
| 561 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 562 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 563 | ✗ | return {.value = builder.CreateICmpEQ(lhsLong, rhsV())}; | |
| 564 | } | ||
| 565 | ✗ | case COMB(TY_SHORT, TY_BYTE): // fallthrough | |
| 566 | case COMB(TY_SHORT, TY_CHAR): { | ||
| 567 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 568 | ✗ | return {.value = builder.CreateICmpEQ(lhsV(), rhsShort)}; | |
| 569 | } | ||
| 570 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 571 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 572 | ✗ | return {.value = builder.CreateFCmpOEQ(lhsFP, rhsV())}; | |
| 573 | } | ||
| 574 | 188 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 575 | case COMB(TY_LONG, TY_SHORT): { | ||
| 576 |
4/8✓ Branch 0 (169→170) taken 188 times.
✗ Branch 1 (169→304) not taken.
✓ Branch 2 (170→171) taken 188 times.
✗ Branch 3 (170→304) not taken.
✓ Branch 4 (171→172) taken 188 times.
✗ Branch 5 (171→304) not taken.
✓ Branch 6 (172→173) taken 188 times.
✗ Branch 7 (172→304) not taken.
|
188 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 577 |
3/6✓ Branch 0 (173→174) taken 188 times.
✗ Branch 1 (173→305) not taken.
✓ Branch 2 (174→175) taken 188 times.
✗ Branch 3 (174→305) not taken.
✓ Branch 4 (175→176) taken 188 times.
✗ Branch 5 (175→305) not taken.
|
188 | return {.value = builder.CreateICmpEQ(lhsV(), rhsLong)}; |
| 578 | } | ||
| 579 | 1016 | case COMB(TY_LONG, TY_LONG): | |
| 580 |
4/8✓ Branch 0 (178→179) taken 1016 times.
✗ Branch 1 (178→306) not taken.
✓ Branch 2 (179→180) taken 1016 times.
✗ Branch 3 (179→306) not taken.
✓ Branch 4 (180→181) taken 1016 times.
✗ Branch 5 (180→306) not taken.
✓ Branch 6 (181→182) taken 1016 times.
✗ Branch 7 (181→306) not taken.
|
1016 | return {.value = builder.CreateICmpEQ(lhsV(), rhsV())}; |
| 581 | ✗ | case COMB(TY_LONG, TY_BYTE): // fallthrough | |
| 582 | case COMB(TY_LONG, TY_CHAR): { | ||
| 583 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 584 | ✗ | return {.value = builder.CreateICmpEQ(lhsV(), rhsLong)}; | |
| 585 | } | ||
| 586 | 18 | case COMB(TY_BYTE, TY_INT): // fallthrough | |
| 587 | case COMB(TY_CHAR, TY_INT): { | ||
| 588 |
4/8✓ Branch 0 (193→194) taken 18 times.
✗ Branch 1 (193→309) not taken.
✓ Branch 2 (194→195) taken 18 times.
✗ Branch 3 (194→309) not taken.
✓ Branch 4 (195→196) taken 18 times.
✗ Branch 5 (195→309) not taken.
✓ Branch 6 (196→197) taken 18 times.
✗ Branch 7 (196→309) not taken.
|
18 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 589 |
3/6✓ Branch 0 (197→198) taken 18 times.
✗ Branch 1 (197→310) not taken.
✓ Branch 2 (198→199) taken 18 times.
✗ Branch 3 (198→310) not taken.
✓ Branch 4 (199→200) taken 18 times.
✗ Branch 5 (199→310) not taken.
|
18 | return {.value = builder.CreateICmpEQ(lhsInt, rhsV())}; |
| 590 | } | ||
| 591 | ✗ | case COMB(TY_BYTE, TY_SHORT): // fallthrough | |
| 592 | case COMB(TY_CHAR, TY_SHORT): { | ||
| 593 | ✗ | llvm::Value *lhsShort = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 594 | ✗ | return {.value = builder.CreateICmpEQ(lhsShort, rhsV())}; | |
| 595 | } | ||
| 596 | ✗ | case COMB(TY_BYTE, TY_LONG): // fallthrough | |
| 597 | case COMB(TY_CHAR, TY_LONG): { | ||
| 598 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 599 | ✗ | return {.value = builder.CreateICmpEQ(lhsLong, rhsV())}; | |
| 600 | } | ||
| 601 | 538 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | |
| 602 | case COMB(TY_CHAR, TY_CHAR): | ||
| 603 |
4/8✓ Branch 0 (220→221) taken 538 times.
✗ Branch 1 (220→315) not taken.
✓ Branch 2 (221→222) taken 538 times.
✗ Branch 3 (221→315) not taken.
✓ Branch 4 (222→223) taken 538 times.
✗ Branch 5 (222→315) not taken.
✓ Branch 6 (223→224) taken 538 times.
✗ Branch 7 (223→315) not taken.
|
538 | return {.value = builder.CreateICmpEQ(lhsV(), rhsV())}; |
| 604 | 133 | case COMB(TY_STRING, TY_STRING): { | |
| 605 | // Generate call to the function isRawEqual(string, string) of the string std | ||
| 606 |
1/2✓ Branch 0 (226→227) taken 133 times.
✗ Branch 1 (226→338) not taken.
|
133 | llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct(); |
| 607 |
5/10✓ Branch 0 (227→228) taken 133 times.
✗ Branch 1 (227→319) not taken.
✓ Branch 2 (228→229) taken 133 times.
✗ Branch 3 (228→317) not taken.
✓ Branch 4 (229→230) taken 133 times.
✗ Branch 5 (229→317) not taken.
✓ Branch 6 (231→232) taken 133 times.
✗ Branch 7 (231→316) not taken.
✓ Branch 8 (232→233) taken 133 times.
✗ Branch 9 (232→316) not taken.
|
133 | llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()}); |
| 608 | 133 | return {.value = result}; | |
| 609 | } | ||
| 610 | 20 | case COMB(TY_BOOL, TY_BOOL): // fallthrough | |
| 611 | case COMB(TY_FUNCTION, TY_FUNCTION): // fallthrough | ||
| 612 | case COMB(TY_PROCEDURE, TY_PROCEDURE): { | ||
| 613 |
2/4✓ Branch 0 (235→236) taken 20 times.
✗ Branch 1 (235→320) not taken.
✓ Branch 2 (236→237) taken 20 times.
✗ Branch 3 (236→320) not taken.
|
20 | const uint64_t typeSize = irGenerator->module->getDataLayout().getTypeSizeInBits(lhsT) / 8; |
| 614 |
1/2✓ Branch 0 (237→238) taken 20 times.
✗ Branch 1 (237→338) not taken.
|
20 | llvm::Function *memcmpFct = stdFunctionManager.getMemcmpFct(); |
| 615 |
6/12✓ Branch 0 (238→239) taken 20 times.
✗ Branch 1 (238→324) not taken.
✓ Branch 2 (239→240) taken 20 times.
✗ Branch 3 (239→322) not taken.
✓ Branch 4 (240→241) taken 20 times.
✗ Branch 5 (240→322) not taken.
✓ Branch 6 (241→242) taken 20 times.
✗ Branch 7 (241→322) not taken.
✓ Branch 8 (243→244) taken 20 times.
✗ Branch 9 (243→321) not taken.
✓ Branch 10 (244→245) taken 20 times.
✗ Branch 11 (244→321) not taken.
|
20 | llvm::Value *memcmpResult = builder.CreateCall(memcmpFct, {lhsP(), rhsP(), builder.getInt64(typeSize)}); |
| 616 |
4/8✓ Branch 0 (245→246) taken 20 times.
✗ Branch 1 (245→328) not taken.
✓ Branch 2 (246→247) taken 20 times.
✗ Branch 3 (246→327) not taken.
✓ Branch 4 (247→248) taken 20 times.
✗ Branch 5 (247→325) not taken.
✓ Branch 6 (248→249) taken 20 times.
✗ Branch 7 (248→325) not taken.
|
20 | return {.value = builder.CreateICmpEQ(memcmpResult, llvm::ConstantInt::get(context, llvm::APInt(32, 0)))}; |
| 617 | } | ||
| 618 | − | default: // GCOV_EXCL_LINE | |
| 619 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: =="); // GCOV_EXCL_LINE | |
| 620 | } | ||
| 621 |
5/14✓ Branch 0 (12→13) taken 384 times.
✗ Branch 1 (12→272) not taken.
✓ Branch 2 (13→14) taken 384 times.
✗ Branch 3 (13→272) not taken.
✓ Branch 4 (14→15) taken 384 times.
✗ Branch 5 (14→272) not taken.
✓ Branch 6 (15→16) taken 384 times.
✗ Branch 7 (15→272) not taken.
✓ Branch 8 (16→17) taken 384 times.
✗ Branch 9 (16→270) not taken.
✗ Branch 10 (272→273) not taken.
✗ Branch 11 (272→276) not taken.
✗ Branch 12 (274→275) not taken.
✗ Branch 13 (274→276) not taken.
|
3830 | } |
| 622 | |||
| 623 | 1378 | LLVMExprResult OpRuleConversionManager::getNotEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 624 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 625 |
1/2✓ Branch 0 (2→3) taken 1378 times.
✗ Branch 1 (2→272) not taken.
|
2741 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 626 |
1/2✓ Branch 0 (3→4) taken 1378 times.
✗ Branch 1 (3→273) not taken.
|
2741 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 627 | 1393 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 628 | 1393 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 629 |
1/2✓ Branch 0 (6→7) taken 1378 times.
✗ Branch 1 (6→274) not taken.
|
1378 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 630 |
1/2✓ Branch 0 (7→8) taken 1378 times.
✗ Branch 1 (7→275) not taken.
|
1378 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 631 |
1/2✓ Branch 0 (8→9) taken 1378 times.
✗ Branch 1 (8→346) not taken.
|
1378 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 632 |
1/2✓ Branch 0 (9→10) taken 1378 times.
✗ Branch 1 (9→346) not taken.
|
1378 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 633 | |||
| 634 | // Handle operator overloads | ||
| 635 |
3/4✓ Branch 0 (10→11) taken 1378 times.
✗ Branch 1 (10→346) not taken.
✓ Branch 2 (11→12) taken 11 times.
✓ Branch 3 (11→20) taken 1367 times.
|
1378 | if (callsOverloadedOpFct(node, opIdx)) |
| 636 | 11 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 637 | |||
| 638 | // Check if both values are of type pointer | ||
| 639 |
8/10✓ Branch 0 (20→21) taken 1367 times.
✗ Branch 1 (20→346) not taken.
✓ Branch 2 (21→22) taken 214 times.
✓ Branch 3 (21→25) taken 1153 times.
✓ Branch 4 (22→23) taken 214 times.
✗ Branch 5 (22→346) not taken.
✓ Branch 6 (23→24) taken 207 times.
✓ Branch 7 (23→25) taken 7 times.
✓ Branch 8 (26→27) taken 207 times.
✓ Branch 9 (26→33) taken 1160 times.
|
1367 | if (lhsSTy.isPtr() && rhsSTy.isPtr()) |
| 640 |
4/8✓ Branch 0 (27→28) taken 207 times.
✗ Branch 1 (27→284) not taken.
✓ Branch 2 (28→29) taken 207 times.
✗ Branch 3 (28→284) not taken.
✓ Branch 4 (29→30) taken 207 times.
✗ Branch 5 (29→284) not taken.
✓ Branch 6 (30→31) taken 207 times.
✗ Branch 7 (30→284) not taken.
|
207 | return {.value = builder.CreateICmpNE(lhsV(), rhsV())}; |
| 641 | |||
| 642 | // Check if lhs is of type pointer and rhs is of type int | ||
| 643 |
5/8✓ Branch 0 (34→35) taken 16 times.
✓ Branch 1 (34→38) taken 1144 times.
✓ Branch 2 (35→36) taken 16 times.
✗ Branch 3 (35→346) not taken.
✗ Branch 4 (36→37) not taken.
✓ Branch 5 (36→38) taken 16 times.
✗ Branch 6 (39→40) not taken.
✓ Branch 7 (39→48) taken 1160 times.
|
1160 | if (lhsT->isPointerTy() && rhsT->isIntegerTy(32)) { |
| 644 | ✗ | llvm::Value *lhsInt = builder.CreatePtrToInt(lhsV(), rhsT); | |
| 645 | ✗ | return {.value = builder.CreateICmpNE(lhsInt, rhsV())}; | |
| 646 | } | ||
| 647 | |||
| 648 | // Check if one value is a string and the other one is a char* | ||
| 649 |
12/18✓ Branch 0 (48→49) taken 1160 times.
✗ Branch 1 (48→346) not taken.
✓ Branch 2 (49→50) taken 9 times.
✓ Branch 3 (49→52) taken 1151 times.
✓ Branch 4 (50→51) taken 9 times.
✗ Branch 5 (50→346) not taken.
✓ Branch 6 (51→52) taken 9 times.
✗ Branch 7 (51→56) not taken.
✓ Branch 8 (52→53) taken 1160 times.
✗ Branch 9 (52→346) not taken.
✓ Branch 10 (53→54) taken 7 times.
✓ Branch 11 (53→57) taken 1153 times.
✓ Branch 12 (54→55) taken 7 times.
✗ Branch 13 (54→346) not taken.
✓ Branch 14 (55→56) taken 7 times.
✗ Branch 15 (55→57) not taken.
✓ Branch 16 (58→59) taken 7 times.
✓ Branch 17 (58→70) taken 1153 times.
|
1160 | if ((lhsSTy.is(TY_STRING) && rhsSTy.isPtrTo(TY_CHAR)) || (lhsSTy.isPtrTo(TY_CHAR) && rhsSTy.is(TY_STRING))) { |
| 650 | // Generate call to the function isRawEqual(string, string) of the string std | ||
| 651 |
1/2✓ Branch 0 (59→60) taken 7 times.
✗ Branch 1 (59→346) not taken.
|
7 | llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct(); |
| 652 |
5/10✓ Branch 0 (60→61) taken 7 times.
✗ Branch 1 (60→290) not taken.
✓ Branch 2 (61→62) taken 7 times.
✗ Branch 3 (61→288) not taken.
✓ Branch 4 (62→63) taken 7 times.
✗ Branch 5 (62→288) not taken.
✓ Branch 6 (64→65) taken 7 times.
✗ Branch 7 (64→287) not taken.
✓ Branch 8 (65→66) taken 7 times.
✗ Branch 9 (65→287) not taken.
|
7 | llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()}); |
| 653 | // Negate the result | ||
| 654 |
2/4✓ Branch 0 (66→67) taken 7 times.
✗ Branch 1 (66→291) not taken.
✓ Branch 2 (67→68) taken 7 times.
✗ Branch 3 (67→291) not taken.
|
7 | return {.value = builder.CreateNot(result)}; |
| 655 | } | ||
| 656 | |||
| 657 |
10/25✓ Branch 0 (70→71) taken 1153 times.
✗ Branch 1 (70→346) not taken.
✓ Branch 2 (71→72) taken 8 times.
✗ Branch 3 (71→78) not taken.
✗ Branch 4 (71→85) not taken.
✓ Branch 5 (71→92) taken 123 times.
✗ Branch 6 (71→98) not taken.
✗ Branch 7 (71→107) not taken.
✗ Branch 8 (71→116) not taken.
✗ Branch 9 (71→125) not taken.
✗ Branch 10 (71→132) not taken.
✓ Branch 11 (71→141) taken 1 times.
✗ Branch 12 (71→147) not taken.
✗ Branch 13 (71→156) not taken.
✗ Branch 14 (71→165) not taken.
✓ Branch 15 (71→172) taken 1 times.
✓ Branch 16 (71→181) taken 421 times.
✗ Branch 17 (71→187) not taken.
✓ Branch 18 (71→196) taken 9 times.
✗ Branch 19 (71→205) not taken.
✗ Branch 20 (71→214) not taken.
✓ Branch 21 (71→223) taken 577 times.
✓ Branch 22 (71→229) taken 9 times.
✓ Branch 23 (71→240) taken 4 times.
✗ Branch 24 (71→258) not taken.
|
1153 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 658 | 8 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 659 |
4/8✓ Branch 0 (72→73) taken 8 times.
✗ Branch 1 (72→292) not taken.
✓ Branch 2 (73→74) taken 8 times.
✗ Branch 3 (73→292) not taken.
✓ Branch 4 (74→75) taken 8 times.
✗ Branch 5 (74→292) not taken.
✓ Branch 6 (75→76) taken 8 times.
✗ Branch 7 (75→292) not taken.
|
8 | return {.value = builder.CreateFCmpONE(lhsV(), rhsV())}; |
| 660 | ✗ | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 661 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 662 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 663 | ✗ | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); | |
| 664 | ✗ | return {.value = builder.CreateFCmpONE(lhsV(), rhsFP)}; | |
| 665 | } | ||
| 666 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 667 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 668 | ✗ | return {.value = builder.CreateFCmpONE(lhsFP, rhsV())}; | |
| 669 | } | ||
| 670 | 123 | case COMB(TY_INT, TY_INT): | |
| 671 |
4/8✓ Branch 0 (92→93) taken 123 times.
✗ Branch 1 (92→295) not taken.
✓ Branch 2 (93→94) taken 123 times.
✗ Branch 3 (93→295) not taken.
✓ Branch 4 (94→95) taken 123 times.
✗ Branch 5 (94→295) not taken.
✓ Branch 6 (95→96) taken 123 times.
✗ Branch 7 (95→295) not taken.
|
123 | return {.value = builder.CreateICmpNE(lhsV(), rhsV())}; |
| 672 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 673 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 674 | ✗ | return {.value = builder.CreateICmpNE(lhsV(), rhsInt)}; | |
| 675 | } | ||
| 676 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 677 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 678 | ✗ | return {.value = builder.CreateICmpNE(lhsLong, rhsV())}; | |
| 679 | } | ||
| 680 | ✗ | case COMB(TY_INT, TY_BYTE): // fallthrough | |
| 681 | case COMB(TY_INT, TY_CHAR): { | ||
| 682 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 683 | ✗ | return {.value = builder.CreateICmpNE(lhsV(), rhsInt)}; | |
| 684 | } | ||
| 685 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 686 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 687 | ✗ | return {.value = builder.CreateFCmpONE(lhsFP, rhsV())}; | |
| 688 | } | ||
| 689 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 690 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 691 | ✗ | return {.value = builder.CreateICmpNE(lhsInt, rhsV())}; | |
| 692 | } | ||
| 693 | 1 | case COMB(TY_SHORT, TY_SHORT): | |
| 694 |
4/8✓ Branch 0 (141→142) taken 1 times.
✗ Branch 1 (141→305) not taken.
✓ Branch 2 (142→143) taken 1 times.
✗ Branch 3 (142→305) not taken.
✓ Branch 4 (143→144) taken 1 times.
✗ Branch 5 (143→305) not taken.
✓ Branch 6 (144→145) taken 1 times.
✗ Branch 7 (144→305) not taken.
|
1 | return {.value = builder.CreateICmpNE(lhsV(), rhsV())}; |
| 695 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 696 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 697 | ✗ | return {.value = builder.CreateICmpNE(lhsLong, rhsV())}; | |
| 698 | } | ||
| 699 | ✗ | case COMB(TY_SHORT, TY_BYTE): // fallthrough | |
| 700 | case COMB(TY_SHORT, TY_CHAR): { | ||
| 701 | ✗ | llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 702 | ✗ | return {.value = builder.CreateICmpNE(lhsV(), rhsShort)}; | |
| 703 | } | ||
| 704 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 705 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 706 | ✗ | return {.value = builder.CreateFCmpONE(lhsFP, rhsV())}; | |
| 707 | } | ||
| 708 | 1 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 709 | case COMB(TY_LONG, TY_SHORT): { | ||
| 710 |
4/8✓ Branch 0 (172→173) taken 1 times.
✗ Branch 1 (172→311) not taken.
✓ Branch 2 (173→174) taken 1 times.
✗ Branch 3 (173→311) not taken.
✓ Branch 4 (174→175) taken 1 times.
✗ Branch 5 (174→311) not taken.
✓ Branch 6 (175→176) taken 1 times.
✗ Branch 7 (175→311) not taken.
|
1 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 711 |
3/6✓ Branch 0 (176→177) taken 1 times.
✗ Branch 1 (176→312) not taken.
✓ Branch 2 (177→178) taken 1 times.
✗ Branch 3 (177→312) not taken.
✓ Branch 4 (178→179) taken 1 times.
✗ Branch 5 (178→312) not taken.
|
1 | return {.value = builder.CreateICmpNE(lhsV(), rhsLong)}; |
| 712 | } | ||
| 713 | 421 | case COMB(TY_LONG, TY_LONG): | |
| 714 |
4/8✓ Branch 0 (181→182) taken 421 times.
✗ Branch 1 (181→313) not taken.
✓ Branch 2 (182→183) taken 421 times.
✗ Branch 3 (182→313) not taken.
✓ Branch 4 (183→184) taken 421 times.
✗ Branch 5 (183→313) not taken.
✓ Branch 6 (184→185) taken 421 times.
✗ Branch 7 (184→313) not taken.
|
421 | return {.value = builder.CreateICmpNE(lhsV(), rhsV())}; |
| 715 | ✗ | case COMB(TY_LONG, TY_BYTE): // fallthrough | |
| 716 | case COMB(TY_LONG, TY_CHAR): { | ||
| 717 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 718 | ✗ | return {.value = builder.CreateICmpNE(lhsV(), rhsLong)}; | |
| 719 | } | ||
| 720 | 9 | case COMB(TY_BYTE, TY_INT): | |
| 721 | case COMB(TY_CHAR, TY_INT): { | ||
| 722 |
4/8✓ Branch 0 (196→197) taken 9 times.
✗ Branch 1 (196→316) not taken.
✓ Branch 2 (197→198) taken 9 times.
✗ Branch 3 (197→316) not taken.
✓ Branch 4 (198→199) taken 9 times.
✗ Branch 5 (198→316) not taken.
✓ Branch 6 (199→200) taken 9 times.
✗ Branch 7 (199→316) not taken.
|
9 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 723 |
3/6✓ Branch 0 (200→201) taken 9 times.
✗ Branch 1 (200→317) not taken.
✓ Branch 2 (201→202) taken 9 times.
✗ Branch 3 (201→317) not taken.
✓ Branch 4 (202→203) taken 9 times.
✗ Branch 5 (202→317) not taken.
|
9 | return {.value = builder.CreateICmpNE(lhsInt, rhsV())}; |
| 724 | } | ||
| 725 | ✗ | case COMB(TY_BYTE, TY_SHORT): // fallthrough | |
| 726 | case COMB(TY_CHAR, TY_SHORT): { | ||
| 727 | ✗ | llvm::Value *lhsShort = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 728 | ✗ | return {.value = builder.CreateICmpNE(lhsShort, rhsV())}; | |
| 729 | } | ||
| 730 | ✗ | case COMB(TY_BYTE, TY_LONG): // fallthrough | |
| 731 | case COMB(TY_CHAR, TY_LONG): { | ||
| 732 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 733 | ✗ | return {.value = builder.CreateICmpNE(lhsLong, rhsV())}; | |
| 734 | } | ||
| 735 | 577 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | |
| 736 | case COMB(TY_CHAR, TY_CHAR): | ||
| 737 |
4/8✓ Branch 0 (223→224) taken 577 times.
✗ Branch 1 (223→322) not taken.
✓ Branch 2 (224→225) taken 577 times.
✗ Branch 3 (224→322) not taken.
✓ Branch 4 (225→226) taken 577 times.
✗ Branch 5 (225→322) not taken.
✓ Branch 6 (226→227) taken 577 times.
✗ Branch 7 (226→322) not taken.
|
577 | return {.value = builder.CreateICmpNE(lhsV(), rhsV())}; |
| 738 | 9 | case COMB(TY_STRING, TY_STRING): { | |
| 739 | // Generate call to the function isRawEqual(string, string) of the string std | ||
| 740 |
1/2✓ Branch 0 (229→230) taken 9 times.
✗ Branch 1 (229→346) not taken.
|
9 | llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct(); |
| 741 |
5/10✓ Branch 0 (230→231) taken 9 times.
✗ Branch 1 (230→326) not taken.
✓ Branch 2 (231→232) taken 9 times.
✗ Branch 3 (231→324) not taken.
✓ Branch 4 (232→233) taken 9 times.
✗ Branch 5 (232→324) not taken.
✓ Branch 6 (234→235) taken 9 times.
✗ Branch 7 (234→323) not taken.
✓ Branch 8 (235→236) taken 9 times.
✗ Branch 9 (235→323) not taken.
|
9 | llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()}); |
| 742 | // Negate the result | ||
| 743 |
2/4✓ Branch 0 (236→237) taken 9 times.
✗ Branch 1 (236→327) not taken.
✓ Branch 2 (237→238) taken 9 times.
✗ Branch 3 (237→327) not taken.
|
9 | return {.value = builder.CreateNot(result)}; |
| 744 | } | ||
| 745 | 4 | case COMB(TY_BOOL, TY_BOOL): // fallthrough | |
| 746 | case COMB(TY_FUNCTION, TY_FUNCTION): // fallthrough | ||
| 747 | case COMB(TY_PROCEDURE, TY_PROCEDURE): { | ||
| 748 |
2/4✓ Branch 0 (241→242) taken 4 times.
✗ Branch 1 (241→328) not taken.
✓ Branch 2 (242→243) taken 4 times.
✗ Branch 3 (242→328) not taken.
|
4 | const uint64_t typeSize = irGenerator->module->getDataLayout().getTypeSizeInBits(lhsT) / 8; |
| 749 |
1/2✓ Branch 0 (243→244) taken 4 times.
✗ Branch 1 (243→346) not taken.
|
4 | llvm::Function *memcmpFct = stdFunctionManager.getMemcmpFct(); |
| 750 |
6/12✓ Branch 0 (244→245) taken 4 times.
✗ Branch 1 (244→332) not taken.
✓ Branch 2 (245→246) taken 4 times.
✗ Branch 3 (245→330) not taken.
✓ Branch 4 (246→247) taken 4 times.
✗ Branch 5 (246→330) not taken.
✓ Branch 6 (247→248) taken 4 times.
✗ Branch 7 (247→330) not taken.
✓ Branch 8 (249→250) taken 4 times.
✗ Branch 9 (249→329) not taken.
✓ Branch 10 (250→251) taken 4 times.
✗ Branch 11 (250→329) not taken.
|
4 | llvm::Value *memcmpResult = builder.CreateCall(memcmpFct, {lhsP(), rhsP(), builder.getInt64(typeSize)}); |
| 751 |
4/8✓ Branch 0 (251→252) taken 4 times.
✗ Branch 1 (251→336) not taken.
✓ Branch 2 (252→253) taken 4 times.
✗ Branch 3 (252→335) not taken.
✓ Branch 4 (253→254) taken 4 times.
✗ Branch 5 (253→333) not taken.
✓ Branch 6 (254→255) taken 4 times.
✗ Branch 7 (254→333) not taken.
|
4 | return {.value = builder.CreateICmpNE(memcmpResult, llvm::ConstantInt::get(context, llvm::APInt(32, 0)))}; |
| 752 | } | ||
| 753 | − | default: // GCOV_EXCL_LINE | |
| 754 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: !="); // GCOV_EXCL_LINE | |
| 755 | } | ||
| 756 |
5/14✓ Branch 0 (12→13) taken 11 times.
✗ Branch 1 (12→278) not taken.
✓ Branch 2 (13→14) taken 11 times.
✗ Branch 3 (13→278) not taken.
✓ Branch 4 (14→15) taken 11 times.
✗ Branch 5 (14→278) not taken.
✓ Branch 6 (15→16) taken 11 times.
✗ Branch 7 (15→278) not taken.
✓ Branch 8 (16→17) taken 11 times.
✗ Branch 9 (16→276) not taken.
✗ Branch 10 (278→279) not taken.
✗ Branch 11 (278→282) not taken.
✗ Branch 12 (280→281) not taken.
✗ Branch 13 (280→282) not taken.
|
1389 | } |
| 757 | |||
| 758 | 1652 | LLVMExprResult OpRuleConversionManager::getLessInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 759 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 760 |
1/2✓ Branch 0 (2→3) taken 1652 times.
✗ Branch 1 (2→103) not taken.
|
3304 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 761 |
1/2✓ Branch 0 (3→4) taken 1652 times.
✗ Branch 1 (3→104) not taken.
|
3304 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 762 |
1/2✓ Branch 0 (4→5) taken 1652 times.
✗ Branch 1 (4→105) not taken.
|
1652 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 763 |
1/2✓ Branch 0 (5→6) taken 1652 times.
✗ Branch 1 (5→106) not taken.
|
1652 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 764 |
1/2✓ Branch 0 (6→7) taken 1652 times.
✗ Branch 1 (6→126) not taken.
|
1652 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 765 |
1/2✓ Branch 0 (7→8) taken 1652 times.
✗ Branch 1 (7→126) not taken.
|
1652 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 766 | |||
| 767 |
9/16✓ Branch 0 (8→9) taken 1652 times.
✗ Branch 1 (8→126) not taken.
✓ Branch 2 (9→10) taken 1 times.
✓ Branch 3 (9→16) taken 10 times.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 86 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 9 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 3 times.
✓ Branch 10 (9→62) taken 4 times.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 18 times.
✓ Branch 14 (9→87) taken 1521 times.
✗ Branch 15 (9→91) not taken.
|
1652 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 768 | 1 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 769 |
4/8✓ Branch 0 (10→11) taken 1 times.
✗ Branch 1 (10→107) not taken.
✓ Branch 2 (11→12) taken 1 times.
✗ Branch 3 (11→107) not taken.
✓ Branch 4 (12→13) taken 1 times.
✗ Branch 5 (12→107) not taken.
✓ Branch 6 (13→14) taken 1 times.
✗ Branch 7 (13→107) not taken.
|
1 | return {.value = builder.CreateFCmpOLT(lhsV(), rhsV())}; |
| 770 | 10 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 771 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 772 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 773 |
2/4✓ Branch 0 (16→17) taken 10 times.
✗ Branch 1 (16→126) not taken.
✓ Branch 2 (17→18) taken 10 times.
✗ Branch 3 (17→126) not taken.
|
10 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 774 |
3/6✓ Branch 0 (18→19) taken 10 times.
✗ Branch 1 (18→108) not taken.
✓ Branch 2 (19→20) taken 10 times.
✗ Branch 3 (19→108) not taken.
✓ Branch 4 (20→21) taken 10 times.
✗ Branch 5 (20→108) not taken.
|
10 | return {.value = builder.CreateFCmpOLT(lhsV(), rhsFP)}; |
| 775 | } | ||
| 776 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 777 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 778 | ✗ | return {.value = builder.CreateFCmpOLT(lhsFP, rhsV())}; | |
| 779 | } | ||
| 780 | 86 | case COMB(TY_INT, TY_INT): | |
| 781 |
3/6✓ Branch 0 (30→31) taken 86 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 86 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 86 times.
✗ Branch 5 (32→126) not taken.
|
86 | return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 782 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 783 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 784 | ✗ | return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 785 | } | ||
| 786 | 9 | case COMB(TY_INT, TY_LONG): { | |
| 787 |
4/8✓ Branch 0 (41→42) taken 9 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 9 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 9 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 9 times.
✗ Branch 7 (44→111) not taken.
|
9 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 788 |
2/4✓ Branch 0 (45→46) taken 9 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 9 times.
✗ Branch 3 (46→126) not taken.
|
9 | return {.value = generateLT(lhsSTy, rhsSTy, lhsLong, rhsV())}; |
| 789 | } | ||
| 790 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 791 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 792 | ✗ | return {.value = builder.CreateFCmpOLT(lhsFP, rhsV())}; | |
| 793 | } | ||
| 794 | 3 | case COMB(TY_SHORT, TY_INT): { | |
| 795 |
4/8✓ Branch 0 (55→56) taken 3 times.
✗ Branch 1 (55→113) not taken.
✓ Branch 2 (56→57) taken 3 times.
✗ Branch 3 (56→113) not taken.
✓ Branch 4 (57→58) taken 3 times.
✗ Branch 5 (57→113) not taken.
✓ Branch 6 (58→59) taken 3 times.
✗ Branch 7 (58→113) not taken.
|
3 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 796 |
2/4✓ Branch 0 (59→60) taken 3 times.
✗ Branch 1 (59→126) not taken.
✓ Branch 2 (60→61) taken 3 times.
✗ Branch 3 (60→126) not taken.
|
3 | return {.value = generateLT(lhsSTy, rhsSTy, lhsInt, rhsV())}; |
| 797 | } | ||
| 798 | 4 | case COMB(TY_SHORT, TY_SHORT): | |
| 799 |
3/6✓ Branch 0 (62→63) taken 4 times.
✗ Branch 1 (62→126) not taken.
✓ Branch 2 (63→64) taken 4 times.
✗ Branch 3 (63→126) not taken.
✓ Branch 4 (64→65) taken 4 times.
✗ Branch 5 (64→126) not taken.
|
4 | return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 800 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 801 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 802 | ✗ | return {.value = generateLT(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 803 | } | ||
| 804 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 805 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 806 | ✗ | return {.value = builder.CreateFCmpOLT(lhsFP, rhsV())}; | |
| 807 | } | ||
| 808 | 18 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 809 | case COMB(TY_LONG, TY_SHORT): { | ||
| 810 |
4/8✓ Branch 0 (80→81) taken 18 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 18 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 18 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 18 times.
✗ Branch 7 (83→116) not taken.
|
18 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 811 |
2/4✓ Branch 0 (84→85) taken 18 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 18 times.
✗ Branch 3 (85→126) not taken.
|
18 | return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsLong)}; |
| 812 | } | ||
| 813 | 1521 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 814 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 815 | case COMB(TY_CHAR, TY_CHAR): | ||
| 816 |
3/6✓ Branch 0 (87→88) taken 1521 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 1521 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 1521 times.
✗ Branch 5 (89→126) not taken.
|
1521 | return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 817 | − | default: // GCOV_EXCL_LINE | |
| 818 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <"); // GCOV_EXCL_LINE | |
| 819 | } | ||
| 820 | 1652 | } | |
| 821 | |||
| 822 | 473 | LLVMExprResult OpRuleConversionManager::getGreaterInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 823 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 824 |
1/2✓ Branch 0 (2→3) taken 473 times.
✗ Branch 1 (2→103) not taken.
|
946 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 825 |
1/2✓ Branch 0 (3→4) taken 473 times.
✗ Branch 1 (3→104) not taken.
|
946 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 826 |
1/2✓ Branch 0 (4→5) taken 473 times.
✗ Branch 1 (4→105) not taken.
|
473 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 827 |
1/2✓ Branch 0 (5→6) taken 473 times.
✗ Branch 1 (5→106) not taken.
|
473 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 828 |
1/2✓ Branch 0 (6→7) taken 473 times.
✗ Branch 1 (6→126) not taken.
|
473 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 829 |
1/2✓ Branch 0 (7→8) taken 473 times.
✗ Branch 1 (7→126) not taken.
|
473 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 830 | |||
| 831 |
9/16✓ Branch 0 (8→9) taken 473 times.
✗ Branch 1 (8→126) not taken.
✓ Branch 2 (9→10) taken 1 times.
✓ Branch 3 (9→16) taken 2 times.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 15 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 18 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 6 times.
✓ Branch 10 (9→62) taken 5 times.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 18 times.
✓ Branch 14 (9→87) taken 408 times.
✗ Branch 15 (9→91) not taken.
|
473 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 832 | 1 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 833 |
4/8✓ Branch 0 (10→11) taken 1 times.
✗ Branch 1 (10→107) not taken.
✓ Branch 2 (11→12) taken 1 times.
✗ Branch 3 (11→107) not taken.
✓ Branch 4 (12→13) taken 1 times.
✗ Branch 5 (12→107) not taken.
✓ Branch 6 (13→14) taken 1 times.
✗ Branch 7 (13→107) not taken.
|
1 | return {.value = builder.CreateFCmpOGT(lhsV(), rhsV())}; |
| 834 | 2 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 835 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 836 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 837 |
2/4✓ Branch 0 (16→17) taken 2 times.
✗ Branch 1 (16→126) not taken.
✓ Branch 2 (17→18) taken 2 times.
✗ Branch 3 (17→126) not taken.
|
2 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 838 |
3/6✓ Branch 0 (18→19) taken 2 times.
✗ Branch 1 (18→108) not taken.
✓ Branch 2 (19→20) taken 2 times.
✗ Branch 3 (19→108) not taken.
✓ Branch 4 (20→21) taken 2 times.
✗ Branch 5 (20→108) not taken.
|
2 | return {.value = builder.CreateFCmpOGT(lhsV(), rhsFP)}; |
| 839 | } | ||
| 840 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 841 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 842 | ✗ | return {.value = builder.CreateFCmpOGT(lhsFP, rhsV())}; | |
| 843 | } | ||
| 844 | 15 | case COMB(TY_INT, TY_INT): | |
| 845 |
3/6✓ Branch 0 (30→31) taken 15 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 15 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 15 times.
✗ Branch 5 (32→126) not taken.
|
15 | return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 846 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 847 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 848 | ✗ | return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 849 | } | ||
| 850 | 18 | case COMB(TY_INT, TY_LONG): { | |
| 851 |
4/8✓ Branch 0 (41→42) taken 18 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 18 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 18 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 18 times.
✗ Branch 7 (44→111) not taken.
|
18 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 852 |
2/4✓ Branch 0 (45→46) taken 18 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 18 times.
✗ Branch 3 (46→126) not taken.
|
18 | return {.value = generateGT(lhsSTy, rhsSTy, lhsLong, rhsV())}; |
| 853 | } | ||
| 854 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 855 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 856 | ✗ | return {.value = builder.CreateFCmpOGT(lhsFP, rhsV())}; | |
| 857 | } | ||
| 858 | 6 | case COMB(TY_SHORT, TY_INT): { | |
| 859 |
4/8✓ Branch 0 (55→56) taken 6 times.
✗ Branch 1 (55→113) not taken.
✓ Branch 2 (56→57) taken 6 times.
✗ Branch 3 (56→113) not taken.
✓ Branch 4 (57→58) taken 6 times.
✗ Branch 5 (57→113) not taken.
✓ Branch 6 (58→59) taken 6 times.
✗ Branch 7 (58→113) not taken.
|
6 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 860 |
2/4✓ Branch 0 (59→60) taken 6 times.
✗ Branch 1 (59→126) not taken.
✓ Branch 2 (60→61) taken 6 times.
✗ Branch 3 (60→126) not taken.
|
6 | return {.value = generateGT(lhsSTy, rhsSTy, lhsInt, rhsV())}; |
| 861 | } | ||
| 862 | 5 | case COMB(TY_SHORT, TY_SHORT): | |
| 863 |
3/6✓ Branch 0 (62→63) taken 5 times.
✗ Branch 1 (62→126) not taken.
✓ Branch 2 (63→64) taken 5 times.
✗ Branch 3 (63→126) not taken.
✓ Branch 4 (64→65) taken 5 times.
✗ Branch 5 (64→126) not taken.
|
5 | return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 864 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 865 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 866 | ✗ | return {.value = generateGT(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 867 | } | ||
| 868 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 869 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 870 | ✗ | return {.value = builder.CreateFCmpOGT(lhsFP, rhsV())}; | |
| 871 | } | ||
| 872 | 18 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 873 | case COMB(TY_LONG, TY_SHORT): { | ||
| 874 |
4/8✓ Branch 0 (80→81) taken 18 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 18 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 18 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 18 times.
✗ Branch 7 (83→116) not taken.
|
18 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 875 |
2/4✓ Branch 0 (84→85) taken 18 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 18 times.
✗ Branch 3 (85→126) not taken.
|
18 | return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsLong)}; |
| 876 | } | ||
| 877 | 408 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 878 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 879 | case COMB(TY_CHAR, TY_CHAR): | ||
| 880 |
3/6✓ Branch 0 (87→88) taken 408 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 408 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 408 times.
✗ Branch 5 (89→126) not taken.
|
408 | return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 881 | − | default: // GCOV_EXCL_LINE | |
| 882 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >"); // GCOV_EXCL_LINE | |
| 883 | } | ||
| 884 | 473 | } | |
| 885 | |||
| 886 | 346 | LLVMExprResult OpRuleConversionManager::getLessEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 887 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 888 |
1/2✓ Branch 0 (2→3) taken 346 times.
✗ Branch 1 (2→103) not taken.
|
692 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 889 |
1/2✓ Branch 0 (3→4) taken 346 times.
✗ Branch 1 (3→104) not taken.
|
692 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 890 |
1/2✓ Branch 0 (4→5) taken 346 times.
✗ Branch 1 (4→105) not taken.
|
346 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 891 |
1/2✓ Branch 0 (5→6) taken 346 times.
✗ Branch 1 (5→106) not taken.
|
346 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 892 |
1/2✓ Branch 0 (6→7) taken 346 times.
✗ Branch 1 (6→126) not taken.
|
346 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 893 |
1/2✓ Branch 0 (7→8) taken 346 times.
✗ Branch 1 (7→126) not taken.
|
346 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 894 | |||
| 895 |
6/16✓ Branch 0 (8→9) taken 346 times.
✗ Branch 1 (8→126) not taken.
✓ Branch 2 (9→10) taken 3 times.
✗ Branch 3 (9→16) not taken.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 11 times.
✗ Branch 6 (9→34) not taken.
✗ Branch 7 (9→41) not taken.
✗ Branch 8 (9→48) not taken.
✗ Branch 9 (9→55) not taken.
✓ Branch 10 (9→62) taken 2 times.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 1 times.
✓ Branch 14 (9→87) taken 329 times.
✗ Branch 15 (9→91) not taken.
|
346 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 896 | 3 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 897 |
4/8✓ Branch 0 (10→11) taken 3 times.
✗ Branch 1 (10→107) not taken.
✓ Branch 2 (11→12) taken 3 times.
✗ Branch 3 (11→107) not taken.
✓ Branch 4 (12→13) taken 3 times.
✗ Branch 5 (12→107) not taken.
✓ Branch 6 (13→14) taken 3 times.
✗ Branch 7 (13→107) not taken.
|
3 | return {.value = builder.CreateFCmpOLE(lhsV(), rhsV())}; |
| 898 | ✗ | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 899 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 900 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 901 | ✗ | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); | |
| 902 | ✗ | return {.value = builder.CreateFCmpOLE(lhsV(), rhsFP)}; | |
| 903 | } | ||
| 904 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 905 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 906 | ✗ | return {.value = builder.CreateFCmpOLE(lhsFP, rhsV())}; | |
| 907 | } | ||
| 908 | 11 | case COMB(TY_INT, TY_INT): | |
| 909 |
3/6✓ Branch 0 (30→31) taken 11 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 11 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 11 times.
✗ Branch 5 (32→126) not taken.
|
11 | return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 910 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 911 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 912 | ✗ | return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 913 | } | ||
| 914 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 915 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 916 | ✗ | return {.value = generateLE(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 917 | } | ||
| 918 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 919 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 920 | ✗ | return {.value = builder.CreateFCmpOLE(lhsFP, rhsV())}; | |
| 921 | } | ||
| 922 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 923 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 924 | ✗ | return {.value = generateLE(lhsSTy, rhsSTy, lhsInt, rhsV())}; | |
| 925 | } | ||
| 926 | 2 | case COMB(TY_SHORT, TY_SHORT): | |
| 927 |
3/6✓ Branch 0 (62→63) taken 2 times.
✗ Branch 1 (62→126) not taken.
✓ Branch 2 (63→64) taken 2 times.
✗ Branch 3 (63→126) not taken.
✓ Branch 4 (64→65) taken 2 times.
✗ Branch 5 (64→126) not taken.
|
2 | return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 928 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 929 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 930 | ✗ | return {.value = generateLE(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 931 | } | ||
| 932 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 933 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 934 | ✗ | return {.value = builder.CreateFCmpOLE(lhsFP, rhsV())}; | |
| 935 | } | ||
| 936 | 1 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 937 | case COMB(TY_LONG, TY_SHORT): { | ||
| 938 |
4/8✓ Branch 0 (80→81) taken 1 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 1 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 1 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 1 times.
✗ Branch 7 (83→116) not taken.
|
1 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 939 |
2/4✓ Branch 0 (84→85) taken 1 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 1 times.
✗ Branch 3 (85→126) not taken.
|
1 | return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsLong)}; |
| 940 | } | ||
| 941 | 329 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 942 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 943 | case COMB(TY_CHAR, TY_CHAR): | ||
| 944 |
3/6✓ Branch 0 (87→88) taken 329 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 329 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 329 times.
✗ Branch 5 (89→126) not taken.
|
329 | return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 945 | − | default: // GCOV_EXCL_LINE | |
| 946 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <="); // GCOV_EXCL_LINE | |
| 947 | } | ||
| 948 | 346 | } | |
| 949 | |||
| 950 | 906 | LLVMExprResult OpRuleConversionManager::getGreaterEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 951 | LLVMExprResult &rhs, QualType rhsSTy) { | ||
| 952 |
1/2✓ Branch 0 (2→3) taken 906 times.
✗ Branch 1 (2→103) not taken.
|
1812 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 953 |
1/2✓ Branch 0 (3→4) taken 906 times.
✗ Branch 1 (3→104) not taken.
|
1812 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 954 |
1/2✓ Branch 0 (4→5) taken 906 times.
✗ Branch 1 (4→105) not taken.
|
906 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 955 |
1/2✓ Branch 0 (5→6) taken 906 times.
✗ Branch 1 (5→106) not taken.
|
906 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 956 |
1/2✓ Branch 0 (6→7) taken 906 times.
✗ Branch 1 (6→126) not taken.
|
906 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 957 |
1/2✓ Branch 0 (7→8) taken 906 times.
✗ Branch 1 (7→126) not taken.
|
906 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 958 | |||
| 959 |
8/16✓ Branch 0 (8→9) taken 906 times.
✗ Branch 1 (8→126) not taken.
✓ Branch 2 (9→10) taken 24 times.
✓ Branch 3 (9→16) taken 4 times.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 37 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 9 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 15 times.
✗ Branch 10 (9→62) not taken.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 175 times.
✓ Branch 14 (9→87) taken 642 times.
✗ Branch 15 (9→91) not taken.
|
906 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 960 | 24 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 961 |
4/8✓ Branch 0 (10→11) taken 24 times.
✗ Branch 1 (10→107) not taken.
✓ Branch 2 (11→12) taken 24 times.
✗ Branch 3 (11→107) not taken.
✓ Branch 4 (12→13) taken 24 times.
✗ Branch 5 (12→107) not taken.
✓ Branch 6 (13→14) taken 24 times.
✗ Branch 7 (13→107) not taken.
|
24 | return {.value = builder.CreateFCmpOGE(lhsV(), rhsV())}; |
| 962 | 4 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 963 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 964 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 965 |
2/4✓ Branch 0 (16→17) taken 4 times.
✗ Branch 1 (16→126) not taken.
✓ Branch 2 (17→18) taken 4 times.
✗ Branch 3 (17→126) not taken.
|
4 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 966 |
3/6✓ Branch 0 (18→19) taken 4 times.
✗ Branch 1 (18→108) not taken.
✓ Branch 2 (19→20) taken 4 times.
✗ Branch 3 (19→108) not taken.
✓ Branch 4 (20→21) taken 4 times.
✗ Branch 5 (20→108) not taken.
|
4 | return {.value = builder.CreateFCmpOGE(lhsV(), rhsFP)}; |
| 967 | } | ||
| 968 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 969 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 970 | ✗ | return {.value = builder.CreateFCmpOGE(lhsFP, rhsV())}; | |
| 971 | } | ||
| 972 | 37 | case COMB(TY_INT, TY_INT): | |
| 973 |
3/6✓ Branch 0 (30→31) taken 37 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 37 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 37 times.
✗ Branch 5 (32→126) not taken.
|
37 | return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 974 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 975 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 976 | ✗ | return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 977 | } | ||
| 978 | 9 | case COMB(TY_INT, TY_LONG): { | |
| 979 |
4/8✓ Branch 0 (41→42) taken 9 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 9 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 9 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 9 times.
✗ Branch 7 (44→111) not taken.
|
9 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 980 |
2/4✓ Branch 0 (45→46) taken 9 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 9 times.
✗ Branch 3 (46→126) not taken.
|
9 | return {.value = generateGE(lhsSTy, rhsSTy, lhsLong, rhsV())}; |
| 981 | } | ||
| 982 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 983 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 984 | ✗ | return {.value = builder.CreateFCmpOGE(lhsFP, rhsV())}; | |
| 985 | } | ||
| 986 | 15 | case COMB(TY_SHORT, TY_INT): { | |
| 987 |
4/8✓ Branch 0 (55→56) taken 15 times.
✗ Branch 1 (55→113) not taken.
✓ Branch 2 (56→57) taken 15 times.
✗ Branch 3 (56→113) not taken.
✓ Branch 4 (57→58) taken 15 times.
✗ Branch 5 (57→113) not taken.
✓ Branch 6 (58→59) taken 15 times.
✗ Branch 7 (58→113) not taken.
|
15 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 988 |
2/4✓ Branch 0 (59→60) taken 15 times.
✗ Branch 1 (59→126) not taken.
✓ Branch 2 (60→61) taken 15 times.
✗ Branch 3 (60→126) not taken.
|
15 | return {.value = generateGE(lhsSTy, rhsSTy, lhsInt, rhsV())}; |
| 989 | } | ||
| 990 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 991 | ✗ | return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 992 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 993 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 994 | ✗ | return {.value = generateGE(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 995 | } | ||
| 996 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 997 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 998 | ✗ | return {.value = builder.CreateFCmpOGE(lhsFP, rhsV())}; | |
| 999 | } | ||
| 1000 | 175 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1001 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1002 |
4/8✓ Branch 0 (80→81) taken 175 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 175 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 175 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 175 times.
✗ Branch 7 (83→116) not taken.
|
175 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1003 |
2/4✓ Branch 0 (84→85) taken 175 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 175 times.
✗ Branch 3 (85→126) not taken.
|
175 | return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsLong)}; |
| 1004 | } | ||
| 1005 | 642 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 1006 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 1007 | case COMB(TY_CHAR, TY_CHAR): | ||
| 1008 |
3/6✓ Branch 0 (87→88) taken 642 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 642 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 642 times.
✗ Branch 5 (89→126) not taken.
|
642 | return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 1009 | − | default: // GCOV_EXCL_LINE | |
| 1010 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >="); // GCOV_EXCL_LINE | |
| 1011 | } | ||
| 1012 | 906 | } | |
| 1013 | |||
| 1014 | 97 | LLVMExprResult OpRuleConversionManager::getShiftLeftInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1015 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 1016 |
1/2✓ Branch 0 (2→3) taken 97 times.
✗ Branch 1 (2→86) not taken.
|
110 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1017 |
1/2✓ Branch 0 (3→4) taken 97 times.
✗ Branch 1 (3→87) not taken.
|
173 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1018 | 181 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1019 | 118 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1020 |
1/2✓ Branch 0 (6→7) taken 97 times.
✗ Branch 1 (6→88) not taken.
|
97 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1021 |
1/2✓ Branch 0 (7→8) taken 97 times.
✗ Branch 1 (7→89) not taken.
|
97 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1022 |
1/2✓ Branch 0 (8→9) taken 97 times.
✗ Branch 1 (8→117) not taken.
|
97 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1023 | |||
| 1024 | // Handle operator overloads | ||
| 1025 |
3/4✓ Branch 0 (9→10) taken 97 times.
✗ Branch 1 (9→117) not taken.
✓ Branch 2 (10→11) taken 85 times.
✓ Branch 3 (10→19) taken 12 times.
|
97 | if (callsOverloadedOpFct(node, opIdx)) |
| 1026 | 85 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1027 | |||
| 1028 |
4/10✓ Branch 0 (19→20) taken 12 times.
✗ Branch 1 (19→117) not taken.
✓ Branch 2 (20→21) taken 3 times.
✗ Branch 3 (20→27) not taken.
✗ Branch 4 (20→36) not taken.
✓ Branch 5 (20→42) taken 1 times.
✓ Branch 6 (20→51) taken 8 times.
✗ Branch 7 (20→57) not taken.
✗ Branch 8 (20→66) not taken.
✗ Branch 9 (20→72) not taken.
|
12 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1029 | 3 | case COMB(TY_INT, TY_INT): | |
| 1030 |
4/8✓ Branch 0 (21→22) taken 3 times.
✗ Branch 1 (21→98) not taken.
✓ Branch 2 (22→23) taken 3 times.
✗ Branch 3 (22→98) not taken.
✓ Branch 4 (23→24) taken 3 times.
✗ Branch 5 (23→98) not taken.
✓ Branch 6 (24→25) taken 3 times.
✗ Branch 7 (24→98) not taken.
|
3 | return {.value = builder.CreateShl(lhsV(), rhsV())}; |
| 1031 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 1032 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 1033 | case COMB(TY_SHORT, TY_INT): { | ||
| 1034 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1035 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsInt)}; | |
| 1036 | } | ||
| 1037 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 1038 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsV())}; | |
| 1039 | 1 | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 1040 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 1041 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1042 |
4/8✓ Branch 0 (42→43) taken 1 times.
✗ Branch 1 (42→102) not taken.
✓ Branch 2 (43→44) taken 1 times.
✗ Branch 3 (43→102) not taken.
✓ Branch 4 (44→45) taken 1 times.
✗ Branch 5 (44→102) not taken.
✓ Branch 6 (45→46) taken 1 times.
✗ Branch 7 (45→102) not taken.
|
1 | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1043 |
3/6✓ Branch 0 (46→47) taken 1 times.
✗ Branch 1 (46→103) not taken.
✓ Branch 2 (47→48) taken 1 times.
✗ Branch 3 (47→103) not taken.
✓ Branch 4 (48→49) taken 1 times.
✗ Branch 5 (48→103) not taken.
|
1 | return {.value = builder.CreateShl(lhsV(), rhsInt)}; |
| 1044 | } | ||
| 1045 | 8 | case COMB(TY_LONG, TY_LONG): | |
| 1046 |
4/8✓ Branch 0 (51→52) taken 8 times.
✗ Branch 1 (51→104) not taken.
✓ Branch 2 (52→53) taken 8 times.
✗ Branch 3 (52→104) not taken.
✓ Branch 4 (53→54) taken 8 times.
✗ Branch 5 (53→104) not taken.
✓ Branch 6 (54→55) taken 8 times.
✗ Branch 7 (54→104) not taken.
|
8 | return {.value = builder.CreateShl(lhsV(), rhsV())}; |
| 1047 | ✗ | case COMB(TY_BYTE, TY_INT): // fallthrough | |
| 1048 | case COMB(TY_BYTE, TY_SHORT): // fallthrough | ||
| 1049 | case COMB(TY_BYTE, TY_LONG): { | ||
| 1050 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1051 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsInt)}; | |
| 1052 | } | ||
| 1053 | ✗ | case COMB(TY_BYTE, TY_BYTE): | |
| 1054 | ✗ | return {.value = builder.CreateShl(lhsV(), rhsV())}; | |
| 1055 | − | default: // GCOV_EXCL_LINE | |
| 1056 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <<"); // GCOV_EXCL_LINE | |
| 1057 | } | ||
| 1058 |
5/14✓ Branch 0 (11→12) taken 85 times.
✗ Branch 1 (11→92) not taken.
✓ Branch 2 (12→13) taken 85 times.
✗ Branch 3 (12→92) not taken.
✓ Branch 4 (13→14) taken 85 times.
✗ Branch 5 (13→92) not taken.
✓ Branch 6 (14→15) taken 85 times.
✗ Branch 7 (14→92) not taken.
✓ Branch 8 (15→16) taken 85 times.
✗ Branch 9 (15→90) not taken.
✗ Branch 10 (92→93) not taken.
✗ Branch 11 (92→96) not taken.
✗ Branch 12 (94→95) not taken.
✗ Branch 13 (94→96) not taken.
|
182 | } |
| 1059 | |||
| 1060 | 54 | LLVMExprResult OpRuleConversionManager::getShiftRightInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1061 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 1062 |
1/2✓ Branch 0 (2→3) taken 54 times.
✗ Branch 1 (2→72) not taken.
|
108 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1063 |
1/2✓ Branch 0 (3→4) taken 54 times.
✗ Branch 1 (3→73) not taken.
|
108 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1064 | 54 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1065 | 54 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1066 |
1/2✓ Branch 0 (6→7) taken 54 times.
✗ Branch 1 (6→74) not taken.
|
54 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1067 |
1/2✓ Branch 0 (7→8) taken 54 times.
✗ Branch 1 (7→75) not taken.
|
54 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1068 |
1/2✓ Branch 0 (8→9) taken 54 times.
✗ Branch 1 (8→96) not taken.
|
54 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1069 | |||
| 1070 | // Handle operator overloads | ||
| 1071 |
3/4✓ Branch 0 (9→10) taken 54 times.
✗ Branch 1 (9→96) not taken.
✓ Branch 2 (10→11) taken 1 times.
✓ Branch 3 (10→19) taken 53 times.
|
54 | if (callsOverloadedOpFct(node, opIdx)) |
| 1072 | 1 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1073 | |||
| 1074 |
3/10✓ Branch 0 (19→20) taken 53 times.
✗ Branch 1 (19→96) not taken.
✓ Branch 2 (20→21) taken 2 times.
✗ Branch 3 (20→25) not taken.
✗ Branch 4 (20→32) not taken.
✗ Branch 5 (20→36) not taken.
✓ Branch 6 (20→43) taken 51 times.
✗ Branch 7 (20→47) not taken.
✗ Branch 8 (20→54) not taken.
✗ Branch 9 (20→58) not taken.
|
53 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1075 | 2 | case COMB(TY_INT, TY_INT): | |
| 1076 |
3/6✓ Branch 0 (21→22) taken 2 times.
✗ Branch 1 (21→96) not taken.
✓ Branch 2 (22→23) taken 2 times.
✗ Branch 3 (22→96) not taken.
✓ Branch 4 (23→24) taken 2 times.
✗ Branch 5 (23→96) not taken.
|
2 | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 1077 | ✗ | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 1078 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 1079 | case COMB(TY_SHORT, TY_INT): { | ||
| 1080 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1081 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 1082 | } | ||
| 1083 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 1084 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 1085 | ✗ | case COMB(TY_SHORT, TY_LONG): // fallthrough | |
| 1086 | case COMB(TY_LONG, TY_INT): // fallthrough | ||
| 1087 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1088 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1089 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 1090 | } | ||
| 1091 | 51 | case COMB(TY_LONG, TY_LONG): | |
| 1092 |
3/6✓ Branch 0 (43→44) taken 51 times.
✗ Branch 1 (43→96) not taken.
✓ Branch 2 (44→45) taken 51 times.
✗ Branch 3 (44→96) not taken.
✓ Branch 4 (45→46) taken 51 times.
✗ Branch 5 (45→96) not taken.
|
51 | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 1093 | ✗ | case COMB(TY_BYTE, TY_INT): // fallthrough | |
| 1094 | case COMB(TY_BYTE, TY_SHORT): // fallthrough | ||
| 1095 | case COMB(TY_BYTE, TY_LONG): { | ||
| 1096 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1097 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 1098 | } | ||
| 1099 | ✗ | case COMB(TY_BYTE, TY_BYTE): | |
| 1100 | ✗ | return {.value = generateSHR(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 1101 | − | default: // GCOV_EXCL_LINE | |
| 1102 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >>"); // GCOV_EXCL_LINE | |
| 1103 | } | ||
| 1104 |
5/14✓ Branch 0 (11→12) taken 1 times.
✗ Branch 1 (11→78) not taken.
✓ Branch 2 (12→13) taken 1 times.
✗ Branch 3 (12→78) not taken.
✓ Branch 4 (13→14) taken 1 times.
✗ Branch 5 (13→78) not taken.
✓ Branch 6 (14→15) taken 1 times.
✗ Branch 7 (14→78) not taken.
✓ Branch 8 (15→16) taken 1 times.
✗ Branch 9 (15→76) not taken.
✗ Branch 10 (78→79) not taken.
✗ Branch 11 (78→82) not taken.
✗ Branch 12 (80→81) not taken.
✗ Branch 13 (80→82) not taken.
|
55 | } |
| 1105 | |||
| 1106 | 2653 | LLVMExprResult OpRuleConversionManager::getPlusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1107 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 1108 |
1/2✓ Branch 0 (2→3) taken 2653 times.
✗ Branch 1 (2→249) not taken.
|
5245 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1109 |
1/2✓ Branch 0 (3→4) taken 2653 times.
✗ Branch 1 (3→250) not taken.
|
5245 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1110 | 2714 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1111 | 2714 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1112 |
1/2✓ Branch 0 (6→7) taken 2653 times.
✗ Branch 1 (6→251) not taken.
|
2653 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1113 |
1/2✓ Branch 0 (7→8) taken 2653 times.
✗ Branch 1 (7→252) not taken.
|
2653 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1114 |
1/2✓ Branch 0 (8→9) taken 2653 times.
✗ Branch 1 (8→309) not taken.
|
2653 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1115 |
1/2✓ Branch 0 (9→10) taken 2653 times.
✗ Branch 1 (9→309) not taken.
|
2653 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1116 | |||
| 1117 | // Handle operator overloads | ||
| 1118 |
3/4✓ Branch 0 (10→11) taken 2653 times.
✗ Branch 1 (10→309) not taken.
✓ Branch 2 (11→12) taken 62 times.
✓ Branch 3 (11→20) taken 2591 times.
|
2653 | if (callsOverloadedOpFct(node, opIdx)) |
| 1119 | 62 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1120 | |||
| 1121 |
11/21✓ Branch 0 (20→21) taken 2591 times.
✗ Branch 1 (20→309) not taken.
✓ Branch 2 (21→22) taken 21 times.
✓ Branch 3 (21→28) taken 83 times.
✓ Branch 4 (21→35) taken 1 times.
✓ Branch 5 (21→42) taken 44 times.
✗ Branch 6 (21→54) not taken.
✓ Branch 7 (21→69) taken 96 times.
✗ Branch 8 (21→84) not taken.
✗ Branch 9 (21→98) not taken.
✗ Branch 10 (21→105) not taken.
✓ Branch 11 (21→120) taken 2 times.
✗ Branch 12 (21→132) not taken.
✗ Branch 13 (21→147) not taken.
✓ Branch 14 (21→161) taken 1 times.
✓ Branch 15 (21→168) taken 132 times.
✓ Branch 16 (21→183) taken 1737 times.
✗ Branch 17 (21→195) not taken.
✗ Branch 18 (21→209) not taken.
✓ Branch 19 (21→221) taken 474 times.
✗ Branch 20 (21→235) not taken.
|
2591 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1122 | 21 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 1123 |
4/8✓ Branch 0 (22→23) taken 21 times.
✗ Branch 1 (22→261) not taken.
✓ Branch 2 (23→24) taken 21 times.
✗ Branch 3 (23→261) not taken.
✓ Branch 4 (24→25) taken 21 times.
✗ Branch 5 (24→261) not taken.
✓ Branch 6 (25→26) taken 21 times.
✗ Branch 7 (25→261) not taken.
|
21 | return {.value = builder.CreateFAdd(lhsV(), rhsV())}; |
| 1124 | 83 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 1125 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 1126 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 1127 |
2/4✓ Branch 0 (28→29) taken 83 times.
✗ Branch 1 (28→309) not taken.
✓ Branch 2 (29→30) taken 83 times.
✗ Branch 3 (29→309) not taken.
|
83 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 1128 |
3/6✓ Branch 0 (30→31) taken 83 times.
✗ Branch 1 (30→262) not taken.
✓ Branch 2 (31→32) taken 83 times.
✗ Branch 3 (31→262) not taken.
✓ Branch 4 (32→33) taken 83 times.
✗ Branch 5 (32→262) not taken.
|
83 | return {.value = builder.CreateFAdd(lhsV(), rhsFP)}; |
| 1129 | } | ||
| 1130 | 1 | case COMB(TY_INT, TY_DOUBLE): { | |
| 1131 |
2/4✓ Branch 0 (35→36) taken 1 times.
✗ Branch 1 (35→309) not taken.
✓ Branch 2 (36→37) taken 1 times.
✗ Branch 3 (36→309) not taken.
|
1 | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); |
| 1132 |
3/6✓ Branch 0 (37→38) taken 1 times.
✗ Branch 1 (37→263) not taken.
✓ Branch 2 (38→39) taken 1 times.
✗ Branch 3 (38→263) not taken.
✓ Branch 4 (39→40) taken 1 times.
✗ Branch 5 (39→263) not taken.
|
1 | return {.value = builder.CreateFAdd(lhsFP, rhsV())}; |
| 1133 | } | ||
| 1134 | 44 | case COMB(TY_INT, TY_INT): | |
| 1135 |
9/16✓ Branch 0 (42→43) taken 44 times.
✗ Branch 1 (42→309) not taken.
✓ Branch 2 (43→44) taken 42 times.
✓ Branch 3 (43→47) taken 2 times.
✓ Branch 4 (44→45) taken 42 times.
✗ Branch 5 (44→309) not taken.
✓ Branch 6 (45→46) taken 42 times.
✗ Branch 7 (45→47) not taken.
✓ Branch 8 (48→49) taken 44 times.
✗ Branch 9 (48→264) not taken.
✓ Branch 10 (49→50) taken 44 times.
✗ Branch 11 (49→264) not taken.
✓ Branch 12 (50→51) taken 44 times.
✗ Branch 13 (50→264) not taken.
✓ Branch 14 (51→52) taken 44 times.
✗ Branch 15 (51→264) not taken.
|
44 | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1136 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 1137 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1138 | ✗ | return {.value = builder.CreateAdd(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1139 | } | ||
| 1140 | 96 | case COMB(TY_INT, TY_LONG): { | |
| 1141 |
4/8✓ Branch 0 (69→70) taken 96 times.
✗ Branch 1 (69→267) not taken.
✓ Branch 2 (70→71) taken 96 times.
✗ Branch 3 (70→267) not taken.
✓ Branch 4 (71→72) taken 96 times.
✗ Branch 5 (71→267) not taken.
✓ Branch 6 (72→73) taken 96 times.
✗ Branch 7 (72→267) not taken.
|
96 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 1142 |
5/14✓ Branch 0 (73→74) taken 96 times.
✗ Branch 1 (73→309) not taken.
✗ Branch 2 (74→75) not taken.
✓ Branch 3 (74→78) taken 96 times.
✗ Branch 4 (75→76) not taken.
✗ Branch 5 (75→309) not taken.
✗ Branch 6 (76→77) not taken.
✗ Branch 7 (76→78) not taken.
✓ Branch 8 (79→80) taken 96 times.
✗ Branch 9 (79→268) not taken.
✓ Branch 10 (80→81) taken 96 times.
✗ Branch 11 (80→268) not taken.
✓ Branch 12 (81→82) taken 96 times.
✗ Branch 13 (81→268) not taken.
|
96 | return {.value = builder.CreateAdd(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1143 | } | ||
| 1144 | ✗ | case COMB(TY_INT, TY_PTR): { | |
| 1145 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1146 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1147 | } | ||
| 1148 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 1149 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1150 | ✗ | return {.value = builder.CreateFAdd(lhsFP, rhsV())}; | |
| 1151 | } | ||
| 1152 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 1153 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1154 | ✗ | return {.value = builder.CreateAdd(lhsInt, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1155 | } | ||
| 1156 | 2 | case COMB(TY_SHORT, TY_SHORT): | |
| 1157 |
9/16✓ Branch 0 (120→121) taken 2 times.
✗ Branch 1 (120→309) not taken.
✓ Branch 2 (121→122) taken 1 times.
✓ Branch 3 (121→125) taken 1 times.
✓ Branch 4 (122→123) taken 1 times.
✗ Branch 5 (122→309) not taken.
✓ Branch 6 (123→124) taken 1 times.
✗ Branch 7 (123→125) not taken.
✓ Branch 8 (126→127) taken 2 times.
✗ Branch 9 (126→277) not taken.
✓ Branch 10 (127→128) taken 2 times.
✗ Branch 11 (127→277) not taken.
✓ Branch 12 (128→129) taken 2 times.
✗ Branch 13 (128→277) not taken.
✓ Branch 14 (129→130) taken 2 times.
✗ Branch 15 (129→277) not taken.
|
2 | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1158 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 1159 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1160 | ✗ | return {.value = builder.CreateAdd(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1161 | } | ||
| 1162 | ✗ | case COMB(TY_SHORT, TY_PTR): { | |
| 1163 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1164 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1165 | } | ||
| 1166 | 1 | case COMB(TY_LONG, TY_DOUBLE): { | |
| 1167 |
2/4✓ Branch 0 (161→162) taken 1 times.
✗ Branch 1 (161→309) not taken.
✓ Branch 2 (162→163) taken 1 times.
✗ Branch 3 (162→309) not taken.
|
1 | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); |
| 1168 |
3/6✓ Branch 0 (163→164) taken 1 times.
✗ Branch 1 (163→285) not taken.
✓ Branch 2 (164→165) taken 1 times.
✗ Branch 3 (164→285) not taken.
✓ Branch 4 (165→166) taken 1 times.
✗ Branch 5 (165→285) not taken.
|
1 | return {.value = builder.CreateFAdd(lhsFP, rhsV())}; |
| 1169 | } | ||
| 1170 | 132 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1171 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1172 |
4/8✓ Branch 0 (168→169) taken 132 times.
✗ Branch 1 (168→286) not taken.
✓ Branch 2 (169→170) taken 132 times.
✗ Branch 3 (169→286) not taken.
✓ Branch 4 (170→171) taken 132 times.
✗ Branch 5 (170→286) not taken.
✓ Branch 6 (171→172) taken 132 times.
✗ Branch 7 (171→286) not taken.
|
132 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1173 |
8/14✓ Branch 0 (172→173) taken 132 times.
✗ Branch 1 (172→309) not taken.
✓ Branch 2 (173→174) taken 101 times.
✓ Branch 3 (173→177) taken 31 times.
✓ Branch 4 (174→175) taken 101 times.
✗ Branch 5 (174→309) not taken.
✓ Branch 6 (175→176) taken 101 times.
✗ Branch 7 (175→177) not taken.
✓ Branch 8 (178→179) taken 132 times.
✗ Branch 9 (178→287) not taken.
✓ Branch 10 (179→180) taken 132 times.
✗ Branch 11 (179→287) not taken.
✓ Branch 12 (180→181) taken 132 times.
✗ Branch 13 (180→287) not taken.
|
132 | return {.value = builder.CreateAdd(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1174 | } | ||
| 1175 | 1737 | case COMB(TY_LONG, TY_LONG): | |
| 1176 |
10/16✓ Branch 0 (183→184) taken 1737 times.
✗ Branch 1 (183→309) not taken.
✓ Branch 2 (184→185) taken 192 times.
✓ Branch 3 (184→188) taken 1545 times.
✓ Branch 4 (185→186) taken 192 times.
✗ Branch 5 (185→309) not taken.
✓ Branch 6 (186→187) taken 31 times.
✓ Branch 7 (186→188) taken 161 times.
✓ Branch 8 (189→190) taken 1737 times.
✗ Branch 9 (189→288) not taken.
✓ Branch 10 (190→191) taken 1737 times.
✗ Branch 11 (190→288) not taken.
✓ Branch 12 (191→192) taken 1737 times.
✗ Branch 13 (191→288) not taken.
✓ Branch 14 (192→193) taken 1737 times.
✗ Branch 15 (192→288) not taken.
|
1737 | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1177 | ✗ | case COMB(TY_LONG, TY_PTR): { | |
| 1178 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1179 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1180 | } | ||
| 1181 | ✗ | case COMB(TY_BYTE, TY_BYTE): // fallthrough | |
| 1182 | case COMB(TY_CHAR, TY_CHAR): | ||
| 1183 | ✗ | return {.value = builder.CreateAdd(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1184 | 474 | case COMB(TY_PTR, TY_INT): // fallthrough | |
| 1185 | case COMB(TY_PTR, TY_SHORT): // fallthrough | ||
| 1186 | case COMB(TY_PTR, TY_LONG): { | ||
| 1187 |
5/10✓ Branch 0 (221→222) taken 474 times.
✗ Branch 1 (221→295) not taken.
✓ Branch 2 (222→223) taken 474 times.
✗ Branch 3 (222→295) not taken.
✓ Branch 4 (223→224) taken 474 times.
✗ Branch 5 (223→295) not taken.
✓ Branch 6 (224→225) taken 474 times.
✗ Branch 7 (224→295) not taken.
✓ Branch 8 (225→226) taken 474 times.
✗ Branch 9 (225→295) not taken.
|
474 | llvm::Value *rhsExt = builder.CreateIntCast(rhsV(), builder.getInt64Ty(), rhsSTy.isSigned()); |
| 1188 |
5/10✓ Branch 0 (227→228) taken 474 times.
✗ Branch 1 (227→298) not taken.
✓ Branch 2 (229→230) taken 474 times.
✗ Branch 3 (229→297) not taken.
✓ Branch 4 (230→231) taken 474 times.
✗ Branch 5 (230→296) not taken.
✓ Branch 6 (231→232) taken 474 times.
✗ Branch 7 (231→296) not taken.
✓ Branch 8 (232→233) taken 474 times.
✗ Branch 9 (232→296) not taken.
|
474 | return {.value = builder.CreateGEP(lhsSTy.getContained().toLLVMType(irGenerator->sourceFile), lhsV(), rhsExt)}; |
| 1189 | } | ||
| 1190 | − | default: // GCOV_EXCL_LINE | |
| 1191 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: +"); // GCOV_EXCL_LINE | |
| 1192 | } | ||
| 1193 |
5/14✓ Branch 0 (12→13) taken 62 times.
✗ Branch 1 (12→255) not taken.
✓ Branch 2 (13→14) taken 62 times.
✗ Branch 3 (13→255) not taken.
✓ Branch 4 (14→15) taken 62 times.
✗ Branch 5 (14→255) not taken.
✓ Branch 6 (15→16) taken 62 times.
✗ Branch 7 (15→255) not taken.
✓ Branch 8 (16→17) taken 62 times.
✗ Branch 9 (16→253) not taken.
✗ Branch 10 (255→256) not taken.
✗ Branch 11 (255→259) not taken.
✗ Branch 12 (257→258) not taken.
✗ Branch 13 (257→259) not taken.
|
2715 | } |
| 1194 | |||
| 1195 | 1673 | LLVMExprResult OpRuleConversionManager::getMinusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1196 | LLVMExprResult &rhs, QualType rhsSTy, size_t opIdx) { | ||
| 1197 |
1/2✓ Branch 0 (2→3) taken 1673 times.
✗ Branch 1 (2→249) not taken.
|
3346 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1198 |
1/2✓ Branch 0 (3→4) taken 1673 times.
✗ Branch 1 (3→250) not taken.
|
3346 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1199 | 1673 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1200 | 1673 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1201 |
1/2✓ Branch 0 (6→7) taken 1673 times.
✗ Branch 1 (6→251) not taken.
|
1673 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1202 |
1/2✓ Branch 0 (7→8) taken 1673 times.
✗ Branch 1 (7→252) not taken.
|
1673 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1203 |
1/2✓ Branch 0 (8→9) taken 1673 times.
✗ Branch 1 (8→309) not taken.
|
1673 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1204 |
1/2✓ Branch 0 (9→10) taken 1673 times.
✗ Branch 1 (9→309) not taken.
|
1673 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1205 | |||
| 1206 | // Handle operator overloads | ||
| 1207 |
3/4✓ Branch 0 (10→11) taken 1673 times.
✗ Branch 1 (10→309) not taken.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 3 (11→20) taken 1672 times.
|
1673 | if (callsOverloadedOpFct(node, opIdx)) |
| 1208 | 1 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1209 | |||
| 1210 |
6/21✓ Branch 0 (20→21) taken 1672 times.
✗ Branch 1 (20→309) not taken.
✗ Branch 2 (21→22) not taken.
✓ Branch 3 (21→28) taken 8 times.
✗ Branch 4 (21→35) not taken.
✓ Branch 5 (21→42) taken 32 times.
✗ Branch 6 (21→54) not taken.
✗ Branch 7 (21→69) not taken.
✗ Branch 8 (21→84) not taken.
✗ Branch 9 (21→98) not taken.
✗ Branch 10 (21→105) not taken.
✓ Branch 11 (21→120) taken 4 times.
✗ Branch 12 (21→132) not taken.
✗ Branch 13 (21→147) not taken.
✗ Branch 14 (21→161) not taken.
✓ Branch 15 (21→168) taken 57 times.
✓ Branch 16 (21→183) taken 1571 times.
✗ Branch 17 (21→195) not taken.
✗ Branch 18 (21→209) not taken.
✗ Branch 19 (21→221) not taken.
✗ Branch 20 (21→235) not taken.
|
1672 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1211 | ✗ | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 1212 | ✗ | return {.value = builder.CreateFSub(lhsV(), rhsV())}; | |
| 1213 | 8 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 1214 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 1215 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 1216 |
2/4✓ Branch 0 (28→29) taken 8 times.
✗ Branch 1 (28→309) not taken.
✓ Branch 2 (29→30) taken 8 times.
✗ Branch 3 (29→309) not taken.
|
8 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 1217 |
3/6✓ Branch 0 (30→31) taken 8 times.
✗ Branch 1 (30→262) not taken.
✓ Branch 2 (31→32) taken 8 times.
✗ Branch 3 (31→262) not taken.
✓ Branch 4 (32→33) taken 8 times.
✗ Branch 5 (32→262) not taken.
|
8 | return {.value = builder.CreateFSub(lhsV(), rhsFP)}; |
| 1218 | } | ||
| 1219 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 1220 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1221 | ✗ | return {.value = builder.CreateFSub(lhsFP, rhsV())}; | |
| 1222 | } | ||
| 1223 | 32 | case COMB(TY_INT, TY_INT): | |
| 1224 |
8/16✓ Branch 0 (42→43) taken 32 times.
✗ Branch 1 (42→309) not taken.
✓ Branch 2 (43→44) taken 32 times.
✗ Branch 3 (43→47) not taken.
✓ Branch 4 (44→45) taken 32 times.
✗ Branch 5 (44→309) not taken.
✓ Branch 6 (45→46) taken 32 times.
✗ Branch 7 (45→47) not taken.
✓ Branch 8 (48→49) taken 32 times.
✗ Branch 9 (48→264) not taken.
✓ Branch 10 (49→50) taken 32 times.
✗ Branch 11 (49→264) not taken.
✓ Branch 12 (50→51) taken 32 times.
✗ Branch 13 (50→264) not taken.
✓ Branch 14 (51→52) taken 32 times.
✗ Branch 15 (51→264) not taken.
|
32 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1225 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 1226 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1227 | ✗ | return {.value = builder.CreateSub(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1228 | } | ||
| 1229 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 1230 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1231 | ✗ | return {.value = builder.CreateSub(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1232 | } | ||
| 1233 | ✗ | case COMB(TY_INT, TY_PTR): { | |
| 1234 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1235 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1236 | } | ||
| 1237 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 1238 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1239 | ✗ | return {.value = builder.CreateFSub(lhsFP, rhsV())}; | |
| 1240 | } | ||
| 1241 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 1242 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1243 | ✗ | return {.value = builder.CreateSub(lhsInt, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1244 | } | ||
| 1245 | 4 | case COMB(TY_SHORT, TY_SHORT): | |
| 1246 |
9/16✓ Branch 0 (120→121) taken 4 times.
✗ Branch 1 (120→309) not taken.
✓ Branch 2 (121→122) taken 3 times.
✓ Branch 3 (121→125) taken 1 times.
✓ Branch 4 (122→123) taken 3 times.
✗ Branch 5 (122→309) not taken.
✓ Branch 6 (123→124) taken 3 times.
✗ Branch 7 (123→125) not taken.
✓ Branch 8 (126→127) taken 4 times.
✗ Branch 9 (126→277) not taken.
✓ Branch 10 (127→128) taken 4 times.
✗ Branch 11 (127→277) not taken.
✓ Branch 12 (128→129) taken 4 times.
✗ Branch 13 (128→277) not taken.
✓ Branch 14 (129→130) taken 4 times.
✗ Branch 15 (129→277) not taken.
|
4 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1247 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 1248 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1249 | ✗ | return {.value = builder.CreateSub(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1250 | } | ||
| 1251 | ✗ | case COMB(TY_SHORT, TY_PTR): { | |
| 1252 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1253 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1254 | } | ||
| 1255 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 1256 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1257 | ✗ | return {.value = builder.CreateFSub(lhsFP, rhsV())}; | |
| 1258 | } | ||
| 1259 | 57 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1260 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1261 |
4/8✓ Branch 0 (168→169) taken 57 times.
✗ Branch 1 (168→286) not taken.
✓ Branch 2 (169→170) taken 57 times.
✗ Branch 3 (169→286) not taken.
✓ Branch 4 (170→171) taken 57 times.
✗ Branch 5 (170→286) not taken.
✓ Branch 6 (171→172) taken 57 times.
✗ Branch 7 (171→286) not taken.
|
57 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1262 |
8/14✓ Branch 0 (172→173) taken 57 times.
✗ Branch 1 (172→309) not taken.
✓ Branch 2 (173→174) taken 11 times.
✓ Branch 3 (173→177) taken 46 times.
✓ Branch 4 (174→175) taken 11 times.
✗ Branch 5 (174→309) not taken.
✓ Branch 6 (175→176) taken 11 times.
✗ Branch 7 (175→177) not taken.
✓ Branch 8 (178→179) taken 57 times.
✗ Branch 9 (178→287) not taken.
✓ Branch 10 (179→180) taken 57 times.
✗ Branch 11 (179→287) not taken.
✓ Branch 12 (180→181) taken 57 times.
✗ Branch 13 (180→287) not taken.
|
57 | return {.value = builder.CreateSub(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1263 | } | ||
| 1264 | 1571 | case COMB(TY_LONG, TY_LONG): | |
| 1265 |
10/16✓ Branch 0 (183→184) taken 1571 times.
✗ Branch 1 (183→309) not taken.
✓ Branch 2 (184→185) taken 254 times.
✓ Branch 3 (184→188) taken 1317 times.
✓ Branch 4 (185→186) taken 254 times.
✗ Branch 5 (185→309) not taken.
✓ Branch 6 (186→187) taken 89 times.
✓ Branch 7 (186→188) taken 165 times.
✓ Branch 8 (189→190) taken 1571 times.
✗ Branch 9 (189→288) not taken.
✓ Branch 10 (190→191) taken 1571 times.
✗ Branch 11 (190→288) not taken.
✓ Branch 12 (191→192) taken 1571 times.
✗ Branch 13 (191→288) not taken.
✓ Branch 14 (192→193) taken 1571 times.
✗ Branch 15 (192→288) not taken.
|
1571 | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1266 | ✗ | case COMB(TY_LONG, TY_PTR): { | |
| 1267 | ✗ | llvm::Value *lhsExt = builder.CreateIntCast(lhsV(), builder.getInt64Ty(), lhsSTy.isSigned()); | |
| 1268 | ✗ | return {.value = builder.CreateGEP(rhsSTy.getContained().toLLVMType(irGenerator->sourceFile), rhsV(), lhsExt)}; | |
| 1269 | } | ||
| 1270 | ✗ | case COMB(TY_BYTE, TY_BYTE): // fallthrough | |
| 1271 | case COMB(TY_CHAR, TY_CHAR): | ||
| 1272 | ✗ | return {.value = builder.CreateSub(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1273 | ✗ | case COMB(TY_PTR, TY_INT): // fallthrough | |
| 1274 | case COMB(TY_PTR, TY_SHORT): // fallthrough | ||
| 1275 | case COMB(TY_PTR, TY_LONG): { | ||
| 1276 | ✗ | llvm::Value *rhsExt = builder.CreateIntCast(rhsV(), builder.getInt64Ty(), rhsSTy.isSigned()); | |
| 1277 | ✗ | return {.value = builder.CreateGEP(lhsSTy.getContained().toLLVMType(irGenerator->sourceFile), lhsV(), rhsExt)}; | |
| 1278 | } | ||
| 1279 | − | default: // GCOV_EXCL_LINE | |
| 1280 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: -"); // GCOV_EXCL_LINE | |
| 1281 | } | ||
| 1282 |
5/14✓ Branch 0 (12→13) taken 1 times.
✗ Branch 1 (12→255) not taken.
✓ Branch 2 (13→14) taken 1 times.
✗ Branch 3 (13→255) not taken.
✓ Branch 4 (14→15) taken 1 times.
✗ Branch 5 (14→255) not taken.
✓ Branch 6 (15→16) taken 1 times.
✗ Branch 7 (15→255) not taken.
✓ Branch 8 (16→17) taken 1 times.
✗ Branch 9 (16→253) not taken.
✗ Branch 10 (255→256) not taken.
✗ Branch 11 (255→259) not taken.
✗ Branch 12 (257→258) not taken.
✗ Branch 13 (257→259) not taken.
|
1674 | } |
| 1283 | |||
| 1284 | 690 | LLVMExprResult OpRuleConversionManager::getMulInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, LLVMExprResult &rhs, | |
| 1285 | QualType rhsSTy, size_t opIdx) { | ||
| 1286 |
1/2✓ Branch 0 (2→3) taken 690 times.
✗ Branch 1 (2→181) not taken.
|
1375 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1287 |
1/2✓ Branch 0 (3→4) taken 690 times.
✗ Branch 1 (3→182) not taken.
|
1377 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1288 | 695 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1289 | 693 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1290 |
1/2✓ Branch 0 (6→7) taken 690 times.
✗ Branch 1 (6→183) not taken.
|
690 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1291 |
1/2✓ Branch 0 (7→8) taken 690 times.
✗ Branch 1 (7→184) not taken.
|
690 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1292 |
1/2✓ Branch 0 (8→9) taken 690 times.
✗ Branch 1 (8→220) not taken.
|
690 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1293 |
1/2✓ Branch 0 (9→10) taken 690 times.
✗ Branch 1 (9→220) not taken.
|
690 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1294 | |||
| 1295 | // Handle operator overloads | ||
| 1296 |
3/4✓ Branch 0 (10→11) taken 690 times.
✗ Branch 1 (10→220) not taken.
✓ Branch 2 (11→12) taken 9 times.
✓ Branch 3 (11→20) taken 681 times.
|
690 | if (callsOverloadedOpFct(node, opIdx)) |
| 1297 | 9 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1298 | |||
| 1299 |
8/16✓ Branch 0 (20→21) taken 681 times.
✗ Branch 1 (20→220) not taken.
✓ Branch 2 (21→22) taken 17 times.
✓ Branch 3 (21→28) taken 2 times.
✗ Branch 4 (21→35) not taken.
✓ Branch 5 (21→42) taken 28 times.
✗ Branch 6 (21→54) not taken.
✓ Branch 7 (21→69) taken 2 times.
✗ Branch 8 (21→84) not taken.
✗ Branch 9 (21→91) not taken.
✗ Branch 10 (21→106) not taken.
✓ Branch 11 (21→118) taken 1 times.
✗ Branch 12 (21→133) not taken.
✓ Branch 13 (21→140) taken 511 times.
✓ Branch 14 (21→155) taken 120 times.
✗ Branch 15 (21→167) not taken.
|
681 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1300 | 17 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 1301 |
4/8✓ Branch 0 (22→23) taken 17 times.
✗ Branch 1 (22→193) not taken.
✓ Branch 2 (23→24) taken 17 times.
✗ Branch 3 (23→193) not taken.
✓ Branch 4 (24→25) taken 17 times.
✗ Branch 5 (24→193) not taken.
✓ Branch 6 (25→26) taken 17 times.
✗ Branch 7 (25→193) not taken.
|
17 | return {.value = builder.CreateFMul(lhsV(), rhsV())}; |
| 1302 | 2 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 1303 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 1304 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 1305 |
2/4✓ Branch 0 (28→29) taken 2 times.
✗ Branch 1 (28→220) not taken.
✓ Branch 2 (29→30) taken 2 times.
✗ Branch 3 (29→220) not taken.
|
2 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 1306 |
3/6✓ Branch 0 (30→31) taken 2 times.
✗ Branch 1 (30→194) not taken.
✓ Branch 2 (31→32) taken 2 times.
✗ Branch 3 (31→194) not taken.
✓ Branch 4 (32→33) taken 2 times.
✗ Branch 5 (32→194) not taken.
|
2 | return {.value = builder.CreateFMul(lhsV(), rhsFP)}; |
| 1307 | } | ||
| 1308 | ✗ | case COMB(TY_INT, TY_DOUBLE): { | |
| 1309 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1310 | ✗ | return {.value = builder.CreateFMul(lhsFP, rhsV())}; | |
| 1311 | } | ||
| 1312 | 28 | case COMB(TY_INT, TY_INT): | |
| 1313 |
10/16✓ Branch 0 (42→43) taken 28 times.
✗ Branch 1 (42→220) not taken.
✓ Branch 2 (43→44) taken 26 times.
✓ Branch 3 (43→47) taken 2 times.
✓ Branch 4 (44→45) taken 26 times.
✗ Branch 5 (44→220) not taken.
✓ Branch 6 (45→46) taken 9 times.
✓ Branch 7 (45→47) taken 17 times.
✓ Branch 8 (48→49) taken 28 times.
✗ Branch 9 (48→196) not taken.
✓ Branch 10 (49→50) taken 28 times.
✗ Branch 11 (49→196) not taken.
✓ Branch 12 (50→51) taken 28 times.
✗ Branch 13 (50→196) not taken.
✓ Branch 14 (51→52) taken 28 times.
✗ Branch 15 (51→196) not taken.
|
28 | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1314 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 1315 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1316 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsInt, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1317 | } | ||
| 1318 | 2 | case COMB(TY_INT, TY_LONG): { | |
| 1319 |
4/8✓ Branch 0 (69→70) taken 2 times.
✗ Branch 1 (69→199) not taken.
✓ Branch 2 (70→71) taken 2 times.
✗ Branch 3 (70→199) not taken.
✓ Branch 4 (71→72) taken 2 times.
✗ Branch 5 (71→199) not taken.
✓ Branch 6 (72→73) taken 2 times.
✗ Branch 7 (72→199) not taken.
|
2 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 1320 |
7/14✓ Branch 0 (73→74) taken 2 times.
✗ Branch 1 (73→220) not taken.
✓ Branch 2 (74→75) taken 2 times.
✗ Branch 3 (74→78) not taken.
✓ Branch 4 (75→76) taken 2 times.
✗ Branch 5 (75→220) not taken.
✗ Branch 6 (76→77) not taken.
✓ Branch 7 (76→78) taken 2 times.
✓ Branch 8 (79→80) taken 2 times.
✗ Branch 9 (79→200) not taken.
✓ Branch 10 (80→81) taken 2 times.
✗ Branch 11 (80→200) not taken.
✓ Branch 12 (81→82) taken 2 times.
✗ Branch 13 (81→200) not taken.
|
2 | return {.value = builder.CreateMul(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1321 | } | ||
| 1322 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 1323 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1324 | ✗ | return {.value = builder.CreateFMul(lhsFP, rhsV())}; | |
| 1325 | } | ||
| 1326 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 1327 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1328 | ✗ | return {.value = builder.CreateMul(lhsInt, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1329 | } | ||
| 1330 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 1331 | ✗ | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; | |
| 1332 | 1 | case COMB(TY_SHORT, TY_LONG): { | |
| 1333 |
4/8✓ Branch 0 (118→119) taken 1 times.
✗ Branch 1 (118→205) not taken.
✓ Branch 2 (119→120) taken 1 times.
✗ Branch 3 (119→205) not taken.
✓ Branch 4 (120→121) taken 1 times.
✗ Branch 5 (120→205) not taken.
✓ Branch 6 (121→122) taken 1 times.
✗ Branch 7 (121→205) not taken.
|
1 | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 1334 |
7/14✓ Branch 0 (122→123) taken 1 times.
✗ Branch 1 (122→220) not taken.
✓ Branch 2 (123→124) taken 1 times.
✗ Branch 3 (123→127) not taken.
✓ Branch 4 (124→125) taken 1 times.
✗ Branch 5 (124→220) not taken.
✗ Branch 6 (125→126) not taken.
✓ Branch 7 (125→127) taken 1 times.
✓ Branch 8 (128→129) taken 1 times.
✗ Branch 9 (128→206) not taken.
✓ Branch 10 (129→130) taken 1 times.
✗ Branch 11 (129→206) not taken.
✓ Branch 12 (130→131) taken 1 times.
✗ Branch 13 (130→206) not taken.
|
1 | return {.value = builder.CreateMul(lhsLong, rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1335 | } | ||
| 1336 | ✗ | case COMB(TY_LONG, TY_DOUBLE): { | |
| 1337 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1338 | ✗ | return {.value = builder.CreateFMul(lhsFP, rhsV())}; | |
| 1339 | } | ||
| 1340 | 511 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1341 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1342 |
4/8✓ Branch 0 (140→141) taken 511 times.
✗ Branch 1 (140→208) not taken.
✓ Branch 2 (141→142) taken 511 times.
✗ Branch 3 (141→208) not taken.
✓ Branch 4 (142→143) taken 511 times.
✗ Branch 5 (142→208) not taken.
✓ Branch 6 (143→144) taken 511 times.
✗ Branch 7 (143→208) not taken.
|
511 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1343 |
8/14✓ Branch 0 (144→145) taken 511 times.
✗ Branch 1 (144→220) not taken.
✓ Branch 2 (145→146) taken 3 times.
✓ Branch 3 (145→149) taken 508 times.
✓ Branch 4 (146→147) taken 3 times.
✗ Branch 5 (146→220) not taken.
✓ Branch 6 (147→148) taken 3 times.
✗ Branch 7 (147→149) not taken.
✓ Branch 8 (150→151) taken 511 times.
✗ Branch 9 (150→209) not taken.
✓ Branch 10 (151→152) taken 511 times.
✗ Branch 11 (151→209) not taken.
✓ Branch 12 (152→153) taken 511 times.
✗ Branch 13 (152→209) not taken.
|
511 | return {.value = builder.CreateMul(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1344 | } | ||
| 1345 | 120 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 1346 | case COMB(TY_BYTE, TY_BYTE): | ||
| 1347 |
10/16✓ Branch 0 (155→156) taken 120 times.
✗ Branch 1 (155→220) not taken.
✓ Branch 2 (156→157) taken 47 times.
✓ Branch 3 (156→160) taken 73 times.
✓ Branch 4 (157→158) taken 47 times.
✗ Branch 5 (157→220) not taken.
✓ Branch 6 (158→159) taken 17 times.
✓ Branch 7 (158→160) taken 30 times.
✓ Branch 8 (161→162) taken 120 times.
✗ Branch 9 (161→210) not taken.
✓ Branch 10 (162→163) taken 120 times.
✗ Branch 11 (162→210) not taken.
✓ Branch 12 (163→164) taken 120 times.
✗ Branch 13 (163→210) not taken.
✓ Branch 14 (164→165) taken 120 times.
✗ Branch 15 (164→210) not taken.
|
120 | return {.value = builder.CreateMul(lhsV(), rhsV(), "", false, lhsSTy.isSigned() && rhsSTy.isSigned())}; |
| 1348 | − | default: // GCOV_EXCL_LINE | |
| 1349 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: *"); // GCOV_EXCL_LINE | |
| 1350 | } | ||
| 1351 |
5/14✓ Branch 0 (12→13) taken 9 times.
✗ Branch 1 (12→187) not taken.
✓ Branch 2 (13→14) taken 9 times.
✗ Branch 3 (13→187) not taken.
✓ Branch 4 (14→15) taken 9 times.
✗ Branch 5 (14→187) not taken.
✓ Branch 6 (15→16) taken 9 times.
✗ Branch 7 (15→187) not taken.
✓ Branch 8 (16→17) taken 9 times.
✗ Branch 9 (16→185) not taken.
✗ Branch 10 (187→188) not taken.
✗ Branch 11 (187→191) not taken.
✗ Branch 12 (189→190) not taken.
✗ Branch 13 (189→191) not taken.
|
699 | } |
| 1352 | |||
| 1353 | 126 | LLVMExprResult OpRuleConversionManager::getDivInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, LLVMExprResult &rhs, | |
| 1354 | QualType rhsSTy, size_t opIdx) { | ||
| 1355 |
1/2✓ Branch 0 (2→3) taken 126 times.
✗ Branch 1 (2→133) not taken.
|
250 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1356 |
1/2✓ Branch 0 (3→4) taken 126 times.
✗ Branch 1 (3→134) not taken.
|
252 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1357 | 128 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1358 | 126 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1359 |
1/2✓ Branch 0 (6→7) taken 126 times.
✗ Branch 1 (6→135) not taken.
|
126 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1360 |
1/2✓ Branch 0 (7→8) taken 126 times.
✗ Branch 1 (7→136) not taken.
|
126 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1361 |
1/2✓ Branch 0 (8→9) taken 126 times.
✗ Branch 1 (8→172) not taken.
|
126 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1362 |
1/2✓ Branch 0 (9→10) taken 126 times.
✗ Branch 1 (9→172) not taken.
|
126 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1363 | |||
| 1364 | // Handle operator overloads | ||
| 1365 |
3/4✓ Branch 0 (10→11) taken 126 times.
✗ Branch 1 (10→172) not taken.
✓ Branch 2 (11→12) taken 3 times.
✓ Branch 3 (11→20) taken 123 times.
|
126 | if (callsOverloadedOpFct(node, opIdx)) |
| 1366 | 3 | return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx); | |
| 1367 | |||
| 1368 |
9/16✓ Branch 0 (20→21) taken 123 times.
✗ Branch 1 (20→172) not taken.
✓ Branch 2 (21→22) taken 22 times.
✓ Branch 3 (21→28) taken 2 times.
✓ Branch 4 (21→35) taken 3 times.
✓ Branch 5 (21→42) taken 2 times.
✗ Branch 6 (21→48) not taken.
✗ Branch 7 (21→57) not taken.
✗ Branch 8 (21→66) not taken.
✓ Branch 9 (21→73) taken 2 times.
✗ Branch 10 (21→82) not taken.
✗ Branch 11 (21→88) not taken.
✓ Branch 12 (21→97) taken 2 times.
✓ Branch 13 (21→104) taken 5 times.
✓ Branch 14 (21→113) taken 85 times.
✗ Branch 15 (21→119) not taken.
|
123 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1369 | 22 | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 1370 |
4/8✓ Branch 0 (22→23) taken 22 times.
✗ Branch 1 (22→145) not taken.
✓ Branch 2 (23→24) taken 22 times.
✗ Branch 3 (23→145) not taken.
✓ Branch 4 (24→25) taken 22 times.
✗ Branch 5 (24→145) not taken.
✓ Branch 6 (25→26) taken 22 times.
✗ Branch 7 (25→145) not taken.
|
22 | return {.value = builder.CreateFDiv(lhsV(), rhsV())}; |
| 1371 | 2 | case COMB(TY_DOUBLE, TY_INT): // fallthrough | |
| 1372 | case COMB(TY_DOUBLE, TY_SHORT): // fallthrough | ||
| 1373 | case COMB(TY_DOUBLE, TY_LONG): { | ||
| 1374 |
2/4✓ Branch 0 (28→29) taken 2 times.
✗ Branch 1 (28→172) not taken.
✓ Branch 2 (29→30) taken 2 times.
✗ Branch 3 (29→172) not taken.
|
2 | llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT); |
| 1375 |
3/6✓ Branch 0 (30→31) taken 2 times.
✗ Branch 1 (30→146) not taken.
✓ Branch 2 (31→32) taken 2 times.
✗ Branch 3 (31→146) not taken.
✓ Branch 4 (32→33) taken 2 times.
✗ Branch 5 (32→146) not taken.
|
2 | return {.value = builder.CreateFDiv(lhsV(), rhsFP)}; |
| 1376 | } | ||
| 1377 | 3 | case COMB(TY_INT, TY_DOUBLE): { | |
| 1378 |
2/4✓ Branch 0 (35→36) taken 3 times.
✗ Branch 1 (35→172) not taken.
✓ Branch 2 (36→37) taken 3 times.
✗ Branch 3 (36→172) not taken.
|
3 | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); |
| 1379 |
3/6✓ Branch 0 (37→38) taken 3 times.
✗ Branch 1 (37→147) not taken.
✓ Branch 2 (38→39) taken 3 times.
✗ Branch 3 (38→147) not taken.
✓ Branch 4 (39→40) taken 3 times.
✗ Branch 5 (39→147) not taken.
|
3 | return {.value = builder.CreateFDiv(lhsFP, rhsV())}; |
| 1380 | } | ||
| 1381 | 2 | case COMB(TY_INT, TY_INT): | |
| 1382 |
4/8✓ Branch 0 (42→43) taken 2 times.
✗ Branch 1 (42→148) not taken.
✓ Branch 2 (43→44) taken 2 times.
✗ Branch 3 (43→148) not taken.
✓ Branch 4 (44→45) taken 2 times.
✗ Branch 5 (44→148) not taken.
✓ Branch 6 (45→46) taken 2 times.
✗ Branch 7 (45→148) not taken.
|
2 | return {.value = builder.CreateSDiv(lhsV(), rhsV())}; |
| 1383 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 1384 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1385 | ✗ | return {.value = builder.CreateSDiv(lhsV(), rhsInt)}; | |
| 1386 | } | ||
| 1387 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 1388 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1389 | ✗ | return {.value = builder.CreateSDiv(lhsLong, rhsV())}; | |
| 1390 | } | ||
| 1391 | ✗ | case COMB(TY_SHORT, TY_DOUBLE): { | |
| 1392 | ✗ | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); | |
| 1393 | ✗ | return {.value = builder.CreateFDiv(lhsFP, rhsV())}; | |
| 1394 | } | ||
| 1395 | 2 | case COMB(TY_SHORT, TY_INT): { | |
| 1396 |
4/8✓ Branch 0 (73→74) taken 2 times.
✗ Branch 1 (73→154) not taken.
✓ Branch 2 (74→75) taken 2 times.
✗ Branch 3 (74→154) not taken.
✓ Branch 4 (75→76) taken 2 times.
✗ Branch 5 (75→154) not taken.
✓ Branch 6 (76→77) taken 2 times.
✗ Branch 7 (76→154) not taken.
|
2 | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); |
| 1397 |
3/6✓ Branch 0 (77→78) taken 2 times.
✗ Branch 1 (77→155) not taken.
✓ Branch 2 (78→79) taken 2 times.
✗ Branch 3 (78→155) not taken.
✓ Branch 4 (79→80) taken 2 times.
✗ Branch 5 (79→155) not taken.
|
2 | return {.value = builder.CreateSDiv(lhsInt, rhsV())}; |
| 1398 | } | ||
| 1399 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 1400 | ✗ | return {.value = builder.CreateSDiv(lhsV(), rhsV())}; | |
| 1401 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 1402 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1403 | ✗ | return {.value = builder.CreateSDiv(lhsLong, rhsV())}; | |
| 1404 | } | ||
| 1405 | 2 | case COMB(TY_LONG, TY_DOUBLE): { | |
| 1406 |
2/4✓ Branch 0 (97→98) taken 2 times.
✗ Branch 1 (97→172) not taken.
✓ Branch 2 (98→99) taken 2 times.
✗ Branch 3 (98→172) not taken.
|
2 | llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT); |
| 1407 |
3/6✓ Branch 0 (99→100) taken 2 times.
✗ Branch 1 (99→159) not taken.
✓ Branch 2 (100→101) taken 2 times.
✗ Branch 3 (100→159) not taken.
✓ Branch 4 (101→102) taken 2 times.
✗ Branch 5 (101→159) not taken.
|
2 | return {.value = builder.CreateFDiv(lhsFP, rhsV())}; |
| 1408 | } | ||
| 1409 | 5 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1410 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1411 |
4/8✓ Branch 0 (104→105) taken 5 times.
✗ Branch 1 (104→160) not taken.
✓ Branch 2 (105→106) taken 5 times.
✗ Branch 3 (105→160) not taken.
✓ Branch 4 (106→107) taken 5 times.
✗ Branch 5 (106→160) not taken.
✓ Branch 6 (107→108) taken 5 times.
✗ Branch 7 (107→160) not taken.
|
5 | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); |
| 1412 |
3/6✓ Branch 0 (108→109) taken 5 times.
✗ Branch 1 (108→161) not taken.
✓ Branch 2 (109→110) taken 5 times.
✗ Branch 3 (109→161) not taken.
✓ Branch 4 (110→111) taken 5 times.
✗ Branch 5 (110→161) not taken.
|
5 | return {.value = builder.CreateSDiv(lhsV(), rhsLong)}; |
| 1413 | } | ||
| 1414 | 85 | case COMB(TY_LONG, TY_LONG): // fallthrough | |
| 1415 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 1416 | case COMB(TY_CHAR, TY_CHAR): | ||
| 1417 |
4/8✓ Branch 0 (113→114) taken 85 times.
✗ Branch 1 (113→162) not taken.
✓ Branch 2 (114→115) taken 85 times.
✗ Branch 3 (114→162) not taken.
✓ Branch 4 (115→116) taken 85 times.
✗ Branch 5 (115→162) not taken.
✓ Branch 6 (116→117) taken 85 times.
✗ Branch 7 (116→162) not taken.
|
85 | return {.value = builder.CreateSDiv(lhsV(), rhsV())}; |
| 1418 | − | default: // GCOV_EXCL_LINE | |
| 1419 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: /"); // GCOV_EXCL_LINE | |
| 1420 | } | ||
| 1421 |
5/14✓ Branch 0 (12→13) taken 3 times.
✗ Branch 1 (12→139) not taken.
✓ Branch 2 (13→14) taken 3 times.
✗ Branch 3 (13→139) not taken.
✓ Branch 4 (14→15) taken 3 times.
✗ Branch 5 (14→139) not taken.
✓ Branch 6 (15→16) taken 3 times.
✗ Branch 7 (15→139) not taken.
✓ Branch 8 (16→17) taken 3 times.
✗ Branch 9 (16→137) not taken.
✗ Branch 10 (139→140) not taken.
✗ Branch 11 (139→143) not taken.
✗ Branch 12 (141→142) not taken.
✗ Branch 13 (141→143) not taken.
|
129 | } |
| 1422 | |||
| 1423 | 12 | LLVMExprResult OpRuleConversionManager::getRemInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, LLVMExprResult &rhs, | |
| 1424 | QualType rhsSTy) const { | ||
| 1425 |
1/2✓ Branch 0 (2→3) taken 12 times.
✗ Branch 1 (2→75) not taken.
|
24 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1426 |
1/2✓ Branch 0 (3→4) taken 12 times.
✗ Branch 1 (3→76) not taken.
|
24 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1427 |
1/2✓ Branch 0 (4→5) taken 12 times.
✗ Branch 1 (4→77) not taken.
|
12 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1428 |
1/2✓ Branch 0 (5→6) taken 12 times.
✗ Branch 1 (5→78) not taken.
|
12 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1429 |
1/2✓ Branch 0 (6→7) taken 12 times.
✗ Branch 1 (6→94) not taken.
|
12 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1430 |
1/2✓ Branch 0 (7→8) taken 12 times.
✗ Branch 1 (7→94) not taken.
|
12 | llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1431 | |||
| 1432 |
3/12✓ Branch 0 (8→9) taken 12 times.
✗ Branch 1 (8→94) not taken.
✗ Branch 2 (9→10) not taken.
✓ Branch 3 (9→16) taken 3 times.
✗ Branch 4 (9→20) not taken.
✗ Branch 5 (9→27) not taken.
✗ Branch 6 (9→34) not taken.
✗ Branch 7 (9→41) not taken.
✗ Branch 8 (9→45) not taken.
✗ Branch 9 (9→52) not taken.
✓ Branch 10 (9→59) taken 9 times.
✗ Branch 11 (9→63) not taken.
|
12 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1433 | ✗ | case COMB(TY_DOUBLE, TY_DOUBLE): | |
| 1434 | ✗ | return {.value = builder.CreateFRem(lhsV(), rhsV())}; | |
| 1435 | 3 | case COMB(TY_INT, TY_INT): | |
| 1436 |
3/6✓ Branch 0 (16→17) taken 3 times.
✗ Branch 1 (16→94) not taken.
✓ Branch 2 (17→18) taken 3 times.
✗ Branch 3 (17→94) not taken.
✓ Branch 4 (18→19) taken 3 times.
✗ Branch 5 (18→94) not taken.
|
3 | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 1437 | ✗ | case COMB(TY_INT, TY_SHORT): { | |
| 1438 | ✗ | llvm::Value *rhsInt = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1439 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsInt)}; | |
| 1440 | } | ||
| 1441 | ✗ | case COMB(TY_INT, TY_LONG): { | |
| 1442 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1443 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 1444 | } | ||
| 1445 | ✗ | case COMB(TY_SHORT, TY_INT): { | |
| 1446 | ✗ | llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1447 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsInt, rhsV())}; | |
| 1448 | } | ||
| 1449 | ✗ | case COMB(TY_SHORT, TY_SHORT): | |
| 1450 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsV())}; | |
| 1451 | ✗ | case COMB(TY_SHORT, TY_LONG): { | |
| 1452 | ✗ | llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned()); | |
| 1453 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsLong, rhsV())}; | |
| 1454 | } | ||
| 1455 | ✗ | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1456 | case COMB(TY_LONG, TY_SHORT): { | ||
| 1457 | ✗ | llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned()); | |
| 1458 | ✗ | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsLong)}; | |
| 1459 | } | ||
| 1460 | 9 | case COMB(TY_LONG, TY_LONG): | |
| 1461 |
3/6✓ Branch 0 (59→60) taken 9 times.
✗ Branch 1 (59→94) not taken.
✓ Branch 2 (60→61) taken 9 times.
✗ Branch 3 (60→94) not taken.
✓ Branch 4 (61→62) taken 9 times.
✗ Branch 5 (61→94) not taken.
|
9 | return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsV())}; |
| 1462 | − | default: // GCOV_EXCL_LINE | |
| 1463 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: %"); // GCOV_EXCL_LINE | |
| 1464 | } | ||
| 1465 | 12 | } | |
| 1466 | |||
| 1467 | 16 | LLVMExprResult OpRuleConversionManager::getPrefixMinusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const { | |
| 1468 |
1/2✓ Branch 0 (2→3) taken 16 times.
✗ Branch 1 (2→28) not taken.
|
32 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1469 |
1/2✓ Branch 0 (3→4) taken 16 times.
✗ Branch 1 (3→29) not taken.
|
16 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1470 | |||
| 1471 |
3/5✓ Branch 0 (4→5) taken 16 times.
✗ Branch 1 (4→41) not taken.
✓ Branch 2 (5→6) taken 13 times.
✓ Branch 3 (5→11) taken 3 times.
✗ Branch 4 (5→16) not taken.
|
16 | switch (lhsSTy.getSuperType()) { |
| 1472 | 13 | case TY_DOUBLE: | |
| 1473 |
3/6✓ Branch 0 (6→7) taken 13 times.
✗ Branch 1 (6→30) not taken.
✓ Branch 2 (7→8) taken 13 times.
✗ Branch 3 (7→30) not taken.
✓ Branch 4 (8→9) taken 13 times.
✗ Branch 5 (8→30) not taken.
|
13 | return {.value = builder.CreateFNeg(lhsV())}; |
| 1474 | 3 | case TY_INT: // fallthrough | |
| 1475 | case TY_SHORT: // fallthrough | ||
| 1476 | case TY_LONG: | ||
| 1477 |
3/6✓ Branch 0 (11→12) taken 3 times.
✗ Branch 1 (11→31) not taken.
✓ Branch 2 (12→13) taken 3 times.
✗ Branch 3 (12→31) not taken.
✓ Branch 4 (13→14) taken 3 times.
✗ Branch 5 (13→31) not taken.
|
3 | return {.value = builder.CreateNeg(lhsV(), "")}; |
| 1478 | ✗ | default: | |
| 1479 | ✗ | break; | |
| 1480 | } | ||
| 1481 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: -"); // GCOV_EXCL_LINE | |
| 1482 | 16 | } | |
| 1483 | |||
| 1484 | 18 | LLVMExprResult OpRuleConversionManager::getPrefixPlusPlusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const { | |
| 1485 |
1/2✓ Branch 0 (2→3) taken 18 times.
✗ Branch 1 (2→49) not taken.
|
36 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1486 |
1/2✓ Branch 0 (3→4) taken 18 times.
✗ Branch 1 (3→50) not taken.
|
18 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1487 | |||
| 1488 |
3/7✓ Branch 0 (4→5) taken 18 times.
✗ Branch 1 (4→67) not taken.
✓ Branch 2 (5→6) taken 6 times.
✗ Branch 3 (5→13) not taken.
✓ Branch 4 (5→20) taken 12 times.
✗ Branch 5 (5→27) not taken.
✗ Branch 6 (5→37) not taken.
|
18 | switch (lhsSTy.getSuperType()) { |
| 1489 | 6 | case TY_INT: | |
| 1490 |
5/10✓ Branch 0 (6→7) taken 6 times.
✗ Branch 1 (6→67) not taken.
✓ Branch 2 (7→8) taken 6 times.
✗ Branch 3 (7→51) not taken.
✓ Branch 4 (8→9) taken 6 times.
✗ Branch 5 (8→51) not taken.
✓ Branch 6 (9→10) taken 6 times.
✗ Branch 7 (9→51) not taken.
✓ Branch 8 (10→11) taken 6 times.
✗ Branch 9 (10→51) not taken.
|
6 | return {.value = builder.CreateAdd(lhsV(), builder.getInt32(1), "", false, lhsSTy.isSigned())}; |
| 1491 | ✗ | case TY_SHORT: | |
| 1492 | ✗ | return {.value = builder.CreateAdd(lhsV(), builder.getInt16(1), "", false, lhsSTy.isSigned())}; | |
| 1493 | 12 | case TY_LONG: | |
| 1494 |
5/10✓ Branch 0 (20→21) taken 12 times.
✗ Branch 1 (20→67) not taken.
✓ Branch 2 (21→22) taken 12 times.
✗ Branch 3 (21→53) not taken.
✓ Branch 4 (22→23) taken 12 times.
✗ Branch 5 (22→53) not taken.
✓ Branch 6 (23→24) taken 12 times.
✗ Branch 7 (23→53) not taken.
✓ Branch 8 (24→25) taken 12 times.
✗ Branch 9 (24→53) not taken.
|
12 | return {.value = builder.CreateAdd(lhsV(), builder.getInt64(1), "", false, lhsSTy.isSigned())}; |
| 1495 | ✗ | case TY_PTR: { | |
| 1496 | ✗ | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); | |
| 1497 | ✗ | return {.value = builder.CreateGEP(elementTy, lhsV(), builder.getInt64(1))}; | |
| 1498 | } | ||
| 1499 | ✗ | default: | |
| 1500 | ✗ | break; | |
| 1501 | } | ||
| 1502 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ++ (prefix)"); // GCOV_EXCL_LINE | |
| 1503 | 18 | } | |
| 1504 | |||
| 1505 | 4 | LLVMExprResult OpRuleConversionManager::getPrefixMinusMinusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const { | |
| 1506 |
1/2✓ Branch 0 (2→3) taken 4 times.
✗ Branch 1 (2→49) not taken.
|
8 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1507 |
1/2✓ Branch 0 (3→4) taken 4 times.
✗ Branch 1 (3→50) not taken.
|
4 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1508 | |||
| 1509 |
3/7✓ Branch 0 (4→5) taken 4 times.
✗ Branch 1 (4→67) not taken.
✓ Branch 2 (5→6) taken 3 times.
✗ Branch 3 (5→13) not taken.
✓ Branch 4 (5→20) taken 1 times.
✗ Branch 5 (5→27) not taken.
✗ Branch 6 (5→37) not taken.
|
4 | switch (lhsSTy.getSuperType()) { |
| 1510 | 3 | case TY_INT: | |
| 1511 |
5/10✓ Branch 0 (6→7) taken 3 times.
✗ Branch 1 (6→67) not taken.
✓ Branch 2 (7→8) taken 3 times.
✗ Branch 3 (7→51) not taken.
✓ Branch 4 (8→9) taken 3 times.
✗ Branch 5 (8→51) not taken.
✓ Branch 6 (9→10) taken 3 times.
✗ Branch 7 (9→51) not taken.
✓ Branch 8 (10→11) taken 3 times.
✗ Branch 9 (10→51) not taken.
|
3 | return {.value = builder.CreateSub(lhsV(), builder.getInt32(1), "", false, lhsSTy.isSigned())}; |
| 1512 | ✗ | case TY_SHORT: | |
| 1513 | ✗ | return {.value = builder.CreateSub(lhsV(), builder.getInt16(1), "", false, lhsSTy.isSigned())}; | |
| 1514 | 1 | case TY_LONG: | |
| 1515 |
5/10✓ Branch 0 (20→21) taken 1 times.
✗ Branch 1 (20→67) not taken.
✓ Branch 2 (21→22) taken 1 times.
✗ Branch 3 (21→53) not taken.
✓ Branch 4 (22→23) taken 1 times.
✗ Branch 5 (22→53) not taken.
✓ Branch 6 (23→24) taken 1 times.
✗ Branch 7 (23→53) not taken.
✓ Branch 8 (24→25) taken 1 times.
✗ Branch 9 (24→53) not taken.
|
1 | return {.value = builder.CreateSub(lhsV(), builder.getInt64(1), "", false, lhsSTy.isSigned())}; |
| 1516 | ✗ | case TY_PTR: { | |
| 1517 | ✗ | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); | |
| 1518 | ✗ | return {.value = builder.CreateGEP(elementTy, lhsV(), builder.getInt64(-1))}; | |
| 1519 | } | ||
| 1520 | ✗ | default: | |
| 1521 | ✗ | break; | |
| 1522 | } | ||
| 1523 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: -- (prefix)"); // GCOV_EXCL_LINE | |
| 1524 | 4 | } | |
| 1525 | |||
| 1526 | 690 | LLVMExprResult OpRuleConversionManager::getPrefixNotInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const { | |
| 1527 |
1/2✓ Branch 0 (2→3) taken 690 times.
✗ Branch 1 (2→22) not taken.
|
1380 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1528 |
1/2✓ Branch 0 (3→4) taken 690 times.
✗ Branch 1 (3→23) not taken.
|
690 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1529 | |||
| 1530 |
2/4✓ Branch 0 (4→5) taken 690 times.
✗ Branch 1 (4→34) not taken.
✓ Branch 2 (5→6) taken 690 times.
✗ Branch 3 (5→12) not taken.
|
690 | switch (lhsSTy.getSuperType()) { |
| 1531 | 690 | case TY_BOOL: | |
| 1532 |
3/6✓ Branch 0 (6→7) taken 690 times.
✗ Branch 1 (6→24) not taken.
✓ Branch 2 (7→8) taken 690 times.
✗ Branch 3 (7→24) not taken.
✓ Branch 4 (8→9) taken 690 times.
✗ Branch 5 (8→24) not taken.
|
1380 | return {.value = builder.CreateNot(lhsV())}; |
| 1533 | ✗ | default: | |
| 1534 | ✗ | break; | |
| 1535 | } | ||
| 1536 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: !"); // GCOV_EXCL_LINE | |
| 1537 | 690 | } | |
| 1538 | |||
| 1539 | 1 | LLVMExprResult OpRuleConversionManager::getPrefixBitwiseNotInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const { | |
| 1540 |
1/2✓ Branch 0 (2→3) taken 1 times.
✗ Branch 1 (2→22) not taken.
|
2 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1541 |
1/2✓ Branch 0 (3→4) taken 1 times.
✗ Branch 1 (3→23) not taken.
|
1 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1542 | |||
| 1543 |
2/4✓ Branch 0 (4→5) taken 1 times.
✗ Branch 1 (4→34) not taken.
✓ Branch 2 (5→6) taken 1 times.
✗ Branch 3 (5→12) not taken.
|
1 | switch (lhsSTy.getSuperType()) { |
| 1544 | 1 | case TY_INT: // fallthrough | |
| 1545 | case TY_SHORT: // fallthrough | ||
| 1546 | case TY_LONG: | ||
| 1547 |
3/6✓ Branch 0 (6→7) taken 1 times.
✗ Branch 1 (6→24) not taken.
✓ Branch 2 (7→8) taken 1 times.
✗ Branch 3 (7→24) not taken.
✓ Branch 4 (8→9) taken 1 times.
✗ Branch 5 (8→24) not taken.
|
2 | return {.value = builder.CreateNot(lhsV())}; |
| 1548 | ✗ | default: | |
| 1549 | ✗ | break; | |
| 1550 | } | ||
| 1551 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ~"); // GCOV_EXCL_LINE | |
| 1552 | 1 | } | |
| 1553 | |||
| 1554 | 1603 | LLVMExprResult OpRuleConversionManager::getPostfixPlusPlusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1555 | size_t opIdx) { | ||
| 1556 |
1/2✓ Branch 0 (2→3) taken 1603 times.
✗ Branch 1 (2→59) not taken.
|
3197 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1557 | 1612 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1558 |
1/2✓ Branch 0 (4→5) taken 1603 times.
✗ Branch 1 (4→60) not taken.
|
1603 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1559 | |||
| 1560 | // Handle operator overloads | ||
| 1561 |
3/4✓ Branch 0 (5→6) taken 1603 times.
✗ Branch 1 (5→85) not taken.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 3 (6→13) taken 1594 times.
|
1603 | if (callsOverloadedOpFct(node, opIdx)) |
| 1562 | 9 | return callOperatorOverloadFct<1>(node, {lhsV, lhsP}, opIdx); | |
| 1563 | |||
| 1564 |
5/7✓ Branch 0 (13→14) taken 1594 times.
✗ Branch 1 (13→85) not taken.
✓ Branch 2 (14→15) taken 98 times.
✓ Branch 3 (14→22) taken 5 times.
✓ Branch 4 (14→29) taken 1483 times.
✓ Branch 5 (14→36) taken 8 times.
✗ Branch 6 (14→46) not taken.
|
1594 | switch (lhsSTy.getSuperType()) { |
| 1565 | 98 | case TY_INT: | |
| 1566 |
5/10✓ Branch 0 (15→16) taken 98 times.
✗ Branch 1 (15→85) not taken.
✓ Branch 2 (16→17) taken 98 times.
✗ Branch 3 (16→69) not taken.
✓ Branch 4 (17→18) taken 98 times.
✗ Branch 5 (17→69) not taken.
✓ Branch 6 (18→19) taken 98 times.
✗ Branch 7 (18→69) not taken.
✓ Branch 8 (19→20) taken 98 times.
✗ Branch 9 (19→69) not taken.
|
98 | return {.value = builder.CreateAdd(lhsV(), builder.getInt32(1), "", false, lhsSTy.isSigned())}; |
| 1567 | 5 | case TY_SHORT: | |
| 1568 |
5/10✓ Branch 0 (22→23) taken 5 times.
✗ Branch 1 (22→85) not taken.
✓ Branch 2 (23→24) taken 5 times.
✗ Branch 3 (23→70) not taken.
✓ Branch 4 (24→25) taken 5 times.
✗ Branch 5 (24→70) not taken.
✓ Branch 6 (25→26) taken 5 times.
✗ Branch 7 (25→70) not taken.
✓ Branch 8 (26→27) taken 5 times.
✗ Branch 9 (26→70) not taken.
|
5 | return {.value = builder.CreateAdd(lhsV(), builder.getInt16(1), "", false, lhsSTy.isSigned())}; |
| 1569 | 1483 | case TY_LONG: | |
| 1570 |
5/10✓ Branch 0 (29→30) taken 1483 times.
✗ Branch 1 (29→85) not taken.
✓ Branch 2 (30→31) taken 1483 times.
✗ Branch 3 (30→71) not taken.
✓ Branch 4 (31→32) taken 1483 times.
✗ Branch 5 (31→71) not taken.
✓ Branch 6 (32→33) taken 1483 times.
✗ Branch 7 (32→71) not taken.
✓ Branch 8 (33→34) taken 1483 times.
✗ Branch 9 (33→71) not taken.
|
1483 | return {.value = builder.CreateAdd(lhsV(), builder.getInt64(1), "", false, lhsSTy.isSigned())}; |
| 1571 | 8 | case TY_PTR: { | |
| 1572 |
2/4✓ Branch 0 (36→37) taken 8 times.
✗ Branch 1 (36→72) not taken.
✓ Branch 2 (37→38) taken 8 times.
✗ Branch 3 (37→72) not taken.
|
8 | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); |
| 1573 |
4/8✓ Branch 0 (39→40) taken 8 times.
✗ Branch 1 (39→75) not taken.
✓ Branch 2 (40→41) taken 8 times.
✗ Branch 3 (40→73) not taken.
✓ Branch 4 (42→43) taken 8 times.
✗ Branch 5 (42→73) not taken.
✓ Branch 6 (43→44) taken 8 times.
✗ Branch 7 (43→73) not taken.
|
8 | return {.value = builder.CreateGEP(elementTy, lhsV(), builder.getInt64(1))}; |
| 1574 | } | ||
| 1575 | ✗ | default: | |
| 1576 | ✗ | break; | |
| 1577 | } | ||
| 1578 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ++ (postfix)"); // GCOV_EXCL_LINE | |
| 1579 |
3/10✓ Branch 0 (7→8) taken 9 times.
✗ Branch 1 (7→63) not taken.
✓ Branch 2 (8→9) taken 9 times.
✗ Branch 3 (8→63) not taken.
✓ Branch 4 (9→10) taken 9 times.
✗ Branch 5 (9→61) not taken.
✗ Branch 6 (63→64) not taken.
✗ Branch 7 (63→67) not taken.
✗ Branch 8 (65→66) not taken.
✗ Branch 9 (65→67) not taken.
|
1612 | } |
| 1580 | |||
| 1581 | 362 | LLVMExprResult OpRuleConversionManager::getPostfixMinusMinusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, | |
| 1582 | size_t opIdx) { | ||
| 1583 |
1/2✓ Branch 0 (2→3) taken 362 times.
✗ Branch 1 (2→59) not taken.
|
717 | ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); }; |
| 1584 | 369 | ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); }; | |
| 1585 |
1/2✓ Branch 0 (4→5) taken 362 times.
✗ Branch 1 (4→60) not taken.
|
362 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1586 | |||
| 1587 | // Handle operator overloads | ||
| 1588 |
3/4✓ Branch 0 (5→6) taken 362 times.
✗ Branch 1 (5→85) not taken.
✓ Branch 2 (6→7) taken 7 times.
✓ Branch 3 (6→13) taken 355 times.
|
362 | if (callsOverloadedOpFct(node, opIdx)) |
| 1589 | 7 | return callOperatorOverloadFct<1>(node, {lhsV, lhsP}, opIdx); | |
| 1590 | |||
| 1591 |
5/7✓ Branch 0 (13→14) taken 355 times.
✗ Branch 1 (13→85) not taken.
✓ Branch 2 (14→15) taken 3 times.
✓ Branch 3 (14→22) taken 4 times.
✓ Branch 4 (14→29) taken 347 times.
✓ Branch 5 (14→36) taken 1 times.
✗ Branch 6 (14→46) not taken.
|
355 | switch (lhsSTy.getSuperType()) { |
| 1592 | 3 | case TY_INT: | |
| 1593 |
5/10✓ Branch 0 (15→16) taken 3 times.
✗ Branch 1 (15→85) not taken.
✓ Branch 2 (16→17) taken 3 times.
✗ Branch 3 (16→69) not taken.
✓ Branch 4 (17→18) taken 3 times.
✗ Branch 5 (17→69) not taken.
✓ Branch 6 (18→19) taken 3 times.
✗ Branch 7 (18→69) not taken.
✓ Branch 8 (19→20) taken 3 times.
✗ Branch 9 (19→69) not taken.
|
3 | return {.value = builder.CreateSub(lhsV(), builder.getInt32(1), "", false, lhsSTy.isSigned())}; |
| 1594 | 4 | case TY_SHORT: | |
| 1595 |
5/10✓ Branch 0 (22→23) taken 4 times.
✗ Branch 1 (22→85) not taken.
✓ Branch 2 (23→24) taken 4 times.
✗ Branch 3 (23→70) not taken.
✓ Branch 4 (24→25) taken 4 times.
✗ Branch 5 (24→70) not taken.
✓ Branch 6 (25→26) taken 4 times.
✗ Branch 7 (25→70) not taken.
✓ Branch 8 (26→27) taken 4 times.
✗ Branch 9 (26→70) not taken.
|
4 | return {.value = builder.CreateSub(lhsV(), builder.getInt16(1), "", false, lhsSTy.isSigned())}; |
| 1596 | 347 | case TY_LONG: | |
| 1597 |
5/10✓ Branch 0 (29→30) taken 347 times.
✗ Branch 1 (29→85) not taken.
✓ Branch 2 (30→31) taken 347 times.
✗ Branch 3 (30→71) not taken.
✓ Branch 4 (31→32) taken 347 times.
✗ Branch 5 (31→71) not taken.
✓ Branch 6 (32→33) taken 347 times.
✗ Branch 7 (32→71) not taken.
✓ Branch 8 (33→34) taken 347 times.
✗ Branch 9 (33→71) not taken.
|
347 | return {.value = builder.CreateSub(lhsV(), builder.getInt64(1), "", false, lhsSTy.isSigned())}; |
| 1598 | 1 | case TY_PTR: { | |
| 1599 |
2/4✓ Branch 0 (36→37) taken 1 times.
✗ Branch 1 (36→72) not taken.
✓ Branch 2 (37→38) taken 1 times.
✗ Branch 3 (37→72) not taken.
|
1 | llvm::Type *elementTy = lhsSTy.getContained().toLLVMType(irGenerator->sourceFile); |
| 1600 |
4/8✓ Branch 0 (39→40) taken 1 times.
✗ Branch 1 (39→75) not taken.
✓ Branch 2 (40→41) taken 1 times.
✗ Branch 3 (40→73) not taken.
✓ Branch 4 (42→43) taken 1 times.
✗ Branch 5 (42→73) not taken.
✓ Branch 6 (43→44) taken 1 times.
✗ Branch 7 (43→73) not taken.
|
1 | return {.value = builder.CreateGEP(elementTy, lhsV(), builder.getInt64(-1))}; |
| 1601 | } | ||
| 1602 | ✗ | default: | |
| 1603 | ✗ | break; | |
| 1604 | } | ||
| 1605 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: -- (postfix)"); // GCOV_EXCL_LINE | |
| 1606 |
3/10✓ Branch 0 (7→8) taken 7 times.
✗ Branch 1 (7→63) not taken.
✓ Branch 2 (8→9) taken 7 times.
✗ Branch 3 (8→63) not taken.
✓ Branch 4 (9→10) taken 7 times.
✗ Branch 5 (9→61) not taken.
✗ Branch 6 (63→64) not taken.
✗ Branch 7 (63→67) not taken.
✗ Branch 8 (65→66) not taken.
✗ Branch 9 (65→67) not taken.
|
369 | } |
| 1607 | |||
| 1608 | 2340 | LLVMExprResult OpRuleConversionManager::getCastInst(const ASTNode *node, QualType lhsSTy, LLVMExprResult &rhs, | |
| 1609 | QualType rhsSTy) const { | ||
| 1610 |
1/2✓ Branch 0 (2→3) taken 2340 times.
✗ Branch 1 (2→131) not taken.
|
4199 | ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); }; |
| 1611 | 2340 | ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); }; | |
| 1612 |
1/2✓ Branch 0 (4→5) taken 2340 times.
✗ Branch 1 (4→132) not taken.
|
2340 | lhsSTy = lhsSTy.removeReferenceWrapper(); |
| 1613 |
1/2✓ Branch 0 (5→6) taken 2340 times.
✗ Branch 1 (5→133) not taken.
|
2340 | rhsSTy = rhsSTy.removeReferenceWrapper(); |
| 1614 |
1/2✓ Branch 0 (6→7) taken 2340 times.
✗ Branch 1 (6→159) not taken.
|
2340 | llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile); |
| 1615 | |||
| 1616 | // Handle identity casts | ||
| 1617 |
3/4✓ Branch 0 (7→8) taken 2340 times.
✗ Branch 1 (7→159) not taken.
✓ Branch 2 (8→9) taken 241 times.
✓ Branch 3 (8→10) taken 2099 times.
|
2340 | if (lhsSTy.matches(rhsSTy, false, true, false)) |
| 1618 | 241 | return rhs; | |
| 1619 | |||
| 1620 |
12/16✓ Branch 0 (10→11) taken 2099 times.
✗ Branch 1 (10→159) not taken.
✓ Branch 2 (11→12) taken 240 times.
✓ Branch 3 (11→13) taken 8 times.
✓ Branch 4 (11→25) taken 21 times.
✓ Branch 5 (11→37) taken 226 times.
✓ Branch 6 (11→43) taken 15 times.
✓ Branch 7 (11→55) taken 96 times.
✓ Branch 8 (11→61) taken 17 times.
✓ Branch 9 (11→73) taken 503 times.
✓ Branch 10 (11→79) taken 15 times.
✓ Branch 11 (11→81) taken 69 times.
✓ Branch 12 (11→87) taken 889 times.
✗ Branch 13 (11→89) not taken.
✗ Branch 14 (11→103) not taken.
✗ Branch 15 (11→119) not taken.
|
2099 | switch (getTypeCombination(lhsSTy, rhsSTy)) { |
| 1621 | 240 | case COMB(TY_DOUBLE, TY_DOUBLE): // fallthrough | |
| 1622 | case COMB(TY_INT, TY_INT): // fallthrough | ||
| 1623 | case COMB(TY_SHORT, TY_SHORT): // fallthrough | ||
| 1624 | case COMB(TY_LONG, TY_LONG): // fallthrough | ||
| 1625 | case COMB(TY_BYTE, TY_BYTE): // fallthrough | ||
| 1626 | case COMB(TY_CHAR, TY_CHAR): // fallthrough | ||
| 1627 | case COMB(TY_STRING, TY_STRING): // fallthrough | ||
| 1628 | case COMB(TY_BOOL, TY_BOOL): // fallthrough | ||
| 1629 | case COMB(TY_PTR, TY_PTR): | ||
| 1630 | 240 | return rhs; // Identity cast | |
| 1631 | 8 | case COMB(TY_DOUBLE, TY_INT): | |
| 1632 | case COMB(TY_DOUBLE, TY_SHORT): | ||
| 1633 | case COMB(TY_DOUBLE, TY_LONG): | ||
| 1634 |
5/16✓ Branch 0 (13→14) taken 8 times.
✗ Branch 1 (13→159) not taken.
✗ Branch 2 (14→15) not taken.
✓ Branch 3 (14→19) taken 8 times.
✗ Branch 4 (15→16) not taken.
✗ Branch 5 (15→134) not taken.
✗ Branch 6 (16→17) not taken.
✗ Branch 7 (16→134) not taken.
✗ Branch 8 (17→18) not taken.
✗ Branch 9 (17→134) not taken.
✓ Branch 10 (19→20) taken 8 times.
✗ Branch 11 (19→134) not taken.
✓ Branch 12 (20→21) taken 8 times.
✗ Branch 13 (20→134) not taken.
✓ Branch 14 (21→22) taken 8 times.
✗ Branch 15 (21→134) not taken.
|
8 | return {.value = rhsSTy.isSigned() ? builder.CreateSIToFP(rhsV(), lhsT) : builder.CreateUIToFP(rhsV(), lhsT)}; |
| 1635 | 21 | case COMB(TY_INT, TY_DOUBLE): | |
| 1636 |
5/16✓ Branch 0 (25→26) taken 21 times.
✗ Branch 1 (25→159) not taken.
✓ Branch 2 (26→27) taken 21 times.
✗ Branch 3 (26→31) not taken.
✓ Branch 4 (27→28) taken 21 times.
✗ Branch 5 (27→136) not taken.
✓ Branch 6 (28→29) taken 21 times.
✗ Branch 7 (28→136) not taken.
✓ Branch 8 (29→30) taken 21 times.
✗ Branch 9 (29→136) not taken.
✗ Branch 10 (31→32) not taken.
✗ Branch 11 (31→136) not taken.
✗ Branch 12 (32→33) not taken.
✗ Branch 13 (32→136) not taken.
✗ Branch 14 (33→34) not taken.
✗ Branch 15 (33→136) not taken.
|
21 | return {.value = lhsSTy.isSigned() ? builder.CreateFPToSI(rhsV(), lhsT) : builder.CreateFPToUI(rhsV(), lhsT)}; |
| 1637 | 226 | case COMB(TY_INT, TY_SHORT): // fallthrough | |
| 1638 | case COMB(TY_INT, TY_LONG): // fallthrough | ||
| 1639 | case COMB(TY_INT, TY_BYTE): // fallthrough | ||
| 1640 | case COMB(TY_INT, TY_CHAR): | ||
| 1641 |
4/8✓ Branch 0 (37→38) taken 226 times.
✗ Branch 1 (37→138) not taken.
✓ Branch 2 (38→39) taken 226 times.
✗ Branch 3 (38→138) not taken.
✓ Branch 4 (39→40) taken 226 times.
✗ Branch 5 (39→138) not taken.
✓ Branch 6 (40→41) taken 226 times.
✗ Branch 7 (40→138) not taken.
|
226 | return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())}; |
| 1642 | 15 | case COMB(TY_SHORT, TY_DOUBLE): | |
| 1643 |
5/16✓ Branch 0 (43→44) taken 15 times.
✗ Branch 1 (43→159) not taken.
✓ Branch 2 (44→45) taken 15 times.
✗ Branch 3 (44→49) not taken.
✓ Branch 4 (45→46) taken 15 times.
✗ Branch 5 (45→139) not taken.
✓ Branch 6 (46→47) taken 15 times.
✗ Branch 7 (46→139) not taken.
✓ Branch 8 (47→48) taken 15 times.
✗ Branch 9 (47→139) not taken.
✗ Branch 10 (49→50) not taken.
✗ Branch 11 (49→139) not taken.
✗ Branch 12 (50→51) not taken.
✗ Branch 13 (50→139) not taken.
✗ Branch 14 (51→52) not taken.
✗ Branch 15 (51→139) not taken.
|
15 | return {.value = lhsSTy.isSigned() ? builder.CreateFPToSI(rhsV(), lhsT) : builder.CreateFPToUI(rhsV(), lhsT)}; |
| 1644 | 96 | case COMB(TY_SHORT, TY_INT): // fallthrough | |
| 1645 | case COMB(TY_SHORT, TY_LONG): | ||
| 1646 |
4/8✓ Branch 0 (55→56) taken 96 times.
✗ Branch 1 (55→141) not taken.
✓ Branch 2 (56→57) taken 96 times.
✗ Branch 3 (56→141) not taken.
✓ Branch 4 (57→58) taken 96 times.
✗ Branch 5 (57→141) not taken.
✓ Branch 6 (58→59) taken 96 times.
✗ Branch 7 (58→141) not taken.
|
96 | return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())}; |
| 1647 | 17 | case COMB(TY_LONG, TY_DOUBLE): | |
| 1648 |
9/16✓ Branch 0 (61→62) taken 17 times.
✗ Branch 1 (61→159) not taken.
✓ Branch 2 (62→63) taken 15 times.
✓ Branch 3 (62→67) taken 2 times.
✓ Branch 4 (63→64) taken 15 times.
✗ Branch 5 (63→142) not taken.
✓ Branch 6 (64→65) taken 15 times.
✗ Branch 7 (64→142) not taken.
✓ Branch 8 (65→66) taken 15 times.
✗ Branch 9 (65→142) not taken.
✓ Branch 10 (67→68) taken 2 times.
✗ Branch 11 (67→142) not taken.
✓ Branch 12 (68→69) taken 2 times.
✗ Branch 13 (68→142) not taken.
✓ Branch 14 (69→70) taken 2 times.
✗ Branch 15 (69→142) not taken.
|
17 | return {.value = lhsSTy.isSigned() ? builder.CreateFPToSI(rhsV(), lhsT) : builder.CreateFPToUI(rhsV(), lhsT)}; |
| 1649 | 503 | case COMB(TY_LONG, TY_INT): // fallthrough | |
| 1650 | case COMB(TY_LONG, TY_SHORT): // fallthrough | ||
| 1651 | case COMB(TY_BYTE, TY_INT): // fallthrough | ||
| 1652 | case COMB(TY_BYTE, TY_SHORT): // fallthrough | ||
| 1653 | case COMB(TY_BYTE, TY_LONG): | ||
| 1654 |
4/8✓ Branch 0 (73→74) taken 503 times.
✗ Branch 1 (73→144) not taken.
✓ Branch 2 (74→75) taken 503 times.
✗ Branch 3 (74→144) not taken.
✓ Branch 4 (75→76) taken 503 times.
✗ Branch 5 (75→144) not taken.
✓ Branch 6 (76→77) taken 503 times.
✗ Branch 7 (76→144) not taken.
|
503 | return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())}; |
| 1655 | 15 | case COMB(TY_BYTE, TY_CHAR): | |
| 1656 |
1/2✓ Branch 0 (79→80) taken 15 times.
✗ Branch 1 (79→159) not taken.
|
15 | return {.value = rhsV()}; |
| 1657 | 69 | case COMB(TY_CHAR, TY_INT): // fallthrough | |
| 1658 | case COMB(TY_CHAR, TY_SHORT): // fallthrough | ||
| 1659 | case COMB(TY_CHAR, TY_LONG): | ||
| 1660 |
4/8✓ Branch 0 (81→82) taken 69 times.
✗ Branch 1 (81→145) not taken.
✓ Branch 2 (82→83) taken 69 times.
✗ Branch 3 (82→145) not taken.
✓ Branch 4 (83→84) taken 69 times.
✗ Branch 5 (83→145) not taken.
✓ Branch 6 (84→85) taken 69 times.
✗ Branch 7 (84→145) not taken.
|
69 | return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())}; |
| 1661 | 889 | case COMB(TY_CHAR, TY_BYTE): // fallthrough | |
| 1662 | case COMB(TY_STRING, TY_PTR): // fallthrough | ||
| 1663 | case COMB(TY_PTR, TY_STRING): | ||
| 1664 |
1/2✓ Branch 0 (87→88) taken 889 times.
✗ Branch 1 (87→159) not taken.
|
889 | return {.value = rhsV()}; |
| 1665 | ✗ | case COMB(TY_ARRAY, TY_PTR): // fallthrough | |
| 1666 | case COMB(TY_ARRAY, TY_STRING): | ||
| 1667 | ✗ | assert(lhsSTy.isArrayOf(TY_CHAR)); | |
| 1668 | ✗ | assert(rhsSTy.isPtrTo(TY_CHAR) || rhsSTy.is(TY_STRING)); | |
| 1669 | ✗ | return {.value = builder.CreateBitCast(rhsV(), rhsSTy.toLLVMType(irGenerator->sourceFile))}; | |
| 1670 | ✗ | case COMB(TY_PTR, TY_ARRAY): // fallthrough | |
| 1671 | case COMB(TY_STRING, TY_ARRAY): { | ||
| 1672 | ✗ | assert(lhsSTy.isPtrTo(TY_CHAR) || lhsSTy.is(TY_STRING)); | |
| 1673 | ✗ | assert(rhsSTy.isArrayOf(TY_CHAR)); | |
| 1674 | ✗ | llvm::Value *indices[1] = {builder.getInt32(0)}; | |
| 1675 | ✗ | return {.value = builder.CreateInBoundsGEP(builder.getInt8Ty(), rhsP(), indices)}; | |
| 1676 | } | ||
| 1677 | − | default: // GCOV_EXCL_LINE | |
| 1678 | − | throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: (cast)"); // GCOV_EXCL_LINE | |
| 1679 | } | ||
| 1680 | 2340 | } | |
| 1681 | |||
| 1682 | 17388 | bool OpRuleConversionManager::callsOverloadedOpFct(const ASTNode *node, size_t opIdx) const { | |
| 1683 | 17388 | const std::vector<const Function *> &opFctList = irGenerator->getOpFctPointers(node); | |
| 1684 |
4/4✓ Branch 0 (4→5) taken 16869 times.
✓ Branch 1 (4→8) taken 519 times.
✓ Branch 2 (6→7) taken 837 times.
✓ Branch 3 (6→8) taken 16032 times.
|
17388 | return opFctList.size() > opIdx && opFctList.at(opIdx) != nullptr; |
| 1685 | } | ||
| 1686 | |||
| 1687 | template <size_t N> | ||
| 1688 | 821 | LLVMExprResult OpRuleConversionManager::callOperatorOverloadFct(const ASTNode *node, const std::array<ResolverFct, N * 2> &opV, | |
| 1689 | size_t opIdx) { | ||
| 1690 | static_assert(N == 1 || N == 2, "Only unary and binary operators are overloadable"); | ||
| 1691 | 821 | const size_t manIdx = irGenerator->manIdx; | |
| 1692 |
1/2✓ Branch 0 (2→3) taken 821 times.
✗ Branch 1 (2→120) not taken.
|
821 | const std::vector<std::vector<const Function *>> *opFctPointers = node->getOpFctPointers(); |
| 1693 |
2/4✓ Branch 0 (4→5) taken 821 times.
✗ Branch 1 (4→8) not taken.
✓ Branch 2 (6→7) taken 821 times.
✗ Branch 3 (6→8) not taken.
|
821 | assert(!opFctPointers->empty() && opFctPointers->size() > manIdx); |
| 1694 |
4/8✓ Branch 0 (9→10) taken 821 times.
✗ Branch 1 (9→120) not taken.
✓ Branch 2 (11→12) taken 821 times.
✗ Branch 3 (11→16) not taken.
✓ Branch 4 (12→13) taken 821 times.
✗ Branch 5 (12→120) not taken.
✓ Branch 6 (14→15) taken 821 times.
✗ Branch 7 (14→16) not taken.
|
821 | assert(!opFctPointers->at(manIdx).empty() && opFctPointers->at(manIdx).size() > opIdx); |
| 1695 |
2/4✓ Branch 0 (17→18) taken 821 times.
✗ Branch 1 (17→120) not taken.
✓ Branch 2 (18→19) taken 821 times.
✗ Branch 3 (18→120) not taken.
|
821 | const Function *opFct = opFctPointers->at(manIdx).at(opIdx); |
| 1696 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 821 times.
|
821 | assert(opFct != nullptr); |
| 1697 | |||
| 1698 |
1/2✓ Branch 0 (21→22) taken 821 times.
✗ Branch 1 (21→120) not taken.
|
821 | const std::string mangledName = opFct->getMangledName(); |
| 1699 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 821 times.
|
821 | assert(opFct->entry->scope != nullptr); |
| 1700 | |||
| 1701 | // Get arg values | ||
| 1702 |
1/2✓ Branch 0 (24→25) taken 821 times.
✗ Branch 1 (24→118) not taken.
|
821 | const QualTypeList ¶mTypes = opFct->getParamTypes(); |
| 1703 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 821 times.
|
821 | assert(paramTypes.size() == N); |
| 1704 | llvm::Value *argValues[N]; | ||
| 1705 |
5/8✓ Branch 0 (29→30) taken 821 times.
✗ Branch 1 (29→116) not taken.
✓ Branch 2 (30→31) taken 733 times.
✓ Branch 3 (30→34) taken 88 times.
✓ Branch 4 (32→33) taken 733 times.
✗ Branch 5 (32→116) not taken.
✓ Branch 6 (35→36) taken 88 times.
✗ Branch 7 (35→116) not taken.
|
821 | argValues[0] = paramTypes[0].isRef() ? opV[1]() : opV[0](); |
| 1706 | if constexpr (N == 2) | ||
| 1707 |
5/8✓ Branch 0 (38→39) taken 805 times.
✗ Branch 1 (38→125) not taken.
✓ Branch 2 (39→40) taken 430 times.
✓ Branch 3 (39→43) taken 375 times.
✓ Branch 4 (41→42) taken 430 times.
✗ Branch 5 (41→125) not taken.
✓ Branch 6 (44→45) taken 375 times.
✗ Branch 7 (44→125) not taken.
|
805 | argValues[1] = paramTypes[1].isRef() ? opV[3]() : opV[2](); |
| 1708 | |||
| 1709 | // Function is not defined in the current module -> declare it | ||
| 1710 |
3/4✓ Branch 0 (38→39) taken 821 times.
✗ Branch 1 (38→96) not taken.
✓ Branch 2 (39→40) taken 163 times.
✓ Branch 3 (39→61) taken 658 times.
|
821 | if (!irGenerator->module->getFunction(mangledName)) { |
| 1711 | // Get returnType | ||
| 1712 |
1/2✓ Branch 0 (40→41) taken 163 times.
✗ Branch 1 (40→105) not taken.
|
163 | llvm::Type *returnType = builder.getVoidTy(); |
| 1713 |
3/4✓ Branch 0 (41→42) taken 163 times.
✗ Branch 1 (41→105) not taken.
✓ Branch 2 (42→43) taken 88 times.
✓ Branch 3 (42→45) taken 75 times.
|
163 | if (!opFct->returnType.is(TY_DYN)) |
| 1714 |
1/2✓ Branch 0 (43→44) taken 88 times.
✗ Branch 1 (43→105) not taken.
|
88 | returnType = opFct->returnType.toLLVMType(irGenerator->sourceFile); |
| 1715 | |||
| 1716 | // Get arg types | ||
| 1717 | 163 | std::vector<llvm::Type *> argTypes; | |
| 1718 |
3/4✓ Branch 0 (45→46) taken 163 times.
✗ Branch 1 (45→100) not taken.
✓ Branch 2 (53→48) taken 314 times.
✓ Branch 3 (53→54) taken 163 times.
|
477 | for (const QualType ¶mType : opFct->getParamTypes()) |
| 1719 |
2/4✓ Branch 0 (49→50) taken 314 times.
✗ Branch 1 (49→97) not taken.
✓ Branch 2 (50→51) taken 314 times.
✗ Branch 3 (50→97) not taken.
|
314 | argTypes.push_back(paramType.toLLVMType(irGenerator->sourceFile)); |
| 1720 | |||
| 1721 |
1/2✓ Branch 0 (56→57) taken 163 times.
✗ Branch 1 (56→101) not taken.
|
163 | llvm::FunctionType *fctType = llvm::FunctionType::get(returnType, argTypes, false); |
| 1722 |
1/2✓ Branch 0 (58→59) taken 163 times.
✗ Branch 1 (58→102) not taken.
|
163 | irGenerator->module->getOrInsertFunction(mangledName, fctType); |
| 1723 | 163 | } | |
| 1724 | |||
| 1725 | // Get callee function | ||
| 1726 |
1/2✓ Branch 0 (62→63) taken 821 times.
✗ Branch 1 (62→106) not taken.
|
821 | llvm::Function *callee = irGenerator->module->getFunction(mangledName); |
| 1727 |
1/2✗ Branch 0 (63→64) not taken.
✓ Branch 1 (63→65) taken 821 times.
|
821 | assert(callee != nullptr); |
| 1728 | |||
| 1729 | // Generate function call | ||
| 1730 |
4/8✓ Branch 0 (65→66) taken 821 times.
✗ Branch 1 (65→109) not taken.
✓ Branch 2 (67→68) taken 821 times.
✗ Branch 3 (67→107) not taken.
✓ Branch 4 (68→69) taken 821 times.
✗ Branch 5 (68→107) not taken.
✓ Branch 6 (69→70) taken 821 times.
✗ Branch 7 (69→116) not taken.
|
821 | llvm::Value *result = builder.CreateCall(callee, argValues); |
| 1731 | |||
| 1732 | // If this is a procedure, return true | ||
| 1733 |
2/2✓ Branch 0 (72→73) taken 157 times.
✓ Branch 1 (72→75) taken 664 times.
|
821 | if (opFct->isProcedure()) |
| 1734 |
1/2✓ Branch 0 (73→74) taken 157 times.
✗ Branch 1 (73→116) not taken.
|
157 | return {.constant = builder.getTrue()}; |
| 1735 | |||
| 1736 | // Attach address to anonymous symbol to keep track of de-allocation | ||
| 1737 | 664 | SymbolTableEntry *anonymousSymbol = nullptr; | |
| 1738 | 664 | llvm::Value *resultPtr = nullptr; | |
| 1739 |
3/4✓ Branch 0 (75→76) taken 664 times.
✗ Branch 1 (75→116) not taken.
✓ Branch 2 (76→77) taken 77 times.
✓ Branch 3 (76→88) taken 587 times.
|
664 | if (opFct->returnType.is(TY_STRUCT)) { |
| 1740 |
1/2✓ Branch 0 (77→78) taken 77 times.
✗ Branch 1 (77→116) not taken.
|
77 | anonymousSymbol = irGenerator->currentScope->symbolTable.lookupAnonymous(node->codeLoc, opIdx); |
| 1741 |
2/2✓ Branch 0 (78→79) taken 45 times.
✓ Branch 1 (78→88) taken 32 times.
|
77 | if (anonymousSymbol != nullptr) { |
| 1742 |
1/2✓ Branch 0 (83→84) taken 45 times.
✗ Branch 1 (83→110) not taken.
|
90 | resultPtr = irGenerator->insertAlloca(result->getType()); |
| 1743 |
1/2✓ Branch 0 (86→87) taken 45 times.
✗ Branch 1 (86→116) not taken.
|
45 | irGenerator->insertStore(result, resultPtr); |
| 1744 |
1/2✓ Branch 0 (87→88) taken 45 times.
✗ Branch 1 (87→116) not taken.
|
45 | anonymousSymbol->updateAddress(resultPtr); |
| 1745 | } | ||
| 1746 | } | ||
| 1747 | |||
| 1748 | // If the return type is reference, return the result value as refPtr | ||
| 1749 |
3/4✓ Branch 0 (88→89) taken 664 times.
✗ Branch 1 (88→116) not taken.
✓ Branch 2 (89→90) taken 192 times.
✓ Branch 3 (89→91) taken 472 times.
|
664 | if (opFct->returnType.isRef()) |
| 1750 | 192 | return {.ptr = result, .refPtr = resultPtr, .entry = anonymousSymbol}; | |
| 1751 | |||
| 1752 | // Otherwise as value | ||
| 1753 | 472 | return {.value = result, .ptr = resultPtr, .entry = anonymousSymbol}; | |
| 1754 | 821 | } | |
| 1755 | |||
| 1756 | 124 | llvm::Value *OpRuleConversionManager::generateIToFp(const QualType &srcSTy, llvm::Value *srcV, llvm::Type *tgtT) const { | |
| 1757 |
2/2✓ Branch 0 (3→4) taken 118 times.
✓ Branch 1 (3→8) taken 6 times.
|
124 | if (srcSTy.isSigned()) |
| 1758 |
2/4✓ Branch 0 (4→5) taken 118 times.
✗ Branch 1 (4→13) not taken.
✓ Branch 2 (5→6) taken 118 times.
✗ Branch 3 (5→13) not taken.
|
118 | return builder.CreateSIToFP(srcV, tgtT); |
| 1759 | else | ||
| 1760 |
2/4✓ Branch 0 (8→9) taken 6 times.
✗ Branch 1 (8→14) not taken.
✓ Branch 2 (9→10) taken 6 times.
✗ Branch 3 (9→14) not taken.
|
6 | return builder.CreateUIToFP(srcV, tgtT); |
| 1761 | } | ||
| 1762 | |||
| 1763 | 55 | llvm::Value *OpRuleConversionManager::generateSHR(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1764 | llvm::Value *rhsV) const { | ||
| 1765 |
2/2✓ Branch 0 (3→4) taken 5 times.
✓ Branch 1 (3→8) taken 50 times.
|
55 | if (lhsSTy.isSigned()) |
| 1766 |
2/4✓ Branch 0 (4→5) taken 5 times.
✗ Branch 1 (4→13) not taken.
✓ Branch 2 (5→6) taken 5 times.
✗ Branch 3 (5→13) not taken.
|
5 | return builder.CreateAShr(lhsV, rhsV); |
| 1767 | else | ||
| 1768 |
2/4✓ Branch 0 (8→9) taken 50 times.
✗ Branch 1 (8→14) not taken.
✓ Branch 2 (9→10) taken 50 times.
✗ Branch 3 (9→14) not taken.
|
50 | return builder.CreateLShr(lhsV, rhsV); |
| 1769 | } | ||
| 1770 | |||
| 1771 | 1641 | llvm::Value *OpRuleConversionManager::generateLT(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1772 | llvm::Value *rhsV) const { | ||
| 1773 |
6/6✓ Branch 0 (3→4) taken 118 times.
✓ Branch 1 (3→7) taken 1523 times.
✓ Branch 2 (5→6) taken 106 times.
✓ Branch 3 (5→7) taken 12 times.
✓ Branch 4 (8→9) taken 106 times.
✓ Branch 5 (8→13) taken 1535 times.
|
1641 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1774 |
2/4✓ Branch 0 (9→10) taken 106 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 106 times.
✗ Branch 3 (10→18) not taken.
|
106 | return builder.CreateICmpSLT(lhsV, rhsV); |
| 1775 | else | ||
| 1776 |
2/4✓ Branch 0 (13→14) taken 1535 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 1535 times.
✗ Branch 3 (14→19) not taken.
|
1535 | return builder.CreateICmpULT(lhsV, rhsV); |
| 1777 | } | ||
| 1778 | |||
| 1779 | 343 | llvm::Value *OpRuleConversionManager::generateLE(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1780 | llvm::Value *rhsV) const { | ||
| 1781 |
5/6✓ Branch 0 (3→4) taken 18 times.
✓ Branch 1 (3→7) taken 325 times.
✓ Branch 2 (5→6) taken 18 times.
✗ Branch 3 (5→7) not taken.
✓ Branch 4 (8→9) taken 18 times.
✓ Branch 5 (8→13) taken 325 times.
|
343 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1782 |
2/4✓ Branch 0 (9→10) taken 18 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 18 times.
✗ Branch 3 (10→18) not taken.
|
18 | return builder.CreateICmpSLE(lhsV, rhsV); |
| 1783 | else | ||
| 1784 |
2/4✓ Branch 0 (13→14) taken 325 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 325 times.
✗ Branch 3 (14→19) not taken.
|
325 | return builder.CreateICmpULE(lhsV, rhsV); |
| 1785 | } | ||
| 1786 | |||
| 1787 | 470 | llvm::Value *OpRuleConversionManager::generateGT(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1788 | llvm::Value *rhsV) const { | ||
| 1789 |
6/6✓ Branch 0 (3→4) taken 157 times.
✓ Branch 1 (3→7) taken 313 times.
✓ Branch 2 (5→6) taken 44 times.
✓ Branch 3 (5→7) taken 113 times.
✓ Branch 4 (8→9) taken 44 times.
✓ Branch 5 (8→13) taken 426 times.
|
470 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1790 |
2/4✓ Branch 0 (9→10) taken 44 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 44 times.
✗ Branch 3 (10→18) not taken.
|
44 | return builder.CreateICmpSGT(lhsV, rhsV); |
| 1791 | else | ||
| 1792 |
2/4✓ Branch 0 (13→14) taken 426 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 426 times.
✗ Branch 3 (14→19) not taken.
|
426 | return builder.CreateICmpUGT(lhsV, rhsV); |
| 1793 | } | ||
| 1794 | |||
| 1795 | 878 | llvm::Value *OpRuleConversionManager::generateGE(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1796 | llvm::Value *rhsV) const { | ||
| 1797 |
6/6✓ Branch 0 (3→4) taken 60 times.
✓ Branch 1 (3→7) taken 818 times.
✓ Branch 2 (5→6) taken 56 times.
✓ Branch 3 (5→7) taken 4 times.
✓ Branch 4 (8→9) taken 56 times.
✓ Branch 5 (8→13) taken 822 times.
|
878 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1798 |
2/4✓ Branch 0 (9→10) taken 56 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 56 times.
✗ Branch 3 (10→18) not taken.
|
56 | return builder.CreateICmpSGE(lhsV, rhsV); |
| 1799 | else | ||
| 1800 |
2/4✓ Branch 0 (13→14) taken 822 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 822 times.
✗ Branch 3 (14→19) not taken.
|
822 | return builder.CreateICmpUGE(lhsV, rhsV); |
| 1801 | } | ||
| 1802 | |||
| 1803 | 3 | llvm::Value *OpRuleConversionManager::generateDiv(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1804 | llvm::Value *rhsV) const { | ||
| 1805 |
3/6✓ Branch 0 (3→4) taken 3 times.
✗ Branch 1 (3→7) not taken.
✓ Branch 2 (5→6) taken 3 times.
✗ Branch 3 (5→7) not taken.
✓ Branch 4 (8→9) taken 3 times.
✗ Branch 5 (8→13) not taken.
|
3 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1806 |
2/4✓ Branch 0 (9→10) taken 3 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 3 times.
✗ Branch 3 (10→18) not taken.
|
3 | return builder.CreateSDiv(lhsV, rhsV); |
| 1807 | else | ||
| 1808 | ✗ | return builder.CreateUDiv(lhsV, rhsV); | |
| 1809 | } | ||
| 1810 | |||
| 1811 | 16 | llvm::Value *OpRuleConversionManager::generateRem(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV, | |
| 1812 | llvm::Value *rhsV) const { | ||
| 1813 |
6/6✓ Branch 0 (3→4) taken 6 times.
✓ Branch 1 (3→7) taken 10 times.
✓ Branch 2 (5→6) taken 3 times.
✓ Branch 3 (5→7) taken 3 times.
✓ Branch 4 (8→9) taken 3 times.
✓ Branch 5 (8→13) taken 13 times.
|
16 | if (lhsSTy.isSigned() && rhsSTy.isSigned()) |
| 1814 |
2/4✓ Branch 0 (9→10) taken 3 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 3 times.
✗ Branch 3 (10→18) not taken.
|
3 | return builder.CreateSRem(lhsV, rhsV); |
| 1815 | else | ||
| 1816 |
2/4✓ Branch 0 (13→14) taken 13 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 13 times.
✗ Branch 3 (14→19) not taken.
|
13 | return builder.CreateURem(lhsV, rhsV); |
| 1817 | } | ||
| 1818 | |||
| 1819 | } // namespace spice::compiler | ||
| 1820 |