GCC Code Coverage Report


Directory: ../
File: src/irgenerator/OpRuleConversionManager.cpp
Date: 2025-02-05 01:09:36
Exec Total Coverage
Lines: 742 1166 63.6%
Functions: 124 132 93.9%
Branches: 1426 4721 30.2%

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 787 OpRuleConversionManager::OpRuleConversionManager(SourceFile *sourceFile, IRGenerator *irGenerator)
17
2/2
✓ Branch 0 (2→3) taken 2 times.
✓ Branch 1 (2→4) taken 785 times.
787 : context(irGenerator->cliOptions.useLTO ? irGenerator->resourceManager.ltoContext : sourceFile->context),
18 787 builder(sourceFile->builder), irGenerator(irGenerator), stdFunctionManager(irGenerator->stdFunctionManager) {}
19
20 218 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 218 times.
✗ Branch 1 (2→151) not taken.
349 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
23
1/2
✓ Branch 0 (3→4) taken 218 times.
✗ Branch 1 (3→152) not taken.
359 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
24 305 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
25 295 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
26
1/2
✓ Branch 0 (6→7) taken 218 times.
✗ Branch 1 (6→153) not taken.
218 lhsSTy = lhsSTy.removeReferenceWrapper();
27
1/2
✓ Branch 0 (7→8) taken 218 times.
✗ Branch 1 (7→154) not taken.
218 rhsSTy = rhsSTy.removeReferenceWrapper();
28
1/2
✓ Branch 0 (8→9) taken 218 times.
✗ Branch 1 (8→189) not taken.
218 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
29
30 // Handle operator overloads
31
3/4
✓ Branch 0 (9→10) taken 218 times.
✗ Branch 1 (9→189) not taken.
✓ Branch 2 (10→11) taken 87 times.
✓ Branch 3 (10→19) taken 131 times.
218 if (callsOverloadedOpFct(node, opIdx))
32 87 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
33
34
7/12
✓ Branch 0 (19→20) taken 131 times.
✗ Branch 1 (19→189) not taken.
✓ Branch 2 (20→21) taken 21 times.
✓ Branch 3 (20→27) taken 15 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 82 times.
✓ Branch 10 (20→123) taken 1 times.
✗ Branch 11 (20→137) not taken.
131 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 15 case COMB(TY_INT, TY_INT):
38
8/16
✓ Branch 0 (27→28) taken 15 times.
✗ Branch 1 (27→189) not taken.
✓ Branch 2 (28→29) taken 15 times.
✗ Branch 3 (28→32) not taken.
✓ Branch 4 (29→30) taken 15 times.
✗ Branch 5 (29→189) not taken.
✓ Branch 6 (30→31) taken 15 times.
✗ Branch 7 (30→32) not taken.
✓ Branch 8 (33→34) taken 15 times.
✗ Branch 9 (33→164) not taken.
✓ Branch 10 (34→35) taken 15 times.
✗ Branch 11 (34→164) not taken.
✓ Branch 12 (35→36) taken 15 times.
✗ Branch 13 (35→164) not taken.
✓ Branch 14 (36→37) taken 15 times.
✗ Branch 15 (36→164) not taken.
15 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 82 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 82 times.
✗ Branch 1 (111→189) not taken.
✓ Branch 2 (112→113) taken 4 times.
✓ Branch 3 (112→116) taken 78 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 82 times.
✗ Branch 9 (117→174) not taken.
✓ Branch 10 (118→119) taken 82 times.
✗ Branch 11 (118→174) not taken.
✓ Branch 12 (119→120) taken 82 times.
✗ Branch 13 (119→174) not taken.
✓ Branch 14 (120→121) taken 82 times.
✗ Branch 15 (120→174) not taken.
82 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 87 times.
✗ Branch 1 (11→157) not taken.
✓ Branch 2 (12→13) taken 87 times.
✗ Branch 3 (12→157) not taken.
✓ Branch 4 (13→14) taken 87 times.
✗ Branch 5 (13→157) not taken.
✓ Branch 6 (14→15) taken 87 times.
✗ Branch 7 (14→157) not taken.
✓ Branch 8 (15→16) taken 87 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.
305 }
74
75 27 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 27 times.
✗ Branch 1 (2→153) not taken.
47 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
78
1/2
✓ Branch 0 (3→4) taken 27 times.
✗ Branch 1 (3→154) not taken.
54 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
79 34 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
80 27 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
81
1/2
✓ Branch 0 (6→7) taken 27 times.
✗ Branch 1 (6→155) not taken.
27 lhsSTy = lhsSTy.removeReferenceWrapper();
82
1/2
✓ Branch 0 (7→8) taken 27 times.
✗ Branch 1 (7→156) not taken.
27 rhsSTy = rhsSTy.removeReferenceWrapper();
83
1/2
✓ Branch 0 (8→9) taken 27 times.
✗ Branch 1 (8→192) not taken.
27 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
84
85 // Handle operator overloads
86
3/4
✓ Branch 0 (9→10) taken 27 times.
✗ Branch 1 (9→192) not taken.
✓ Branch 2 (10→11) taken 7 times.
✓ Branch 3 (10→19) taken 20 times.
27 if (callsOverloadedOpFct(node, opIdx))
87 7 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
88
89
8/12
✓ Branch 0 (19→20) taken 20 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) taken 2 times.
✗ Branch 6 (20→69) not taken.
✗ Branch 7 (20→81) not taken.
✓ Branch 8 (20→96) taken 4 times.
✓ Branch 9 (20→111) taken 5 times.
✓ Branch 10 (20→123) taken 1 times.
✗ Branch 11 (20→139) not taken.
20 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 2 case COMB(TY_SHORT, TY_INT): {
100
4/8
✓ Branch 0 (54→55) taken 2 times.
✗ Branch 1 (54→169) not taken.
✓ Branch 2 (55→56) taken 2 times.
✗ Branch 3 (55→169) not taken.
✓ Branch 4 (56→57) taken 2 times.
✗ Branch 5 (56→169) not taken.
✓ Branch 6 (57→58) taken 2 times.
✗ Branch 7 (57→169) not taken.
2 llvm::Value *rhsShort = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
101
7/14
✓ Branch 0 (58→59) taken 2 times.
✗ Branch 1 (58→192) not taken.
✓ Branch 2 (59→60) taken 2 times.
✗ Branch 3 (59→63) not taken.
✓ Branch 4 (60→61) taken 2 times.
✗ Branch 5 (60→192) not taken.
✓ Branch 6 (61→62) taken 2 times.
✗ Branch 7 (61→63) not taken.
✓ Branch 8 (64→65) taken 2 times.
✗ Branch 9 (64→170) not taken.
✓ Branch 10 (65→66) taken 2 times.
✗ Branch 11 (65→170) not taken.
✓ Branch 12 (66→67) taken 2 times.
✗ Branch 13 (66→170) not taken.
2 return {.value = builder.CreateSub(lhsV(), rhsShort, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())};
102 }
103 case COMB(TY_SHORT, TY_SHORT):
104 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 4 case COMB(TY_LONG, TY_INT): // fallthrough
110 case COMB(TY_LONG, TY_SHORT): {
111
4/8
✓ Branch 0 (96→97) taken 4 times.
✗ Branch 1 (96→174) not taken.
✓ Branch 2 (97→98) taken 4 times.
✗ Branch 3 (97→174) not taken.
✓ Branch 4 (98→99) taken 4 times.
✗ Branch 5 (98→174) not taken.
✓ Branch 6 (99→100) taken 4 times.
✗ Branch 7 (99→174) not taken.
4 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
112
5/14
✓ Branch 0 (100→101) taken 4 times.
✗ Branch 1 (100→192) not taken.
✗ Branch 2 (101→102) not taken.
✓ Branch 3 (101→105) taken 4 times.
✗ Branch 4 (102→103) not taken.
✗ Branch 5 (102→192) not taken.
✗ Branch 6 (103→104) not taken.
✗ Branch 7 (103→105) not taken.
✓ Branch 8 (106→107) taken 4 times.
✗ Branch 9 (106→175) not taken.
✓ Branch 10 (107→108) taken 4 times.
✗ Branch 11 (107→175) not taken.
✓ Branch 12 (108→109) taken 4 times.
✗ Branch 13 (108→175) not taken.
4 return {.value = builder.CreateSub(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())};
113 }
114 5 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 5 times.
✗ Branch 1 (111→192) not taken.
✓ Branch 2 (112→113) taken 4 times.
✓ Branch 3 (112→116) taken 1 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 5 times.
✗ Branch 9 (117→176) not taken.
✓ Branch 10 (118→119) taken 5 times.
✗ Branch 11 (118→176) not taken.
✓ Branch 12 (119→120) taken 5 times.
✗ Branch 13 (119→176) not taken.
✓ Branch 14 (120→121) taken 5 times.
✗ Branch 15 (120→176) not taken.
5 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.
34 }
130
131 15 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 15 times.
✗ Branch 1 (2→137) not taken.
28 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
134
1/2
✓ Branch 0 (3→4) taken 15 times.
✗ Branch 1 (3→138) not taken.
30 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
135 17 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
136 15 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
137
1/2
✓ Branch 0 (6→7) taken 15 times.
✗ Branch 1 (6→139) not taken.
15 lhsSTy = lhsSTy.removeReferenceWrapper();
138
1/2
✓ Branch 0 (7→8) taken 15 times.
✗ Branch 1 (7→140) not taken.
15 rhsSTy = rhsSTy.removeReferenceWrapper();
139
1/2
✓ Branch 0 (8→9) taken 15 times.
✗ Branch 1 (8→170) not taken.
15 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
140
141 // Handle operator overloads
142
3/4
✓ Branch 0 (9→10) taken 15 times.
✗ Branch 1 (9→170) not taken.
✓ Branch 2 (10→11) taken 2 times.
✓ Branch 3 (10→19) taken 13 times.
15 if (callsOverloadedOpFct(node, opIdx))
143 2 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
144
145
5/11
✓ Branch 0 (19→20) taken 13 times.
✗ Branch 1 (19→170) not taken.
✓ Branch 2 (20→21) taken 9 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 1 times.
✗ Branch 10 (20→123) not taken.
13 switch (getTypeCombination(lhsSTy, rhsSTy)) {
146 9 case COMB(TY_DOUBLE, TY_DOUBLE):
147
4/8
✓ Branch 0 (21→22) taken 9 times.
✗ Branch 1 (21→149) not taken.
✓ Branch 2 (22→23) taken 9 times.
✗ Branch 3 (22→149) not taken.
✓ Branch 4 (23→24) taken 9 times.
✗ Branch 5 (23→149) not taken.
✓ Branch 6 (24→25) taken 9 times.
✗ Branch 7 (24→149) not taken.
9 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 1 case COMB(TY_LONG, TY_LONG): // fallthrough
171 case COMB(TY_BYTE, TY_BYTE):
172
8/16
✓ Branch 0 (111→112) taken 1 times.
✗ Branch 1 (111→170) not taken.
✓ Branch 2 (112→113) taken 1 times.
✗ Branch 3 (112→116) not taken.
✓ 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 1 times.
✗ Branch 9 (117→160) not taken.
✓ Branch 10 (118→119) taken 1 times.
✗ Branch 11 (118→160) not taken.
✓ Branch 12 (119→120) taken 1 times.
✗ Branch 13 (119→160) not taken.
✓ Branch 14 (120→121) taken 1 times.
✗ Branch 15 (120→160) not taken.
1 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.
17 }
177
178 35 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 35 times.
✗ Branch 1 (2→83) not taken.
38 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
181
1/2
✓ Branch 0 (3→4) taken 35 times.
✗ Branch 1 (3→84) not taken.
70 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
182 67 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
183 35 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
184
1/2
✓ Branch 0 (6→7) taken 35 times.
✗ Branch 1 (6→85) not taken.
35 lhsSTy = lhsSTy.removeReferenceWrapper();
185
1/2
✓ Branch 0 (7→8) taken 35 times.
✗ Branch 1 (7→86) not taken.
35 rhsSTy = rhsSTy.removeReferenceWrapper();
186
1/2
✓ Branch 0 (8→9) taken 35 times.
✗ Branch 1 (8→110) not taken.
35 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
187
188 // Handle operator overloads
189
3/4
✓ Branch 0 (9→10) taken 35 times.
✗ Branch 1 (9→110) not taken.
✓ Branch 2 (10→11) taken 32 times.
✓ Branch 3 (10→19) taken 3 times.
35 if (callsOverloadedOpFct(node, opIdx))
190 32 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
191
192
3/11
✓ Branch 0 (19→20) taken 3 times.
✗ Branch 1 (19→110) not taken.
✗ Branch 2 (20→21) not taken.
✗ 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.
3 switch (getTypeCombination(lhsSTy, rhsSTy)) {
193 case COMB(TY_DOUBLE, TY_DOUBLE):
194 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 32 times.
✗ Branch 1 (11→89) not taken.
✓ Branch 2 (12→13) taken 32 times.
✗ Branch 3 (12→89) not taken.
✓ Branch 4 (13→14) taken 32 times.
✗ Branch 5 (13→89) not taken.
✓ Branch 6 (14→15) taken 32 times.
✗ Branch 7 (14→89) not taken.
✓ Branch 8 (15→16) taken 32 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.
67 }
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 219 LLVMExprResult OpRuleConversionManager::getXorEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
399 LLVMExprResult &rhs, QualType rhsSTy) {
400
1/2
✓ Branch 0 (2→3) taken 219 times.
✗ Branch 1 (2→57) not taken.
438 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
401
1/2
✓ Branch 0 (3→4) taken 219 times.
✗ Branch 1 (3→58) not taken.
438 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
402
1/2
✓ Branch 0 (4→5) taken 219 times.
✗ Branch 1 (4→59) not taken.
219 lhsSTy = lhsSTy.removeReferenceWrapper();
403
1/2
✓ Branch 0 (5→6) taken 219 times.
✗ Branch 1 (5→60) not taken.
219 rhsSTy = rhsSTy.removeReferenceWrapper();
404
1/2
✓ Branch 0 (6→7) taken 219 times.
✗ Branch 1 (6→77) not taken.
219 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
405
406
2/8
✓ Branch 0 (7→8) taken 219 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 219 times.
✗ Branch 7 (8→45) not taken.
219 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 219 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 219 times.
✗ Branch 1 (39→67) not taken.
✓ Branch 2 (40→41) taken 219 times.
✗ Branch 3 (40→67) not taken.
✓ Branch 4 (41→42) taken 219 times.
✗ Branch 5 (41→67) not taken.
✓ Branch 6 (42→43) taken 219 times.
✗ Branch 7 (42→67) not taken.
219 return {.value = builder.CreateXor(lhsV(), rhsV())};
427 default: // GCOV_EXCL_LINE
428 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ^="); // GCOV_EXCL_LINE
429 }
430 219 }
431
432 63 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 63 times.
✗ Branch 1 (2→25) not taken.
126 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
435
1/2
✓ Branch 0 (3→4) taken 63 times.
✗ Branch 1 (3→26) not taken.
126 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
436
1/2
✓ Branch 0 (4→5) taken 63 times.
✗ Branch 1 (4→27) not taken.
63 lhsSTy = lhsSTy.removeReferenceWrapper();
437
1/2
✓ Branch 0 (5→6) taken 63 times.
✗ Branch 1 (5→28) not taken.
63 rhsSTy = rhsSTy.removeReferenceWrapper();
438
439
2/4
✓ Branch 0 (6→7) taken 63 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 63 times.
✗ Branch 3 (7→16) not taken.
63 switch (getTypeCombination(lhsSTy, rhsSTy)) {
440 63 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 63 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 63 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 63 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 63 times.
✗ Branch 7 (11→29) not taken.
126 return {.value = builder.CreateOr(lhsV(), rhsV())};
446 default: // GCOV_EXCL_LINE
447 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: |"); // GCOV_EXCL_LINE
448 }
449 63 }
450
451 3 LLVMExprResult OpRuleConversionManager::getBitwiseXorInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
452 LLVMExprResult &rhs, QualType rhsSTy) {
453
1/2
✓ Branch 0 (2→3) taken 3 times.
✗ Branch 1 (2→25) not taken.
6 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
454
1/2
✓ Branch 0 (3→4) taken 3 times.
✗ Branch 1 (3→26) not taken.
6 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
455
1/2
✓ Branch 0 (4→5) taken 3 times.
✗ Branch 1 (4→27) not taken.
3 lhsSTy = lhsSTy.removeReferenceWrapper();
456
1/2
✓ Branch 0 (5→6) taken 3 times.
✗ Branch 1 (5→28) not taken.
3 rhsSTy = rhsSTy.removeReferenceWrapper();
457
458
2/4
✓ Branch 0 (6→7) taken 3 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 3 times.
✗ Branch 3 (7→16) not taken.
3 switch (getTypeCombination(lhsSTy, rhsSTy)) {
459 3 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 3 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 3 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 3 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 3 times.
✗ Branch 7 (11→29) not taken.
6 return {.value = builder.CreateXor(lhsV(), rhsV())};
465 default: // GCOV_EXCL_LINE
466 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: ^"); // GCOV_EXCL_LINE
467 }
468 3 }
469
470 29 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 29 times.
✗ Branch 1 (2→25) not taken.
58 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
473
1/2
✓ Branch 0 (3→4) taken 29 times.
✗ Branch 1 (3→26) not taken.
58 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
474
1/2
✓ Branch 0 (4→5) taken 29 times.
✗ Branch 1 (4→27) not taken.
29 lhsSTy = lhsSTy.removeReferenceWrapper();
475
1/2
✓ Branch 0 (5→6) taken 29 times.
✗ Branch 1 (5→28) not taken.
29 rhsSTy = rhsSTy.removeReferenceWrapper();
476
477
2/4
✓ Branch 0 (6→7) taken 29 times.
✗ Branch 1 (6→39) not taken.
✓ Branch 2 (7→8) taken 29 times.
✗ Branch 3 (7→16) not taken.
29 switch (getTypeCombination(lhsSTy, rhsSTy)) {
478 29 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 29 times.
✗ Branch 1 (8→29) not taken.
✓ Branch 2 (9→10) taken 29 times.
✗ Branch 3 (9→29) not taken.
✓ Branch 4 (10→11) taken 29 times.
✗ Branch 5 (10→29) not taken.
✓ Branch 6 (11→12) taken 29 times.
✗ Branch 7 (11→29) not taken.
58 return {.value = builder.CreateAnd(lhsV(), rhsV())};
484 default: // GCOV_EXCL_LINE
485 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: &"); // GCOV_EXCL_LINE
486 }
487 29 }
488
489 3081 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 3081 times.
✗ Branch 1 (2→266) not taken.
5861 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
492
1/2
✓ Branch 0 (3→4) taken 3081 times.
✗ Branch 1 (3→267) not taken.
5924 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
493 3382 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
494 3319 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
495
1/2
✓ Branch 0 (6→7) taken 3081 times.
✗ Branch 1 (6→268) not taken.
3081 lhsSTy = lhsSTy.removeReferenceWrapper();
496
1/2
✓ Branch 0 (7→8) taken 3081 times.
✗ Branch 1 (7→269) not taken.
3081 rhsSTy = rhsSTy.removeReferenceWrapper();
497
1/2
✓ Branch 0 (8→9) taken 3081 times.
✗ Branch 1 (8→338) not taken.
3081 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
498
1/2
✓ Branch 0 (9→10) taken 3081 times.
✗ Branch 1 (9→338) not taken.
3081 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
499
500 // Handle operator overloads
501
3/4
✓ Branch 0 (10→11) taken 3081 times.
✗ Branch 1 (10→338) not taken.
✓ Branch 2 (11→12) taken 354 times.
✓ Branch 3 (11→20) taken 2727 times.
3081 if (callsOverloadedOpFct(node, opIdx))
502 354 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 2727 times.
✗ Branch 1 (20→338) not taken.
✓ Branch 2 (21→22) taken 724 times.
✓ Branch 3 (21→25) taken 2003 times.
✓ Branch 4 (22→23) taken 724 times.
✗ Branch 5 (22→338) not taken.
✓ Branch 6 (23→24) taken 724 times.
✗ Branch 7 (23→25) not taken.
✓ Branch 8 (26→27) taken 724 times.
✓ Branch 9 (26→33) taken 2003 times.
2727 if (lhsSTy.isPtr() && rhsSTy.isPtr())
506
4/8
✓ Branch 0 (27→28) taken 724 times.
✗ Branch 1 (27→278) not taken.
✓ Branch 2 (28→29) taken 724 times.
✗ Branch 3 (28→278) not taken.
✓ Branch 4 (29→30) taken 724 times.
✗ Branch 5 (29→278) not taken.
✓ Branch 6 (30→31) taken 724 times.
✗ Branch 7 (30→278) not taken.
724 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 108 times.
✓ Branch 1 (34→38) taken 1895 times.
✓ Branch 2 (35→36) taken 108 times.
✗ Branch 3 (35→338) not taken.
✗ Branch 4 (36→37) not taken.
✓ Branch 5 (36→38) taken 108 times.
✗ Branch 6 (39→40) not taken.
✓ Branch 7 (39→48) taken 2003 times.
2003 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 2003 times.
✗ Branch 1 (48→338) not taken.
✓ Branch 2 (49→50) taken 108 times.
✓ Branch 3 (49→52) taken 1895 times.
✓ Branch 4 (50→51) taken 108 times.
✗ Branch 5 (50→338) not taken.
✓ Branch 6 (51→52) taken 108 times.
✗ Branch 7 (51→56) not taken.
✓ Branch 8 (52→53) taken 2003 times.
✗ Branch 9 (52→338) not taken.
✗ Branch 10 (53→54) not taken.
✓ Branch 11 (53→57) taken 2003 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 2003 times.
2003 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
11/25
✓ Branch 0 (67→68) taken 2003 times.
✗ Branch 1 (67→338) not taken.
✓ Branch 2 (68→69) taken 30 times.
✗ Branch 3 (68→75) not taken.
✗ Branch 4 (68→82) not taken.
✓ Branch 5 (68→89) taken 231 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 170 times.
✓ Branch 16 (68→178) taken 930 times.
✗ Branch 17 (68→184) not taken.
✓ Branch 18 (68→193) taken 16 times.
✗ Branch 19 (68→202) not taken.
✗ Branch 20 (68→211) not taken.
✓ Branch 21 (68→220) taken 478 times.
✓ Branch 22 (68→226) taken 108 times.
✓ Branch 23 (68→234) taken 20 times.
✗ Branch 24 (68→252) not taken.
2003 switch (getTypeCombination(lhsSTy, rhsSTy)) {
524 30 case COMB(TY_DOUBLE, TY_DOUBLE):
525
4/8
✓ Branch 0 (69→70) taken 30 times.
✗ Branch 1 (69→285) not taken.
✓ Branch 2 (70→71) taken 30 times.
✗ Branch 3 (70→285) not taken.
✓ Branch 4 (71→72) taken 30 times.
✗ Branch 5 (71→285) not taken.
✓ Branch 6 (72→73) taken 30 times.
✗ Branch 7 (72→285) not taken.
30 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 case COMB(TY_INT, TY_DOUBLE): {
533 llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT);
534 return {.value = builder.CreateFCmpOEQ(lhsFP, rhsV())};
535 }
536 231 case COMB(TY_INT, TY_INT):
537
4/8
✓ Branch 0 (89→90) taken 231 times.
✗ Branch 1 (89→288) not taken.
✓ Branch 2 (90→91) taken 231 times.
✗ Branch 3 (90→288) not taken.
✓ Branch 4 (91→92) taken 231 times.
✗ Branch 5 (91→288) not taken.
✓ Branch 6 (92→93) taken 231 times.
✗ Branch 7 (92→288) not taken.
231 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 170 case COMB(TY_LONG, TY_INT): // fallthrough
575 case COMB(TY_LONG, TY_SHORT): {
576
4/8
✓ Branch 0 (169→170) taken 170 times.
✗ Branch 1 (169→304) not taken.
✓ Branch 2 (170→171) taken 170 times.
✗ Branch 3 (170→304) not taken.
✓ Branch 4 (171→172) taken 170 times.
✗ Branch 5 (171→304) not taken.
✓ Branch 6 (172→173) taken 170 times.
✗ Branch 7 (172→304) not taken.
170 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
577
3/6
✓ Branch 0 (173→174) taken 170 times.
✗ Branch 1 (173→305) not taken.
✓ Branch 2 (174→175) taken 170 times.
✗ Branch 3 (174→305) not taken.
✓ Branch 4 (175→176) taken 170 times.
✗ Branch 5 (175→305) not taken.
170 return {.value = builder.CreateICmpEQ(lhsV(), rhsLong)};
578 }
579 930 case COMB(TY_LONG, TY_LONG):
580
4/8
✓ Branch 0 (178→179) taken 930 times.
✗ Branch 1 (178→306) not taken.
✓ Branch 2 (179→180) taken 930 times.
✗ Branch 3 (179→306) not taken.
✓ Branch 4 (180→181) taken 930 times.
✗ Branch 5 (180→306) not taken.
✓ Branch 6 (181→182) taken 930 times.
✗ Branch 7 (181→306) not taken.
930 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 16 case COMB(TY_BYTE, TY_INT): // fallthrough
587 case COMB(TY_CHAR, TY_INT): {
588
4/8
✓ Branch 0 (193→194) taken 16 times.
✗ Branch 1 (193→309) not taken.
✓ Branch 2 (194→195) taken 16 times.
✗ Branch 3 (194→309) not taken.
✓ Branch 4 (195→196) taken 16 times.
✗ Branch 5 (195→309) not taken.
✓ Branch 6 (196→197) taken 16 times.
✗ Branch 7 (196→309) not taken.
16 llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
589
3/6
✓ Branch 0 (197→198) taken 16 times.
✗ Branch 1 (197→310) not taken.
✓ Branch 2 (198→199) taken 16 times.
✗ Branch 3 (198→310) not taken.
✓ Branch 4 (199→200) taken 16 times.
✗ Branch 5 (199→310) not taken.
16 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 478 case COMB(TY_BYTE, TY_BYTE): // fallthrough
602 case COMB(TY_CHAR, TY_CHAR):
603
4/8
✓ Branch 0 (220→221) taken 478 times.
✗ Branch 1 (220→315) not taken.
✓ Branch 2 (221→222) taken 478 times.
✗ Branch 3 (221→315) not taken.
✓ Branch 4 (222→223) taken 478 times.
✗ Branch 5 (222→315) not taken.
✓ Branch 6 (223→224) taken 478 times.
✗ Branch 7 (223→315) not taken.
478 return {.value = builder.CreateICmpEQ(lhsV(), rhsV())};
604 108 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 108 times.
✗ Branch 1 (226→338) not taken.
108 llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct();
607
5/10
✓ Branch 0 (227→228) taken 108 times.
✗ Branch 1 (227→319) not taken.
✓ Branch 2 (228→229) taken 108 times.
✗ Branch 3 (228→317) not taken.
✓ Branch 4 (229→230) taken 108 times.
✗ Branch 5 (229→317) not taken.
✓ Branch 6 (231→232) taken 108 times.
✗ Branch 7 (231→316) not taken.
✓ Branch 8 (232→233) taken 108 times.
✗ Branch 9 (232→316) not taken.
108 llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()});
608 108 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 354 times.
✗ Branch 1 (12→272) not taken.
✓ Branch 2 (13→14) taken 354 times.
✗ Branch 3 (13→272) not taken.
✓ Branch 4 (14→15) taken 354 times.
✗ Branch 5 (14→272) not taken.
✓ Branch 6 (15→16) taken 354 times.
✗ Branch 7 (15→272) not taken.
✓ Branch 8 (16→17) taken 354 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.
3435 }
622
623 1279 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 1279 times.
✗ Branch 1 (2→272) not taken.
2544 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
626
1/2
✓ Branch 0 (3→4) taken 1279 times.
✗ Branch 1 (3→273) not taken.
2544 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
627 1293 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
628 1293 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
629
1/2
✓ Branch 0 (6→7) taken 1279 times.
✗ Branch 1 (6→274) not taken.
1279 lhsSTy = lhsSTy.removeReferenceWrapper();
630
1/2
✓ Branch 0 (7→8) taken 1279 times.
✗ Branch 1 (7→275) not taken.
1279 rhsSTy = rhsSTy.removeReferenceWrapper();
631
1/2
✓ Branch 0 (8→9) taken 1279 times.
✗ Branch 1 (8→346) not taken.
1279 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
632
1/2
✓ Branch 0 (9→10) taken 1279 times.
✗ Branch 1 (9→346) not taken.
1279 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
633
634 // Handle operator overloads
635
3/4
✓ Branch 0 (10→11) taken 1279 times.
✗ Branch 1 (10→346) not taken.
✓ Branch 2 (11→12) taken 10 times.
✓ Branch 3 (11→20) taken 1269 times.
1279 if (callsOverloadedOpFct(node, opIdx))
636 10 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
637
638 // Check if both values are of type pointer
639
7/10
✓ Branch 0 (20→21) taken 1269 times.
✗ Branch 1 (20→346) not taken.
✓ Branch 2 (21→22) taken 152 times.
✓ Branch 3 (21→25) taken 1117 times.
✓ Branch 4 (22→23) taken 152 times.
✗ Branch 5 (22→346) not taken.
✓ Branch 6 (23→24) taken 152 times.
✗ Branch 7 (23→25) not taken.
✓ Branch 8 (26→27) taken 152 times.
✓ Branch 9 (26→33) taken 1117 times.
1269 if (lhsSTy.isPtr() && rhsSTy.isPtr())
640
4/8
✓ Branch 0 (27→28) taken 152 times.
✗ Branch 1 (27→284) not taken.
✓ Branch 2 (28→29) taken 152 times.
✗ Branch 3 (28→284) not taken.
✓ Branch 4 (29→30) taken 152 times.
✗ Branch 5 (29→284) not taken.
✓ Branch 6 (30→31) taken 152 times.
✗ Branch 7 (30→284) not taken.
152 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 9 times.
✓ Branch 1 (34→38) taken 1108 times.
✓ Branch 2 (35→36) taken 9 times.
✗ Branch 3 (35→346) not taken.
✗ Branch 4 (36→37) not taken.
✓ Branch 5 (36→38) taken 9 times.
✗ Branch 6 (39→40) not taken.
✓ Branch 7 (39→48) taken 1117 times.
1117 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
8/18
✓ Branch 0 (48→49) taken 1117 times.
✗ Branch 1 (48→346) not taken.
✓ Branch 2 (49→50) taken 9 times.
✓ Branch 3 (49→52) taken 1108 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 1117 times.
✗ Branch 9 (52→346) not taken.
✗ Branch 10 (53→54) not taken.
✓ Branch 11 (53→57) taken 1117 times.
✗ Branch 12 (54→55) not taken.
✗ Branch 13 (54→346) not taken.
✗ Branch 14 (55→56) not taken.
✗ Branch 15 (55→57) not taken.
✗ Branch 16 (58→59) not taken.
✓ Branch 17 (58→70) taken 1117 times.
1117 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 llvm::Function *opFct = stdFunctionManager.getStringIsRawEqualStringStringFct();
652 llvm::Value *result = builder.CreateCall(opFct, {lhsV(), rhsV()});
653 // Negate the result
654 return {.value = builder.CreateNot(result)};
655 }
656
657
11/25
✓ Branch 0 (70→71) taken 1117 times.
✗ Branch 1 (70→346) not taken.
✓ Branch 2 (71→72) taken 8 times.
✗ Branch 3 (71→78) not taken.
✓ Branch 4 (71→85) taken 1 times.
✓ Branch 5 (71→92) taken 107 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 446 times.
✗ Branch 17 (71→187) not taken.
✓ Branch 18 (71→196) taken 8 times.
✗ Branch 19 (71→205) not taken.
✗ Branch 20 (71→214) not taken.
✓ Branch 21 (71→223) taken 532 times.
✓ Branch 22 (71→229) taken 9 times.
✓ Branch 23 (71→240) taken 4 times.
✗ Branch 24 (71→258) not taken.
1117 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 1 case COMB(TY_INT, TY_DOUBLE): {
667
2/4
✓ Branch 0 (85→86) taken 1 times.
✗ Branch 1 (85→346) not taken.
✓ Branch 2 (86→87) taken 1 times.
✗ Branch 3 (86→346) not taken.
1 llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT);
668
3/6
✓ Branch 0 (87→88) taken 1 times.
✗ Branch 1 (87→294) not taken.
✓ Branch 2 (88→89) taken 1 times.
✗ Branch 3 (88→294) not taken.
✓ Branch 4 (89→90) taken 1 times.
✗ Branch 5 (89→294) not taken.
1 return {.value = builder.CreateFCmpONE(lhsFP, rhsV())};
669 }
670 107 case COMB(TY_INT, TY_INT):
671
4/8
✓ Branch 0 (92→93) taken 107 times.
✗ Branch 1 (92→295) not taken.
✓ Branch 2 (93→94) taken 107 times.
✗ Branch 3 (93→295) not taken.
✓ Branch 4 (94→95) taken 107 times.
✗ Branch 5 (94→295) not taken.
✓ Branch 6 (95→96) taken 107 times.
✗ Branch 7 (95→295) not taken.
107 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 446 case COMB(TY_LONG, TY_LONG):
714
4/8
✓ Branch 0 (181→182) taken 446 times.
✗ Branch 1 (181→313) not taken.
✓ Branch 2 (182→183) taken 446 times.
✗ Branch 3 (182→313) not taken.
✓ Branch 4 (183→184) taken 446 times.
✗ Branch 5 (183→313) not taken.
✓ Branch 6 (184→185) taken 446 times.
✗ Branch 7 (184→313) not taken.
446 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 8 case COMB(TY_BYTE, TY_INT):
721 case COMB(TY_CHAR, TY_INT): {
722
4/8
✓ Branch 0 (196→197) taken 8 times.
✗ Branch 1 (196→316) not taken.
✓ Branch 2 (197→198) taken 8 times.
✗ Branch 3 (197→316) not taken.
✓ Branch 4 (198→199) taken 8 times.
✗ Branch 5 (198→316) not taken.
✓ Branch 6 (199→200) taken 8 times.
✗ Branch 7 (199→316) not taken.
8 llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
723
3/6
✓ Branch 0 (200→201) taken 8 times.
✗ Branch 1 (200→317) not taken.
✓ Branch 2 (201→202) taken 8 times.
✗ Branch 3 (201→317) not taken.
✓ Branch 4 (202→203) taken 8 times.
✗ Branch 5 (202→317) not taken.
8 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 532 case COMB(TY_BYTE, TY_BYTE): // fallthrough
736 case COMB(TY_CHAR, TY_CHAR):
737
4/8
✓ Branch 0 (223→224) taken 532 times.
✗ Branch 1 (223→322) not taken.
✓ Branch 2 (224→225) taken 532 times.
✗ Branch 3 (224→322) not taken.
✓ Branch 4 (225→226) taken 532 times.
✗ Branch 5 (225→322) not taken.
✓ Branch 6 (226→227) taken 532 times.
✗ Branch 7 (226→322) not taken.
532 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 10 times.
✗ Branch 1 (12→278) not taken.
✓ Branch 2 (13→14) taken 10 times.
✗ Branch 3 (13→278) not taken.
✓ Branch 4 (14→15) taken 10 times.
✗ Branch 5 (14→278) not taken.
✓ Branch 6 (15→16) taken 10 times.
✗ Branch 7 (15→278) not taken.
✓ Branch 8 (16→17) taken 10 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.
1289 }
757
758 1484 LLVMExprResult OpRuleConversionManager::getLessInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
759 LLVMExprResult &rhs, QualType rhsSTy) {
760
1/2
✓ Branch 0 (2→3) taken 1484 times.
✗ Branch 1 (2→103) not taken.
2968 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
761
1/2
✓ Branch 0 (3→4) taken 1484 times.
✗ Branch 1 (3→104) not taken.
2968 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
762
1/2
✓ Branch 0 (4→5) taken 1484 times.
✗ Branch 1 (4→105) not taken.
1484 lhsSTy = lhsSTy.removeReferenceWrapper();
763
1/2
✓ Branch 0 (5→6) taken 1484 times.
✗ Branch 1 (5→106) not taken.
1484 rhsSTy = rhsSTy.removeReferenceWrapper();
764
1/2
✓ Branch 0 (6→7) taken 1484 times.
✗ Branch 1 (6→126) not taken.
1484 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
765
1/2
✓ Branch 0 (7→8) taken 1484 times.
✗ Branch 1 (7→126) not taken.
1484 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
766
767
8/16
✓ Branch 0 (8→9) taken 1484 times.
✗ Branch 1 (8→126) not taken.
✗ Branch 2 (9→10) not taken.
✓ Branch 3 (9→16) taken 10 times.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 72 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 5 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 3 times.
✓ Branch 10 (9→62) taken 3 times.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 15 times.
✓ Branch 14 (9→87) taken 1376 times.
✗ Branch 15 (9→91) not taken.
1484 switch (getTypeCombination(lhsSTy, rhsSTy)) {
768 case COMB(TY_DOUBLE, TY_DOUBLE):
769 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 72 case COMB(TY_INT, TY_INT):
781
3/6
✓ Branch 0 (30→31) taken 72 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 72 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 72 times.
✗ Branch 5 (32→126) not taken.
72 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 5 case COMB(TY_INT, TY_LONG): {
787
4/8
✓ Branch 0 (41→42) taken 5 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 5 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 5 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 5 times.
✗ Branch 7 (44→111) not taken.
5 llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
788
2/4
✓ Branch 0 (45→46) taken 5 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 5 times.
✗ Branch 3 (46→126) not taken.
5 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 3 case COMB(TY_SHORT, TY_SHORT):
799
3/6
✓ Branch 0 (62→63) taken 3 times.
✗ Branch 1 (62→126) not taken.
✓ Branch 2 (63→64) taken 3 times.
✗ Branch 3 (63→126) not taken.
✓ Branch 4 (64→65) taken 3 times.
✗ Branch 5 (64→126) not taken.
3 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 15 case COMB(TY_LONG, TY_INT): // fallthrough
809 case COMB(TY_LONG, TY_SHORT): {
810
4/8
✓ Branch 0 (80→81) taken 15 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 15 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 15 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 15 times.
✗ Branch 7 (83→116) not taken.
15 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
811
2/4
✓ Branch 0 (84→85) taken 15 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 15 times.
✗ Branch 3 (85→126) not taken.
15 return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsLong)};
812 }
813 1376 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 1376 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 1376 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 1376 times.
✗ Branch 5 (89→126) not taken.
1376 return {.value = generateLT(lhsSTy, rhsSTy, lhsV(), rhsV())};
817 default: // GCOV_EXCL_LINE
818 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <"); // GCOV_EXCL_LINE
819 }
820 1484 }
821
822 364 LLVMExprResult OpRuleConversionManager::getGreaterInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
823 LLVMExprResult &rhs, QualType rhsSTy) {
824
1/2
✓ Branch 0 (2→3) taken 364 times.
✗ Branch 1 (2→103) not taken.
728 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
825
1/2
✓ Branch 0 (3→4) taken 364 times.
✗ Branch 1 (3→104) not taken.
728 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
826
1/2
✓ Branch 0 (4→5) taken 364 times.
✗ Branch 1 (4→105) not taken.
364 lhsSTy = lhsSTy.removeReferenceWrapper();
827
1/2
✓ Branch 0 (5→6) taken 364 times.
✗ Branch 1 (5→106) not taken.
364 rhsSTy = rhsSTy.removeReferenceWrapper();
828
1/2
✓ Branch 0 (6→7) taken 364 times.
✗ Branch 1 (6→126) not taken.
364 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
829
1/2
✓ Branch 0 (7→8) taken 364 times.
✗ Branch 1 (7→126) not taken.
364 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
830
831
8/16
✓ Branch 0 (8→9) taken 364 times.
✗ Branch 1 (8→126) not taken.
✗ Branch 2 (9→10) not taken.
✓ Branch 3 (9→16) taken 2 times.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 14 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 12 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 6 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 9 times.
✓ Branch 14 (9→87) taken 317 times.
✗ Branch 15 (9→91) not taken.
364 switch (getTypeCombination(lhsSTy, rhsSTy)) {
832 case COMB(TY_DOUBLE, TY_DOUBLE):
833 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 14 case COMB(TY_INT, TY_INT):
845
3/6
✓ Branch 0 (30→31) taken 14 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 14 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 14 times.
✗ Branch 5 (32→126) not taken.
14 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 12 case COMB(TY_INT, TY_LONG): {
851
4/8
✓ Branch 0 (41→42) taken 12 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 12 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 12 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 12 times.
✗ Branch 7 (44→111) not taken.
12 llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
852
2/4
✓ Branch 0 (45→46) taken 12 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 12 times.
✗ Branch 3 (46→126) not taken.
12 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 4 case COMB(TY_SHORT, TY_SHORT):
863
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 = 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 9 case COMB(TY_LONG, TY_INT): // fallthrough
873 case COMB(TY_LONG, TY_SHORT): {
874
4/8
✓ Branch 0 (80→81) taken 9 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 9 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 9 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 9 times.
✗ Branch 7 (83→116) not taken.
9 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
875
2/4
✓ Branch 0 (84→85) taken 9 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 9 times.
✗ Branch 3 (85→126) not taken.
9 return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsLong)};
876 }
877 317 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 317 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 317 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 317 times.
✗ Branch 5 (89→126) not taken.
317 return {.value = generateGT(lhsSTy, rhsSTy, lhsV(), rhsV())};
881 default: // GCOV_EXCL_LINE
882 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >"); // GCOV_EXCL_LINE
883 }
884 364 }
885
886 317 LLVMExprResult OpRuleConversionManager::getLessEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
887 LLVMExprResult &rhs, QualType rhsSTy) {
888
1/2
✓ Branch 0 (2→3) taken 317 times.
✗ Branch 1 (2→103) not taken.
634 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
889
1/2
✓ Branch 0 (3→4) taken 317 times.
✗ Branch 1 (3→104) not taken.
634 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
890
1/2
✓ Branch 0 (4→5) taken 317 times.
✗ Branch 1 (4→105) not taken.
317 lhsSTy = lhsSTy.removeReferenceWrapper();
891
1/2
✓ Branch 0 (5→6) taken 317 times.
✗ Branch 1 (5→106) not taken.
317 rhsSTy = rhsSTy.removeReferenceWrapper();
892
1/2
✓ Branch 0 (6→7) taken 317 times.
✗ Branch 1 (6→126) not taken.
317 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
893
1/2
✓ Branch 0 (7→8) taken 317 times.
✗ Branch 1 (7→126) not taken.
317 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
894
895
5/16
✓ Branch 0 (8→9) taken 317 times.
✗ Branch 1 (8→126) not taken.
✗ Branch 2 (9→10) not taken.
✗ 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 303 times.
✗ Branch 15 (9→91) not taken.
317 switch (getTypeCombination(lhsSTy, rhsSTy)) {
896 case COMB(TY_DOUBLE, TY_DOUBLE):
897 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 303 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 303 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 303 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 303 times.
✗ Branch 5 (89→126) not taken.
303 return {.value = generateLE(lhsSTy, rhsSTy, lhsV(), rhsV())};
945 default: // GCOV_EXCL_LINE
946 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: <="); // GCOV_EXCL_LINE
947 }
948 317 }
949
950 752 LLVMExprResult OpRuleConversionManager::getGreaterEqualInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
951 LLVMExprResult &rhs, QualType rhsSTy) {
952
1/2
✓ Branch 0 (2→3) taken 752 times.
✗ Branch 1 (2→103) not taken.
1504 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
953
1/2
✓ Branch 0 (3→4) taken 752 times.
✗ Branch 1 (3→104) not taken.
1504 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
954
1/2
✓ Branch 0 (4→5) taken 752 times.
✗ Branch 1 (4→105) not taken.
752 lhsSTy = lhsSTy.removeReferenceWrapper();
955
1/2
✓ Branch 0 (5→6) taken 752 times.
✗ Branch 1 (5→106) not taken.
752 rhsSTy = rhsSTy.removeReferenceWrapper();
956
1/2
✓ Branch 0 (6→7) taken 752 times.
✗ Branch 1 (6→126) not taken.
752 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
957
1/2
✓ Branch 0 (7→8) taken 752 times.
✗ Branch 1 (7→126) not taken.
752 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
958
959
7/16
✓ Branch 0 (8→9) taken 752 times.
✗ Branch 1 (8→126) not taken.
✓ Branch 2 (9→10) taken 2 times.
✗ Branch 3 (9→16) not taken.
✗ Branch 4 (9→23) not taken.
✓ Branch 5 (9→30) taken 9 times.
✗ Branch 6 (9→34) not taken.
✓ Branch 7 (9→41) taken 8 times.
✗ Branch 8 (9→48) not taken.
✓ Branch 9 (9→55) taken 1 times.
✗ Branch 10 (9→62) not taken.
✗ Branch 11 (9→66) not taken.
✗ Branch 12 (9→73) not taken.
✓ Branch 13 (9→80) taken 149 times.
✓ Branch 14 (9→87) taken 583 times.
✗ Branch 15 (9→91) not taken.
752 switch (getTypeCombination(lhsSTy, rhsSTy)) {
960 2 case COMB(TY_DOUBLE, TY_DOUBLE):
961
4/8
✓ Branch 0 (10→11) taken 2 times.
✗ Branch 1 (10→107) not taken.
✓ Branch 2 (11→12) taken 2 times.
✗ Branch 3 (11→107) not taken.
✓ Branch 4 (12→13) taken 2 times.
✗ Branch 5 (12→107) not taken.
✓ Branch 6 (13→14) taken 2 times.
✗ Branch 7 (13→107) not taken.
2 return {.value = builder.CreateFCmpOGE(lhsV(), rhsV())};
962 case COMB(TY_DOUBLE, TY_INT): // fallthrough
963 case COMB(TY_DOUBLE, TY_SHORT): // fallthrough
964 case COMB(TY_DOUBLE, TY_LONG): {
965 llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT);
966 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 9 case COMB(TY_INT, TY_INT):
973
3/6
✓ Branch 0 (30→31) taken 9 times.
✗ Branch 1 (30→126) not taken.
✓ Branch 2 (31→32) taken 9 times.
✗ Branch 3 (31→126) not taken.
✓ Branch 4 (32→33) taken 9 times.
✗ Branch 5 (32→126) not taken.
9 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 8 case COMB(TY_INT, TY_LONG): {
979
4/8
✓ Branch 0 (41→42) taken 8 times.
✗ Branch 1 (41→111) not taken.
✓ Branch 2 (42→43) taken 8 times.
✗ Branch 3 (42→111) not taken.
✓ Branch 4 (43→44) taken 8 times.
✗ Branch 5 (43→111) not taken.
✓ Branch 6 (44→45) taken 8 times.
✗ Branch 7 (44→111) not taken.
8 llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
980
2/4
✓ Branch 0 (45→46) taken 8 times.
✗ Branch 1 (45→126) not taken.
✓ Branch 2 (46→47) taken 8 times.
✗ Branch 3 (46→126) not taken.
8 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 1 case COMB(TY_SHORT, TY_INT): {
987
4/8
✓ Branch 0 (55→56) taken 1 times.
✗ Branch 1 (55→113) not taken.
✓ Branch 2 (56→57) taken 1 times.
✗ Branch 3 (56→113) not taken.
✓ Branch 4 (57→58) taken 1 times.
✗ Branch 5 (57→113) not taken.
✓ Branch 6 (58→59) taken 1 times.
✗ Branch 7 (58→113) not taken.
1 llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
988
2/4
✓ Branch 0 (59→60) taken 1 times.
✗ Branch 1 (59→126) not taken.
✓ Branch 2 (60→61) taken 1 times.
✗ Branch 3 (60→126) not taken.
1 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 149 case COMB(TY_LONG, TY_INT): // fallthrough
1001 case COMB(TY_LONG, TY_SHORT): {
1002
4/8
✓ Branch 0 (80→81) taken 149 times.
✗ Branch 1 (80→116) not taken.
✓ Branch 2 (81→82) taken 149 times.
✗ Branch 3 (81→116) not taken.
✓ Branch 4 (82→83) taken 149 times.
✗ Branch 5 (82→116) not taken.
✓ Branch 6 (83→84) taken 149 times.
✗ Branch 7 (83→116) not taken.
149 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
1003
2/4
✓ Branch 0 (84→85) taken 149 times.
✗ Branch 1 (84→126) not taken.
✓ Branch 2 (85→86) taken 149 times.
✗ Branch 3 (85→126) not taken.
149 return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsLong)};
1004 }
1005 583 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 583 times.
✗ Branch 1 (87→126) not taken.
✓ Branch 2 (88→89) taken 583 times.
✗ Branch 3 (88→126) not taken.
✓ Branch 4 (89→90) taken 583 times.
✗ Branch 5 (89→126) not taken.
583 return {.value = generateGE(lhsSTy, rhsSTy, lhsV(), rhsV())};
1009 default: // GCOV_EXCL_LINE
1010 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: >="); // GCOV_EXCL_LINE
1011 }
1012 752 }
1013
1014 56 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 56 times.
✗ Branch 1 (2→86) not taken.
66 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1017
1/2
✓ Branch 0 (3→4) taken 56 times.
✗ Branch 1 (3→87) not taken.
107 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1018 102 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1019 61 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1020
1/2
✓ Branch 0 (6→7) taken 56 times.
✗ Branch 1 (6→88) not taken.
56 lhsSTy = lhsSTy.removeReferenceWrapper();
1021
1/2
✓ Branch 0 (7→8) taken 56 times.
✗ Branch 1 (7→89) not taken.
56 rhsSTy = rhsSTy.removeReferenceWrapper();
1022
1/2
✓ Branch 0 (8→9) taken 56 times.
✗ Branch 1 (8→117) not taken.
56 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1023
1024 // Handle operator overloads
1025
3/4
✓ Branch 0 (9→10) taken 56 times.
✗ Branch 1 (9→117) not taken.
✓ Branch 2 (10→11) taken 47 times.
✓ Branch 3 (10→19) taken 9 times.
56 if (callsOverloadedOpFct(node, opIdx))
1026 47 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1027
1028
4/10
✓ Branch 0 (19→20) taken 9 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 5 times.
✗ Branch 7 (20→57) not taken.
✗ Branch 8 (20→66) not taken.
✗ Branch 9 (20→72) not taken.
9 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 5 case COMB(TY_LONG, TY_LONG):
1046
4/8
✓ Branch 0 (51→52) taken 5 times.
✗ Branch 1 (51→104) not taken.
✓ Branch 2 (52→53) taken 5 times.
✗ Branch 3 (52→104) not taken.
✓ Branch 4 (53→54) taken 5 times.
✗ Branch 5 (53→104) not taken.
✓ Branch 6 (54→55) taken 5 times.
✗ Branch 7 (54→104) not taken.
5 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 47 times.
✗ Branch 1 (11→92) not taken.
✓ Branch 2 (12→13) taken 47 times.
✗ Branch 3 (12→92) not taken.
✓ Branch 4 (13→14) taken 47 times.
✗ Branch 5 (13→92) not taken.
✓ Branch 6 (14→15) taken 47 times.
✗ Branch 7 (14→92) not taken.
✓ Branch 8 (15→16) taken 47 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.
103 }
1059
1060 5 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 5 times.
✗ Branch 1 (2→72) not taken.
10 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1063
1/2
✓ Branch 0 (3→4) taken 5 times.
✗ Branch 1 (3→73) not taken.
10 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1064 5 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1065 5 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1066
1/2
✓ Branch 0 (6→7) taken 5 times.
✗ Branch 1 (6→74) not taken.
5 lhsSTy = lhsSTy.removeReferenceWrapper();
1067
1/2
✓ Branch 0 (7→8) taken 5 times.
✗ Branch 1 (7→75) not taken.
5 rhsSTy = rhsSTy.removeReferenceWrapper();
1068
1/2
✓ Branch 0 (8→9) taken 5 times.
✗ Branch 1 (8→96) not taken.
5 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1069
1070 // Handle operator overloads
1071
3/4
✓ Branch 0 (9→10) taken 5 times.
✗ Branch 1 (9→96) not taken.
✓ Branch 2 (10→11) taken 1 times.
✓ Branch 3 (10→19) taken 4 times.
5 if (callsOverloadedOpFct(node, opIdx))
1072 1 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1073
1074
3/10
✓ Branch 0 (19→20) taken 4 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 2 times.
✗ Branch 7 (20→47) not taken.
✗ Branch 8 (20→54) not taken.
✗ Branch 9 (20→58) not taken.
4 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 2 case COMB(TY_LONG, TY_LONG):
1092
3/6
✓ Branch 0 (43→44) taken 2 times.
✗ Branch 1 (43→96) not taken.
✓ Branch 2 (44→45) taken 2 times.
✗ Branch 3 (44→96) not taken.
✓ Branch 4 (45→46) taken 2 times.
✗ Branch 5 (45→96) not taken.
2 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.
6 }
1105
1106 2285 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 2285 times.
✗ Branch 1 (2→249) not taken.
4523 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1109
1/2
✓ Branch 0 (3→4) taken 2285 times.
✗ Branch 1 (3→250) not taken.
4523 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1110 2332 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1111 2332 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1112
1/2
✓ Branch 0 (6→7) taken 2285 times.
✗ Branch 1 (6→251) not taken.
2285 lhsSTy = lhsSTy.removeReferenceWrapper();
1113
1/2
✓ Branch 0 (7→8) taken 2285 times.
✗ Branch 1 (7→252) not taken.
2285 rhsSTy = rhsSTy.removeReferenceWrapper();
1114
1/2
✓ Branch 0 (8→9) taken 2285 times.
✗ Branch 1 (8→309) not taken.
2285 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1115
1/2
✓ Branch 0 (9→10) taken 2285 times.
✗ Branch 1 (9→309) not taken.
2285 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
1116
1117 // Handle operator overloads
1118
3/4
✓ Branch 0 (10→11) taken 2285 times.
✗ Branch 1 (10→309) not taken.
✓ Branch 2 (11→12) taken 48 times.
✓ Branch 3 (11→20) taken 2237 times.
2285 if (callsOverloadedOpFct(node, opIdx))
1119 48 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1120
1121
11/21
✓ Branch 0 (20→21) taken 2237 times.
✗ Branch 1 (20→309) not taken.
✓ Branch 2 (21→22) taken 15 times.
✓ Branch 3 (21→28) taken 17 times.
✓ Branch 4 (21→35) taken 1 times.
✓ Branch 5 (21→42) taken 39 times.
✗ Branch 6 (21→54) not taken.
✓ Branch 7 (21→69) taken 28 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 114 times.
✓ Branch 16 (21→183) taken 1582 times.
✗ Branch 17 (21→195) not taken.
✗ Branch 18 (21→209) not taken.
✓ Branch 19 (21→221) taken 438 times.
✗ Branch 20 (21→235) not taken.
2237 switch (getTypeCombination(lhsSTy, rhsSTy)) {
1122 15 case COMB(TY_DOUBLE, TY_DOUBLE):
1123
4/8
✓ Branch 0 (22→23) taken 15 times.
✗ Branch 1 (22→261) not taken.
✓ Branch 2 (23→24) taken 15 times.
✗ Branch 3 (23→261) not taken.
✓ Branch 4 (24→25) taken 15 times.
✗ Branch 5 (24→261) not taken.
✓ Branch 6 (25→26) taken 15 times.
✗ Branch 7 (25→261) not taken.
15 return {.value = builder.CreateFAdd(lhsV(), rhsV())};
1124 17 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 17 times.
✗ Branch 1 (28→309) not taken.
✓ Branch 2 (29→30) taken 17 times.
✗ Branch 3 (29→309) not taken.
17 llvm::Value *rhsFP = generateIToFp(rhsSTy, rhsV(), lhsT);
1128
3/6
✓ Branch 0 (30→31) taken 17 times.
✗ Branch 1 (30→262) not taken.
✓ Branch 2 (31→32) taken 17 times.
✗ Branch 3 (31→262) not taken.
✓ Branch 4 (32→33) taken 17 times.
✗ Branch 5 (32→262) not taken.
17 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 39 case COMB(TY_INT, TY_INT):
1135
9/16
✓ Branch 0 (42→43) taken 39 times.
✗ Branch 1 (42→309) not taken.
✓ Branch 2 (43→44) taken 37 times.
✓ Branch 3 (43→47) taken 2 times.
✓ Branch 4 (44→45) taken 37 times.
✗ Branch 5 (44→309) not taken.
✓ Branch 6 (45→46) taken 37 times.
✗ Branch 7 (45→47) not taken.
✓ Branch 8 (48→49) taken 39 times.
✗ Branch 9 (48→264) not taken.
✓ Branch 10 (49→50) taken 39 times.
✗ Branch 11 (49→264) not taken.
✓ Branch 12 (50→51) taken 39 times.
✗ Branch 13 (50→264) not taken.
✓ Branch 14 (51→52) taken 39 times.
✗ Branch 15 (51→264) not taken.
39 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 28 case COMB(TY_INT, TY_LONG): {
1141
4/8
✓ Branch 0 (69→70) taken 28 times.
✗ Branch 1 (69→267) not taken.
✓ Branch 2 (70→71) taken 28 times.
✗ Branch 3 (70→267) not taken.
✓ Branch 4 (71→72) taken 28 times.
✗ Branch 5 (71→267) not taken.
✓ Branch 6 (72→73) taken 28 times.
✗ Branch 7 (72→267) not taken.
28 llvm::Value *lhsLong = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
1142
5/14
✓ Branch 0 (73→74) taken 28 times.
✗ Branch 1 (73→309) not taken.
✗ Branch 2 (74→75) not taken.
✓ Branch 3 (74→78) taken 28 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 28 times.
✗ Branch 9 (79→268) not taken.
✓ Branch 10 (80→81) taken 28 times.
✗ Branch 11 (80→268) not taken.
✓ Branch 12 (81→82) taken 28 times.
✗ Branch 13 (81→268) not taken.
28 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 114 case COMB(TY_LONG, TY_INT): // fallthrough
1171 case COMB(TY_LONG, TY_SHORT): {
1172
4/8
✓ Branch 0 (168→169) taken 114 times.
✗ Branch 1 (168→286) not taken.
✓ Branch 2 (169→170) taken 114 times.
✗ Branch 3 (169→286) not taken.
✓ Branch 4 (170→171) taken 114 times.
✗ Branch 5 (170→286) not taken.
✓ Branch 6 (171→172) taken 114 times.
✗ Branch 7 (171→286) not taken.
114 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
1173
8/14
✓ Branch 0 (172→173) taken 114 times.
✗ Branch 1 (172→309) not taken.
✓ Branch 2 (173→174) taken 92 times.
✓ Branch 3 (173→177) taken 22 times.
✓ Branch 4 (174→175) taken 92 times.
✗ Branch 5 (174→309) not taken.
✓ Branch 6 (175→176) taken 92 times.
✗ Branch 7 (175→177) not taken.
✓ Branch 8 (178→179) taken 114 times.
✗ Branch 9 (178→287) not taken.
✓ Branch 10 (179→180) taken 114 times.
✗ Branch 11 (179→287) not taken.
✓ Branch 12 (180→181) taken 114 times.
✗ Branch 13 (180→287) not taken.
114 return {.value = builder.CreateAdd(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())};
1174 }
1175 1582 case COMB(TY_LONG, TY_LONG):
1176
10/16
✓ Branch 0 (183→184) taken 1582 times.
✗ Branch 1 (183→309) not taken.
✓ Branch 2 (184→185) taken 168 times.
✓ Branch 3 (184→188) taken 1414 times.
✓ Branch 4 (185→186) taken 168 times.
✗ Branch 5 (185→309) not taken.
✓ Branch 6 (186→187) taken 11 times.
✓ Branch 7 (186→188) taken 157 times.
✓ Branch 8 (189→190) taken 1582 times.
✗ Branch 9 (189→288) not taken.
✓ Branch 10 (190→191) taken 1582 times.
✗ Branch 11 (190→288) not taken.
✓ Branch 12 (191→192) taken 1582 times.
✗ Branch 13 (191→288) not taken.
✓ Branch 14 (192→193) taken 1582 times.
✗ Branch 15 (192→288) not taken.
1582 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 438 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 438 times.
✗ Branch 1 (221→295) not taken.
✓ Branch 2 (222→223) taken 438 times.
✗ Branch 3 (222→295) not taken.
✓ Branch 4 (223→224) taken 438 times.
✗ Branch 5 (223→295) not taken.
✓ Branch 6 (224→225) taken 438 times.
✗ Branch 7 (224→295) not taken.
✓ Branch 8 (225→226) taken 438 times.
✗ Branch 9 (225→295) not taken.
438 llvm::Value *rhsExt = builder.CreateIntCast(rhsV(), builder.getInt64Ty(), rhsSTy.isSigned());
1188
5/10
✓ Branch 0 (227→228) taken 438 times.
✗ Branch 1 (227→298) not taken.
✓ Branch 2 (229→230) taken 438 times.
✗ Branch 3 (229→297) not taken.
✓ Branch 4 (230→231) taken 438 times.
✗ Branch 5 (230→296) not taken.
✓ Branch 6 (231→232) taken 438 times.
✗ Branch 7 (231→296) not taken.
✓ Branch 8 (232→233) taken 438 times.
✗ Branch 9 (232→296) not taken.
438 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 48 times.
✗ Branch 1 (12→255) not taken.
✓ Branch 2 (13→14) taken 48 times.
✗ Branch 3 (13→255) not taken.
✓ Branch 4 (14→15) taken 48 times.
✗ Branch 5 (14→255) not taken.
✓ Branch 6 (15→16) taken 48 times.
✗ Branch 7 (15→255) not taken.
✓ Branch 8 (16→17) taken 48 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.
2333 }
1194
1195 1547 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 1547 times.
✗ Branch 1 (2→249) not taken.
3094 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1198
1/2
✓ Branch 0 (3→4) taken 1547 times.
✗ Branch 1 (3→250) not taken.
3094 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1199 1547 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1200 1547 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1201
1/2
✓ Branch 0 (6→7) taken 1547 times.
✗ Branch 1 (6→251) not taken.
1547 lhsSTy = lhsSTy.removeReferenceWrapper();
1202
1/2
✓ Branch 0 (7→8) taken 1547 times.
✗ Branch 1 (7→252) not taken.
1547 rhsSTy = rhsSTy.removeReferenceWrapper();
1203
1/2
✓ Branch 0 (8→9) taken 1547 times.
✗ Branch 1 (8→309) not taken.
1547 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1204
1/2
✓ Branch 0 (9→10) taken 1547 times.
✗ Branch 1 (9→309) not taken.
1547 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
1205
1206 // Handle operator overloads
1207
3/4
✓ Branch 0 (10→11) taken 1547 times.
✗ Branch 1 (10→309) not taken.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 3 (11→20) taken 1546 times.
1547 if (callsOverloadedOpFct(node, opIdx))
1208 1 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1209
1210
6/21
✓ Branch 0 (20→21) taken 1546 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 29 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 2 times.
✗ Branch 12 (21→132) not taken.
✗ Branch 13 (21→147) not taken.
✗ Branch 14 (21→161) not taken.
✓ Branch 15 (21→168) taken 66 times.
✓ Branch 16 (21→183) taken 1441 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.
1546 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 29 case COMB(TY_INT, TY_INT):
1224
8/16
✓ Branch 0 (42→43) taken 29 times.
✗ Branch 1 (42→309) not taken.
✓ Branch 2 (43→44) taken 29 times.
✗ Branch 3 (43→47) not taken.
✓ Branch 4 (44→45) taken 29 times.
✗ Branch 5 (44→309) not taken.
✓ Branch 6 (45→46) taken 29 times.
✗ Branch 7 (45→47) not taken.
✓ Branch 8 (48→49) taken 29 times.
✗ Branch 9 (48→264) not taken.
✓ Branch 10 (49→50) taken 29 times.
✗ Branch 11 (49→264) not taken.
✓ Branch 12 (50→51) taken 29 times.
✗ Branch 13 (50→264) not taken.
✓ Branch 14 (51→52) taken 29 times.
✗ Branch 15 (51→264) not taken.
29 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 2 case COMB(TY_SHORT, TY_SHORT):
1246
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.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 66 case COMB(TY_LONG, TY_INT): // fallthrough
1260 case COMB(TY_LONG, TY_SHORT): {
1261
4/8
✓ Branch 0 (168→169) taken 66 times.
✗ Branch 1 (168→286) not taken.
✓ Branch 2 (169→170) taken 66 times.
✗ Branch 3 (169→286) not taken.
✓ Branch 4 (170→171) taken 66 times.
✗ Branch 5 (170→286) not taken.
✓ Branch 6 (171→172) taken 66 times.
✗ Branch 7 (171→286) not taken.
66 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
1262
8/14
✓ Branch 0 (172→173) taken 66 times.
✗ Branch 1 (172→309) not taken.
✓ Branch 2 (173→174) taken 10 times.
✓ Branch 3 (173→177) taken 56 times.
✓ Branch 4 (174→175) taken 10 times.
✗ Branch 5 (174→309) not taken.
✓ Branch 6 (175→176) taken 10 times.
✗ Branch 7 (175→177) not taken.
✓ Branch 8 (178→179) taken 66 times.
✗ Branch 9 (178→287) not taken.
✓ Branch 10 (179→180) taken 66 times.
✗ Branch 11 (179→287) not taken.
✓ Branch 12 (180→181) taken 66 times.
✗ Branch 13 (180→287) not taken.
66 return {.value = builder.CreateSub(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())};
1263 }
1264 1441 case COMB(TY_LONG, TY_LONG):
1265
10/16
✓ Branch 0 (183→184) taken 1441 times.
✗ Branch 1 (183→309) not taken.
✓ Branch 2 (184→185) taken 234 times.
✓ Branch 3 (184→188) taken 1207 times.
✓ Branch 4 (185→186) taken 234 times.
✗ Branch 5 (185→309) not taken.
✓ Branch 6 (186→187) taken 82 times.
✓ Branch 7 (186→188) taken 152 times.
✓ Branch 8 (189→190) taken 1441 times.
✗ Branch 9 (189→288) not taken.
✓ Branch 10 (190→191) taken 1441 times.
✗ Branch 11 (190→288) not taken.
✓ Branch 12 (191→192) taken 1441 times.
✗ Branch 13 (191→288) not taken.
✓ Branch 14 (192→193) taken 1441 times.
✗ Branch 15 (192→288) not taken.
1441 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.
1548 }
1283
1284 640 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 640 times.
✗ Branch 1 (2→181) not taken.
1275 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1287
1/2
✓ Branch 0 (3→4) taken 640 times.
✗ Branch 1 (3→182) not taken.
1277 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1288 645 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1289 643 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1290
1/2
✓ Branch 0 (6→7) taken 640 times.
✗ Branch 1 (6→183) not taken.
640 lhsSTy = lhsSTy.removeReferenceWrapper();
1291
1/2
✓ Branch 0 (7→8) taken 640 times.
✗ Branch 1 (7→184) not taken.
640 rhsSTy = rhsSTy.removeReferenceWrapper();
1292
1/2
✓ Branch 0 (8→9) taken 640 times.
✗ Branch 1 (8→220) not taken.
640 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1293
1/2
✓ Branch 0 (9→10) taken 640 times.
✗ Branch 1 (9→220) not taken.
640 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
1294
1295 // Handle operator overloads
1296
3/4
✓ Branch 0 (10→11) taken 640 times.
✗ Branch 1 (10→220) not taken.
✓ Branch 2 (11→12) taken 9 times.
✓ Branch 3 (11→20) taken 631 times.
640 if (callsOverloadedOpFct(node, opIdx))
1297 9 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1298
1299
9/16
✓ Branch 0 (20→21) taken 631 times.
✗ Branch 1 (20→220) not taken.
✓ Branch 2 (21→22) taken 10 times.
✓ Branch 3 (21→28) taken 2 times.
✗ Branch 4 (21→35) not taken.
✓ Branch 5 (21→42) taken 13 times.
✗ Branch 6 (21→54) not taken.
✓ Branch 7 (21→69) taken 2 times.
✗ Branch 8 (21→84) not taken.
✓ Branch 9 (21→91) taken 2 times.
✗ Branch 10 (21→106) not taken.
✓ Branch 11 (21→118) taken 1 times.
✗ Branch 12 (21→133) not taken.
✓ Branch 13 (21→140) taken 489 times.
✓ Branch 14 (21→155) taken 112 times.
✗ Branch 15 (21→167) not taken.
631 switch (getTypeCombination(lhsSTy, rhsSTy)) {
1300 10 case COMB(TY_DOUBLE, TY_DOUBLE):
1301
4/8
✓ Branch 0 (22→23) taken 10 times.
✗ Branch 1 (22→193) not taken.
✓ Branch 2 (23→24) taken 10 times.
✗ Branch 3 (23→193) not taken.
✓ Branch 4 (24→25) taken 10 times.
✗ Branch 5 (24→193) not taken.
✓ Branch 6 (25→26) taken 10 times.
✗ Branch 7 (25→193) not taken.
10 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 13 case COMB(TY_INT, TY_INT):
1313
9/16
✓ Branch 0 (42→43) taken 13 times.
✗ Branch 1 (42→220) not taken.
✓ Branch 2 (43→44) taken 11 times.
✓ Branch 3 (43→47) taken 2 times.
✓ Branch 4 (44→45) taken 11 times.
✗ Branch 5 (44→220) not taken.
✓ Branch 6 (45→46) taken 11 times.
✗ Branch 7 (45→47) not taken.
✓ Branch 8 (48→49) taken 13 times.
✗ Branch 9 (48→196) not taken.
✓ Branch 10 (49→50) taken 13 times.
✗ Branch 11 (49→196) not taken.
✓ Branch 12 (50→51) taken 13 times.
✗ Branch 13 (50→196) not taken.
✓ Branch 14 (51→52) taken 13 times.
✗ Branch 15 (51→196) not taken.
13 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 2 case COMB(TY_SHORT, TY_INT): {
1327
4/8
✓ Branch 0 (91→92) taken 2 times.
✗ Branch 1 (91→202) not taken.
✓ Branch 2 (92→93) taken 2 times.
✗ Branch 3 (92→202) not taken.
✓ Branch 4 (93→94) taken 2 times.
✗ Branch 5 (93→202) not taken.
✓ Branch 6 (94→95) taken 2 times.
✗ Branch 7 (94→202) not taken.
2 llvm::Value *lhsInt = builder.CreateIntCast(lhsV(), rhsT, rhsSTy.isSigned());
1328
7/14
✓ Branch 0 (95→96) taken 2 times.
✗ Branch 1 (95→220) not taken.
✓ Branch 2 (96→97) taken 2 times.
✗ Branch 3 (96→100) not taken.
✓ Branch 4 (97→98) taken 2 times.
✗ Branch 5 (97→220) not taken.
✓ Branch 6 (98→99) taken 2 times.
✗ Branch 7 (98→100) not taken.
✓ Branch 8 (101→102) taken 2 times.
✗ Branch 9 (101→203) not taken.
✓ Branch 10 (102→103) taken 2 times.
✗ Branch 11 (102→203) not taken.
✓ Branch 12 (103→104) taken 2 times.
✗ Branch 13 (103→203) not taken.
2 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 489 case COMB(TY_LONG, TY_INT): // fallthrough
1341 case COMB(TY_LONG, TY_SHORT): {
1342
4/8
✓ Branch 0 (140→141) taken 489 times.
✗ Branch 1 (140→208) not taken.
✓ Branch 2 (141→142) taken 489 times.
✗ Branch 3 (141→208) not taken.
✓ Branch 4 (142→143) taken 489 times.
✗ Branch 5 (142→208) not taken.
✓ Branch 6 (143→144) taken 489 times.
✗ Branch 7 (143→208) not taken.
489 llvm::Value *rhsLong = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned());
1343
8/14
✓ Branch 0 (144→145) taken 489 times.
✗ Branch 1 (144→220) not taken.
✓ Branch 2 (145→146) taken 3 times.
✓ Branch 3 (145→149) taken 486 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 489 times.
✗ Branch 9 (150→209) not taken.
✓ Branch 10 (151→152) taken 489 times.
✗ Branch 11 (151→209) not taken.
✓ Branch 12 (152→153) taken 489 times.
✗ Branch 13 (152→209) not taken.
489 return {.value = builder.CreateMul(lhsV(), rhsLong, "", false, lhsSTy.isSigned() && rhsSTy.isSigned())};
1344 }
1345 112 case COMB(TY_LONG, TY_LONG): // fallthrough
1346 case COMB(TY_BYTE, TY_BYTE):
1347
10/16
✓ Branch 0 (155→156) taken 112 times.
✗ Branch 1 (155→220) not taken.
✓ Branch 2 (156→157) taken 102 times.
✓ Branch 3 (156→160) taken 10 times.
✓ Branch 4 (157→158) taken 102 times.
✗ Branch 5 (157→220) not taken.
✓ Branch 6 (158→159) taken 17 times.
✓ Branch 7 (158→160) taken 85 times.
✓ Branch 8 (161→162) taken 112 times.
✗ Branch 9 (161→210) not taken.
✓ Branch 10 (162→163) taken 112 times.
✗ Branch 11 (162→210) not taken.
✓ Branch 12 (163→164) taken 112 times.
✗ Branch 13 (163→210) not taken.
✓ Branch 14 (164→165) taken 112 times.
✗ Branch 15 (164→210) not taken.
112 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.
649 }
1352
1353 205 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 205 times.
✗ Branch 1 (2→133) not taken.
408 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1356
1/2
✓ Branch 0 (3→4) taken 205 times.
✗ Branch 1 (3→134) not taken.
410 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1357 207 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1358 205 ResolverFct rhsP = [&] { return irGenerator->resolveAddress(rhs); };
1359
1/2
✓ Branch 0 (6→7) taken 205 times.
✗ Branch 1 (6→135) not taken.
205 lhsSTy = lhsSTy.removeReferenceWrapper();
1360
1/2
✓ Branch 0 (7→8) taken 205 times.
✗ Branch 1 (7→136) not taken.
205 rhsSTy = rhsSTy.removeReferenceWrapper();
1361
1/2
✓ Branch 0 (8→9) taken 205 times.
✗ Branch 1 (8→172) not taken.
205 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1362
1/2
✓ Branch 0 (9→10) taken 205 times.
✗ Branch 1 (9→172) not taken.
205 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
1363
1364 // Handle operator overloads
1365
3/4
✓ Branch 0 (10→11) taken 205 times.
✗ Branch 1 (10→172) not taken.
✓ Branch 2 (11→12) taken 3 times.
✓ Branch 3 (11→20) taken 202 times.
205 if (callsOverloadedOpFct(node, opIdx))
1366 3 return callOperatorOverloadFct<2>(node, {lhsV, lhsP, rhsV, rhsP}, opIdx);
1367
1368
8/16
✓ Branch 0 (20→21) taken 202 times.
✗ Branch 1 (20→172) not taken.
✓ Branch 2 (21→22) taken 18 times.
✓ Branch 3 (21→28) taken 2 times.
✗ Branch 4 (21→35) not taken.
✓ 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 171 times.
✗ Branch 15 (21→119) not taken.
202 switch (getTypeCombination(lhsSTy, rhsSTy)) {
1369 18 case COMB(TY_DOUBLE, TY_DOUBLE):
1370
4/8
✓ Branch 0 (22→23) taken 18 times.
✗ Branch 1 (22→145) not taken.
✓ Branch 2 (23→24) taken 18 times.
✗ Branch 3 (23→145) not taken.
✓ Branch 4 (24→25) taken 18 times.
✗ Branch 5 (24→145) not taken.
✓ Branch 6 (25→26) taken 18 times.
✗ Branch 7 (25→145) not taken.
18 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 case COMB(TY_INT, TY_DOUBLE): {
1378 llvm::Value *lhsFP = generateIToFp(lhsSTy, lhsV(), rhsT);
1379 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 171 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 171 times.
✗ Branch 1 (113→162) not taken.
✓ Branch 2 (114→115) taken 171 times.
✗ Branch 3 (114→162) not taken.
✓ Branch 4 (115→116) taken 171 times.
✗ Branch 5 (115→162) not taken.
✓ Branch 6 (116→117) taken 171 times.
✗ Branch 7 (116→162) not taken.
171 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.
208 }
1422
1423 9 LLVMExprResult OpRuleConversionManager::getRemInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy, LLVMExprResult &rhs,
1424 QualType rhsSTy) const {
1425
1/2
✓ Branch 0 (2→3) taken 9 times.
✗ Branch 1 (2→75) not taken.
18 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1426
1/2
✓ Branch 0 (3→4) taken 9 times.
✗ Branch 1 (3→76) not taken.
18 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1427
1/2
✓ Branch 0 (4→5) taken 9 times.
✗ Branch 1 (4→77) not taken.
9 lhsSTy = lhsSTy.removeReferenceWrapper();
1428
1/2
✓ Branch 0 (5→6) taken 9 times.
✗ Branch 1 (5→78) not taken.
9 rhsSTy = rhsSTy.removeReferenceWrapper();
1429
1/2
✓ Branch 0 (6→7) taken 9 times.
✗ Branch 1 (6→94) not taken.
9 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1430
1/2
✓ Branch 0 (7→8) taken 9 times.
✗ Branch 1 (7→94) not taken.
9 llvm::Type *rhsT = rhsSTy.toLLVMType(irGenerator->sourceFile);
1431
1432
3/12
✓ Branch 0 (8→9) taken 9 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 6 times.
✗ Branch 11 (9→63) not taken.
9 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 6 case COMB(TY_LONG, TY_LONG):
1461
3/6
✓ Branch 0 (59→60) taken 6 times.
✗ Branch 1 (59→94) not taken.
✓ Branch 2 (60→61) taken 6 times.
✗ Branch 3 (60→94) not taken.
✓ Branch 4 (61→62) taken 6 times.
✗ Branch 5 (61→94) not taken.
6 return {.value = generateRem(lhsSTy, rhsSTy, lhsV(), rhsV())};
1462 default: // GCOV_EXCL_LINE
1463 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: %"); // GCOV_EXCL_LINE
1464 }
1465 9 }
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 28 LLVMExprResult OpRuleConversionManager::getPrefixPlusPlusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const {
1485
1/2
✓ Branch 0 (2→3) taken 28 times.
✗ Branch 1 (2→49) not taken.
56 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1486
1/2
✓ Branch 0 (3→4) taken 28 times.
✗ Branch 1 (3→50) not taken.
28 lhsSTy = lhsSTy.removeReferenceWrapper();
1487
1488
3/7
✓ Branch 0 (4→5) taken 28 times.
✗ Branch 1 (4→67) not taken.
✓ Branch 2 (5→6) taken 22 times.
✗ Branch 3 (5→13) not taken.
✓ Branch 4 (5→20) taken 6 times.
✗ Branch 5 (5→27) not taken.
✗ Branch 6 (5→37) not taken.
28 switch (lhsSTy.getSuperType()) {
1489 22 case TY_INT:
1490
5/10
✓ Branch 0 (6→7) taken 22 times.
✗ Branch 1 (6→67) not taken.
✓ Branch 2 (7→8) taken 22 times.
✗ Branch 3 (7→51) not taken.
✓ Branch 4 (8→9) taken 22 times.
✗ Branch 5 (8→51) not taken.
✓ Branch 6 (9→10) taken 22 times.
✗ Branch 7 (9→51) not taken.
✓ Branch 8 (10→11) taken 22 times.
✗ Branch 9 (10→51) not taken.
22 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 6 case TY_LONG:
1494
5/10
✓ Branch 0 (20→21) taken 6 times.
✗ Branch 1 (20→67) not taken.
✓ Branch 2 (21→22) taken 6 times.
✗ Branch 3 (21→53) not taken.
✓ Branch 4 (22→23) taken 6 times.
✗ Branch 5 (22→53) not taken.
✓ Branch 6 (23→24) taken 6 times.
✗ Branch 7 (23→53) not taken.
✓ Branch 8 (24→25) taken 6 times.
✗ Branch 9 (24→53) not taken.
6 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 28 }
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 589 LLVMExprResult OpRuleConversionManager::getPrefixNotInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy) const {
1527
1/2
✓ Branch 0 (2→3) taken 589 times.
✗ Branch 1 (2→22) not taken.
1178 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1528
1/2
✓ Branch 0 (3→4) taken 589 times.
✗ Branch 1 (3→23) not taken.
589 lhsSTy = lhsSTy.removeReferenceWrapper();
1529
1530
2/4
✓ Branch 0 (4→5) taken 589 times.
✗ Branch 1 (4→34) not taken.
✓ Branch 2 (5→6) taken 589 times.
✗ Branch 3 (5→12) not taken.
589 switch (lhsSTy.getSuperType()) {
1531 589 case TY_BOOL:
1532
3/6
✓ Branch 0 (6→7) taken 589 times.
✗ Branch 1 (6→24) not taken.
✓ Branch 2 (7→8) taken 589 times.
✗ Branch 3 (7→24) not taken.
✓ Branch 4 (8→9) taken 589 times.
✗ Branch 5 (8→24) not taken.
1178 return {.value = builder.CreateNot(lhsV())};
1533 default:
1534 break;
1535 }
1536 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: !"); // GCOV_EXCL_LINE
1537 589 }
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 1442 LLVMExprResult OpRuleConversionManager::getPostfixPlusPlusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
1555 size_t opIdx) {
1556
1/2
✓ Branch 0 (2→3) taken 1442 times.
✗ Branch 1 (2→59) not taken.
2875 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1557 1451 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1558
1/2
✓ Branch 0 (4→5) taken 1442 times.
✗ Branch 1 (4→60) not taken.
1442 lhsSTy = lhsSTy.removeReferenceWrapper();
1559
1560 // Handle operator overloads
1561
3/4
✓ Branch 0 (5→6) taken 1442 times.
✗ Branch 1 (5→85) not taken.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 3 (6→13) taken 1433 times.
1442 if (callsOverloadedOpFct(node, opIdx))
1562 9 return callOperatorOverloadFct<1>(node, {lhsV, lhsP}, opIdx);
1563
1564
5/7
✓ Branch 0 (13→14) taken 1433 times.
✗ Branch 1 (13→85) not taken.
✓ Branch 2 (14→15) taken 76 times.
✓ Branch 3 (14→22) taken 5 times.
✓ Branch 4 (14→29) taken 1351 times.
✓ Branch 5 (14→36) taken 1 times.
✗ Branch 6 (14→46) not taken.
1433 switch (lhsSTy.getSuperType()) {
1565 76 case TY_INT:
1566
5/10
✓ Branch 0 (15→16) taken 76 times.
✗ Branch 1 (15→85) not taken.
✓ Branch 2 (16→17) taken 76 times.
✗ Branch 3 (16→69) not taken.
✓ Branch 4 (17→18) taken 76 times.
✗ Branch 5 (17→69) not taken.
✓ Branch 6 (18→19) taken 76 times.
✗ Branch 7 (18→69) not taken.
✓ Branch 8 (19→20) taken 76 times.
✗ Branch 9 (19→69) not taken.
76 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 1351 case TY_LONG:
1570
5/10
✓ Branch 0 (29→30) taken 1351 times.
✗ Branch 1 (29→85) not taken.
✓ Branch 2 (30→31) taken 1351 times.
✗ Branch 3 (30→71) not taken.
✓ Branch 4 (31→32) taken 1351 times.
✗ Branch 5 (31→71) not taken.
✓ Branch 6 (32→33) taken 1351 times.
✗ Branch 7 (32→71) not taken.
✓ Branch 8 (33→34) taken 1351 times.
✗ Branch 9 (33→71) not taken.
1351 return {.value = builder.CreateAdd(lhsV(), builder.getInt64(1), "", false, lhsSTy.isSigned())};
1571 1 case TY_PTR: {
1572
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);
1573
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))};
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.
1451 }
1580
1581 330 LLVMExprResult OpRuleConversionManager::getPostfixMinusMinusInst(const ASTNode *node, LLVMExprResult &lhs, QualType lhsSTy,
1582 size_t opIdx) {
1583
1/2
✓ Branch 0 (2→3) taken 330 times.
✗ Branch 1 (2→59) not taken.
653 ResolverFct lhsV = [&] { return irGenerator->resolveValue(lhsSTy, lhs); };
1584 337 ResolverFct lhsP = [&] { return irGenerator->resolveAddress(lhs); };
1585
1/2
✓ Branch 0 (4→5) taken 330 times.
✗ Branch 1 (4→60) not taken.
330 lhsSTy = lhsSTy.removeReferenceWrapper();
1586
1587 // Handle operator overloads
1588
3/4
✓ Branch 0 (5→6) taken 330 times.
✗ Branch 1 (5→85) not taken.
✓ Branch 2 (6→7) taken 7 times.
✓ Branch 3 (6→13) taken 323 times.
330 if (callsOverloadedOpFct(node, opIdx))
1589 7 return callOperatorOverloadFct<1>(node, {lhsV, lhsP}, opIdx);
1590
1591
5/7
✓ Branch 0 (13→14) taken 323 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 315 times.
✓ Branch 5 (14→36) taken 1 times.
✗ Branch 6 (14→46) not taken.
323 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 315 case TY_LONG:
1597
5/10
✓ Branch 0 (29→30) taken 315 times.
✗ Branch 1 (29→85) not taken.
✓ Branch 2 (30→31) taken 315 times.
✗ Branch 3 (30→71) not taken.
✓ Branch 4 (31→32) taken 315 times.
✗ Branch 5 (31→71) not taken.
✓ Branch 6 (32→33) taken 315 times.
✗ Branch 7 (32→71) not taken.
✓ Branch 8 (33→34) taken 315 times.
✗ Branch 9 (33→71) not taken.
315 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.
337 }
1607
1608 2512 LLVMExprResult OpRuleConversionManager::getCastInst(const ASTNode *node, QualType lhsSTy, LLVMExprResult &rhs,
1609 QualType rhsSTy) const {
1610
1/2
✓ Branch 0 (2→3) taken 2512 times.
✗ Branch 1 (2→99) not taken.
3707 ResolverFct rhsV = [&] { return irGenerator->resolveValue(rhsSTy, rhs); };
1611
1/2
✓ Branch 0 (3→4) taken 2512 times.
✗ Branch 1 (3→100) not taken.
2512 lhsSTy = lhsSTy.removeReferenceWrapper();
1612
1/2
✓ Branch 0 (4→5) taken 2512 times.
✗ Branch 1 (4→101) not taken.
2512 rhsSTy = rhsSTy.removeReferenceWrapper();
1613
1/2
✓ Branch 0 (5→6) taken 2512 times.
✗ Branch 1 (5→123) not taken.
2512 llvm::Type *lhsT = lhsSTy.toLLVMType(irGenerator->sourceFile);
1614
1615 // Handle identity casts
1616
3/4
✓ Branch 0 (6→7) taken 2512 times.
✗ Branch 1 (6→123) not taken.
✓ Branch 2 (7→8) taken 1094 times.
✓ Branch 3 (7→9) taken 1418 times.
2512 if (lhsSTy.matches(rhsSTy, false, true, false))
1617 1094 return rhs;
1618
1619
13/15
✓ Branch 0 (9→10) taken 1418 times.
✗ Branch 1 (9→123) not taken.
✓ Branch 2 (10→11) taken 223 times.
✓ Branch 3 (10→12) taken 2 times.
✓ Branch 4 (10→24) taken 56 times.
✓ Branch 5 (10→30) taken 2 times.
✓ Branch 6 (10→42) taken 16 times.
✓ Branch 7 (10→48) taken 6 times.
✓ Branch 8 (10→54) taken 4 times.
✓ Branch 9 (10→66) taken 303 times.
✓ Branch 10 (10→72) taken 32 times.
✓ Branch 11 (10→78) taken 1 times.
✓ Branch 12 (10→80) taken 30 times.
✓ Branch 13 (10→86) taken 743 times.
✗ Branch 14 (10→88) not taken.
1418 switch (getTypeCombination(lhsSTy, rhsSTy)) {
1620 223 case COMB(TY_DOUBLE, TY_DOUBLE): // fallthrough
1621 case COMB(TY_INT, TY_INT): // fallthrough
1622 case COMB(TY_SHORT, TY_SHORT): // fallthrough
1623 case COMB(TY_LONG, TY_LONG): // fallthrough
1624 case COMB(TY_BYTE, TY_BYTE): // fallthrough
1625 case COMB(TY_CHAR, TY_CHAR): // fallthrough
1626 case COMB(TY_STRING, TY_STRING): // fallthrough
1627 case COMB(TY_BOOL, TY_BOOL): // fallthrough
1628 case COMB(TY_PTR, TY_PTR):
1629 223 return rhs; // Identity cast
1630 2 case COMB(TY_INT, TY_DOUBLE):
1631
2/4
✓ Branch 0 (12→13) taken 2 times.
✗ Branch 1 (12→123) not taken.
✓ Branch 2 (13→14) taken 2 times.
✗ Branch 3 (13→19) not taken.
2 if (lhsSTy.isSigned())
1632
3/6
✓ Branch 0 (14→15) taken 2 times.
✗ Branch 1 (14→102) not taken.
✓ Branch 2 (15→16) taken 2 times.
✗ Branch 3 (15→102) not taken.
✓ Branch 4 (16→17) taken 2 times.
✗ Branch 5 (16→102) not taken.
2 return {.value = builder.CreateFPToSI(rhsV(), lhsT)};
1633 else
1634 return {.value = builder.CreateFPToUI(rhsV(), lhsT)};
1635 56 case COMB(TY_INT, TY_SHORT): // fallthrough
1636 case COMB(TY_INT, TY_LONG): // fallthrough
1637 case COMB(TY_INT, TY_BYTE): // fallthrough
1638 case COMB(TY_INT, TY_CHAR):
1639
4/8
✓ Branch 0 (24→25) taken 56 times.
✗ Branch 1 (24→104) not taken.
✓ Branch 2 (25→26) taken 56 times.
✗ Branch 3 (25→104) not taken.
✓ Branch 4 (26→27) taken 56 times.
✗ Branch 5 (26→104) not taken.
✓ Branch 6 (27→28) taken 56 times.
✗ Branch 7 (27→104) not taken.
56 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1640 2 case COMB(TY_SHORT, TY_DOUBLE):
1641
2/4
✓ Branch 0 (30→31) taken 2 times.
✗ Branch 1 (30→123) not taken.
✓ Branch 2 (31→32) taken 2 times.
✗ Branch 3 (31→37) not taken.
2 if (lhsSTy.isSigned())
1642
3/6
✓ Branch 0 (32→33) taken 2 times.
✗ Branch 1 (32→105) not taken.
✓ Branch 2 (33→34) taken 2 times.
✗ Branch 3 (33→105) not taken.
✓ Branch 4 (34→35) taken 2 times.
✗ Branch 5 (34→105) not taken.
2 return {.value = builder.CreateFPToSI(rhsV(), lhsT)};
1643 else
1644 return {.value = builder.CreateFPToUI(rhsV(), lhsT)};
1645 16 case COMB(TY_SHORT, TY_INT):
1646
4/8
✓ Branch 0 (42→43) taken 16 times.
✗ Branch 1 (42→107) not taken.
✓ Branch 2 (43→44) taken 16 times.
✗ Branch 3 (43→107) not taken.
✓ Branch 4 (44→45) taken 16 times.
✗ Branch 5 (44→107) not taken.
✓ Branch 6 (45→46) taken 16 times.
✗ Branch 7 (45→107) not taken.
16 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1647 6 case COMB(TY_SHORT, TY_LONG):
1648
4/8
✓ Branch 0 (48→49) taken 6 times.
✗ Branch 1 (48→108) not taken.
✓ Branch 2 (49→50) taken 6 times.
✗ Branch 3 (49→108) not taken.
✓ Branch 4 (50→51) taken 6 times.
✗ Branch 5 (50→108) not taken.
✓ Branch 6 (51→52) taken 6 times.
✗ Branch 7 (51→108) not taken.
6 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1649 4 case COMB(TY_LONG, TY_DOUBLE):
1650
3/4
✓ Branch 0 (54→55) taken 4 times.
✗ Branch 1 (54→123) not taken.
✓ Branch 2 (55→56) taken 2 times.
✓ Branch 3 (55→61) taken 2 times.
4 if (lhsSTy.isSigned())
1651
3/6
✓ Branch 0 (56→57) taken 2 times.
✗ Branch 1 (56→109) not taken.
✓ Branch 2 (57→58) taken 2 times.
✗ Branch 3 (57→109) not taken.
✓ Branch 4 (58→59) taken 2 times.
✗ Branch 5 (58→109) not taken.
2 return {.value = builder.CreateFPToSI(rhsV(), lhsT)};
1652 else
1653
3/6
✓ Branch 0 (61→62) taken 2 times.
✗ Branch 1 (61→110) not taken.
✓ Branch 2 (62→63) taken 2 times.
✗ Branch 3 (62→110) not taken.
✓ Branch 4 (63→64) taken 2 times.
✗ Branch 5 (63→110) not taken.
2 return {.value = builder.CreateFPToUI(rhsV(), lhsT)};
1654 303 case COMB(TY_LONG, TY_INT): // fallthrough
1655 case COMB(TY_LONG, TY_SHORT):
1656
4/8
✓ Branch 0 (66→67) taken 303 times.
✗ Branch 1 (66→111) not taken.
✓ Branch 2 (67→68) taken 303 times.
✗ Branch 3 (67→111) not taken.
✓ Branch 4 (68→69) taken 303 times.
✗ Branch 5 (68→111) not taken.
✓ Branch 6 (69→70) taken 303 times.
✗ Branch 7 (69→111) not taken.
303 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1657 32 case COMB(TY_BYTE, TY_INT): // fallthrough
1658 case COMB(TY_BYTE, TY_SHORT): // fallthrough
1659 case COMB(TY_BYTE, TY_LONG):
1660
4/8
✓ Branch 0 (72→73) taken 32 times.
✗ Branch 1 (72→112) not taken.
✓ Branch 2 (73→74) taken 32 times.
✗ Branch 3 (73→112) not taken.
✓ Branch 4 (74→75) taken 32 times.
✗ Branch 5 (74→112) not taken.
✓ Branch 6 (75→76) taken 32 times.
✗ Branch 7 (75→112) not taken.
32 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1661 1 case COMB(TY_BYTE, TY_CHAR):
1662
1/2
✓ Branch 0 (78→79) taken 1 times.
✗ Branch 1 (78→123) not taken.
1 return {.value = rhsV()};
1663 30 case COMB(TY_CHAR, TY_INT): // fallthrough
1664 case COMB(TY_CHAR, TY_SHORT): // fallthrough
1665 case COMB(TY_CHAR, TY_LONG):
1666
4/8
✓ Branch 0 (80→81) taken 30 times.
✗ Branch 1 (80→113) not taken.
✓ Branch 2 (81→82) taken 30 times.
✗ Branch 3 (81→113) not taken.
✓ Branch 4 (82→83) taken 30 times.
✗ Branch 5 (82→113) not taken.
✓ Branch 6 (83→84) taken 30 times.
✗ Branch 7 (83→113) not taken.
30 return {.value = builder.CreateIntCast(rhsV(), lhsT, lhsSTy.isSigned())};
1667 743 case COMB(TY_CHAR, TY_BYTE): // fallthrough
1668 case COMB(TY_STRING, TY_PTR): // fallthrough
1669 case COMB(TY_PTR, TY_STRING):
1670
1/2
✓ Branch 0 (86→87) taken 743 times.
✗ Branch 1 (86→123) not taken.
743 return {.value = rhsV()};
1671 default: // GCOV_EXCL_LINE
1672 throw CompilerError(UNHANDLED_BRANCH, "Operator fallthrough: (cast)"); // GCOV_EXCL_LINE
1673 }
1674 2512 }
1675
1676 15675 bool OpRuleConversionManager::callsOverloadedOpFct(const ASTNode *node, size_t opIdx) const {
1677 15675 const std::vector<const Function *> &opFctList = irGenerator->getOpFctPointers(node);
1678
4/4
✓ Branch 0 (4→5) taken 15210 times.
✓ Branch 1 (4→8) taken 465 times.
✓ Branch 2 (6→7) taken 719 times.
✓ Branch 3 (6→8) taken 14491 times.
15675 return opFctList.size() > opIdx && opFctList.at(opIdx) != nullptr;
1679 }
1680
1681 template <size_t N>
1682 703 LLVMExprResult OpRuleConversionManager::callOperatorOverloadFct(const ASTNode *node, const std::array<ResolverFct, N * 2> &opV,
1683 size_t opIdx) {
1684 static_assert(N == 1 || N == 2, "Only unary and binary operators are overloadable");
1685 703 const size_t manIdx = irGenerator->manIdx;
1686
1/2
✓ Branch 0 (2→3) taken 703 times.
✗ Branch 1 (2→120) not taken.
703 const std::vector<std::vector<const Function *>> *opFctPointers = node->getOpFctPointers();
1687
2/4
✓ Branch 0 (4→5) taken 703 times.
✗ Branch 1 (4→8) not taken.
✓ Branch 2 (6→7) taken 703 times.
✗ Branch 3 (6→8) not taken.
703 assert(!opFctPointers->empty() && opFctPointers->size() > manIdx);
1688
4/8
✓ Branch 0 (9→10) taken 703 times.
✗ Branch 1 (9→120) not taken.
✓ Branch 2 (11→12) taken 703 times.
✗ Branch 3 (11→16) not taken.
✓ Branch 4 (12→13) taken 703 times.
✗ Branch 5 (12→120) not taken.
✓ Branch 6 (14→15) taken 703 times.
✗ Branch 7 (14→16) not taken.
703 assert(!opFctPointers->at(manIdx).empty() && opFctPointers->at(manIdx).size() > opIdx);
1689
2/4
✓ Branch 0 (17→18) taken 703 times.
✗ Branch 1 (17→120) not taken.
✓ Branch 2 (18→19) taken 703 times.
✗ Branch 3 (18→120) not taken.
703 const Function *opFct = opFctPointers->at(manIdx).at(opIdx);
1690
1/2
✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 703 times.
703 assert(opFct != nullptr);
1691
1692
1/2
✓ Branch 0 (21→22) taken 703 times.
✗ Branch 1 (21→120) not taken.
703 const std::string mangledName = opFct->getMangledName();
1693
1/2
✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 703 times.
703 assert(opFct->entry->scope != nullptr);
1694
1695 // Get arg values
1696
1/2
✓ Branch 0 (24→25) taken 703 times.
✗ Branch 1 (24→118) not taken.
703 const QualTypeList &paramTypes = opFct->getParamTypes();
1697
1/2
✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 703 times.
703 assert(paramTypes.size() == N);
1698 llvm::Value *argValues[N];
1699
5/8
✓ Branch 0 (29→30) taken 703 times.
✗ Branch 1 (29→116) not taken.
✓ Branch 2 (30→31) taken 621 times.
✓ Branch 3 (30→34) taken 82 times.
✓ Branch 4 (32→33) taken 621 times.
✗ Branch 5 (32→116) not taken.
✓ Branch 6 (35→36) taken 82 times.
✗ Branch 7 (35→116) not taken.
703 argValues[0] = paramTypes[0].isRef() ? opV[1]() : opV[0]();
1700 if constexpr (N == 2)
1701
5/8
✓ Branch 0 (38→39) taken 687 times.
✗ Branch 1 (38→125) not taken.
✓ Branch 2 (39→40) taken 364 times.
✓ Branch 3 (39→43) taken 323 times.
✓ Branch 4 (41→42) taken 364 times.
✗ Branch 5 (41→125) not taken.
✓ Branch 6 (44→45) taken 323 times.
✗ Branch 7 (44→125) not taken.
687 argValues[1] = paramTypes[1].isRef() ? opV[3]() : opV[2]();
1702
1703 // Function is not defined in the current module -> declare it
1704
3/4
✓ Branch 0 (38→39) taken 703 times.
✗ Branch 1 (38→96) not taken.
✓ Branch 2 (39→40) taken 133 times.
✓ Branch 3 (39→61) taken 570 times.
703 if (!irGenerator->module->getFunction(mangledName)) {
1705 // Get returnType
1706
1/2
✓ Branch 0 (40→41) taken 133 times.
✗ Branch 1 (40→105) not taken.
133 llvm::Type *returnType = builder.getVoidTy();
1707
3/4
✓ Branch 0 (41→42) taken 133 times.
✗ Branch 1 (41→105) not taken.
✓ Branch 2 (42→43) taken 66 times.
✓ Branch 3 (42→45) taken 67 times.
133 if (!opFct->returnType.is(TY_DYN))
1708
1/2
✓ Branch 0 (43→44) taken 66 times.
✗ Branch 1 (43→105) not taken.
66 returnType = opFct->returnType.toLLVMType(irGenerator->sourceFile);
1709
1710 // Get arg types
1711 133 std::vector<llvm::Type *> argTypes;
1712
3/4
✓ Branch 0 (45→46) taken 133 times.
✗ Branch 1 (45→100) not taken.
✓ Branch 2 (53→48) taken 254 times.
✓ Branch 3 (53→54) taken 133 times.
387 for (const QualType &paramType : opFct->getParamTypes())
1713
2/4
✓ Branch 0 (49→50) taken 254 times.
✗ Branch 1 (49→97) not taken.
✓ Branch 2 (50→51) taken 254 times.
✗ Branch 3 (50→97) not taken.
254 argTypes.push_back(paramType.toLLVMType(irGenerator->sourceFile));
1714
1715
1/2
✓ Branch 0 (56→57) taken 133 times.
✗ Branch 1 (56→101) not taken.
133 llvm::FunctionType *fctType = llvm::FunctionType::get(returnType, argTypes, false);
1716
1/2
✓ Branch 0 (58→59) taken 133 times.
✗ Branch 1 (58→102) not taken.
133 irGenerator->module->getOrInsertFunction(mangledName, fctType);
1717 133 }
1718
1719 // Get callee function
1720
1/2
✓ Branch 0 (62→63) taken 703 times.
✗ Branch 1 (62→106) not taken.
703 llvm::Function *callee = irGenerator->module->getFunction(mangledName);
1721
1/2
✗ Branch 0 (63→64) not taken.
✓ Branch 1 (63→65) taken 703 times.
703 assert(callee != nullptr);
1722
1723 // Generate function call
1724
4/8
✓ Branch 0 (65→66) taken 703 times.
✗ Branch 1 (65→109) not taken.
✓ Branch 2 (67→68) taken 703 times.
✗ Branch 3 (67→107) not taken.
✓ Branch 4 (68→69) taken 703 times.
✗ Branch 5 (68→107) not taken.
✓ Branch 6 (69→70) taken 703 times.
✗ Branch 7 (69→116) not taken.
703 llvm::Value *result = builder.CreateCall(callee, argValues);
1725
1726 // If this is a procedure, return true
1727
2/2
✓ Branch 0 (72→73) taken 142 times.
✓ Branch 1 (72→75) taken 561 times.
703 if (opFct->isProcedure())
1728
1/2
✓ Branch 0 (73→74) taken 142 times.
✗ Branch 1 (73→116) not taken.
142 return {.constant = builder.getTrue()};
1729
1730 // Attach address to anonymous symbol to keep track of de-allocation
1731 561 SymbolTableEntry *anonymousSymbol = nullptr;
1732 561 llvm::Value *resultPtr = nullptr;
1733
3/4
✓ Branch 0 (75→76) taken 561 times.
✗ Branch 1 (75→116) not taken.
✓ Branch 2 (76→77) taken 63 times.
✓ Branch 3 (76→88) taken 498 times.
561 if (opFct->returnType.is(TY_STRUCT)) {
1734
1/2
✓ Branch 0 (77→78) taken 63 times.
✗ Branch 1 (77→116) not taken.
63 anonymousSymbol = irGenerator->currentScope->symbolTable.lookupAnonymous(node->codeLoc, opIdx);
1735
2/2
✓ Branch 0 (78→79) taken 33 times.
✓ Branch 1 (78→88) taken 30 times.
63 if (anonymousSymbol != nullptr) {
1736
1/2
✓ Branch 0 (83→84) taken 33 times.
✗ Branch 1 (83→110) not taken.
66 resultPtr = irGenerator->insertAlloca(result->getType());
1737
1/2
✓ Branch 0 (86→87) taken 33 times.
✗ Branch 1 (86→116) not taken.
33 irGenerator->insertStore(result, resultPtr);
1738
1/2
✓ Branch 0 (87→88) taken 33 times.
✗ Branch 1 (87→116) not taken.
33 anonymousSymbol->updateAddress(resultPtr);
1739 }
1740 }
1741
1742 // If the return type is reference, return the result value as refPtr
1743
3/4
✓ Branch 0 (88→89) taken 561 times.
✗ Branch 1 (88→116) not taken.
✓ Branch 2 (89→90) taken 134 times.
✓ Branch 3 (89→91) taken 427 times.
561 if (opFct->returnType.isRef())
1744 134 return {.ptr = result, .refPtr = resultPtr, .entry = anonymousSymbol};
1745
1746 // Otherwise as value
1747 427 return {.value = result, .ptr = resultPtr, .entry = anonymousSymbol};
1748 703 }
1749
1750 46 llvm::Value *OpRuleConversionManager::generateIToFp(const QualType &srcSTy, llvm::Value *srcV, llvm::Type *tgtT) const {
1751
2/2
✓ Branch 0 (3→4) taken 44 times.
✓ Branch 1 (3→8) taken 2 times.
46 if (srcSTy.isSigned())
1752
2/4
✓ Branch 0 (4→5) taken 44 times.
✗ Branch 1 (4→13) not taken.
✓ Branch 2 (5→6) taken 44 times.
✗ Branch 3 (5→13) not taken.
44 return builder.CreateSIToFP(srcV, tgtT);
1753 else
1754
2/4
✓ Branch 0 (8→9) taken 2 times.
✗ Branch 1 (8→14) not taken.
✓ Branch 2 (9→10) taken 2 times.
✗ Branch 3 (9→14) not taken.
2 return builder.CreateUIToFP(srcV, tgtT);
1755 }
1756
1757 6 llvm::Value *OpRuleConversionManager::generateSHR(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1758 llvm::Value *rhsV) const {
1759
2/2
✓ Branch 0 (3→4) taken 5 times.
✓ Branch 1 (3→8) taken 1 times.
6 if (lhsSTy.isSigned())
1760
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);
1761 else
1762
2/4
✓ Branch 0 (8→9) taken 1 times.
✗ Branch 1 (8→14) not taken.
✓ Branch 2 (9→10) taken 1 times.
✗ Branch 3 (9→14) not taken.
1 return builder.CreateLShr(lhsV, rhsV);
1763 }
1764
1765 1474 llvm::Value *OpRuleConversionManager::generateLT(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1766 llvm::Value *rhsV) const {
1767
6/6
✓ Branch 0 (3→4) taken 96 times.
✓ Branch 1 (3→7) taken 1378 times.
✓ Branch 2 (5→6) taken 87 times.
✓ Branch 3 (5→7) taken 9 times.
✓ Branch 4 (8→9) taken 87 times.
✓ Branch 5 (8→13) taken 1387 times.
1474 if (lhsSTy.isSigned() && rhsSTy.isSigned())
1768
2/4
✓ Branch 0 (9→10) taken 87 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 87 times.
✗ Branch 3 (10→18) not taken.
87 return builder.CreateICmpSLT(lhsV, rhsV);
1769 else
1770
2/4
✓ Branch 0 (13→14) taken 1387 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 1387 times.
✗ Branch 3 (14→19) not taken.
1387 return builder.CreateICmpULT(lhsV, rhsV);
1771 }
1772
1773 317 llvm::Value *OpRuleConversionManager::generateLE(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1774 llvm::Value *rhsV) const {
1775
5/6
✓ Branch 0 (3→4) taken 18 times.
✓ Branch 1 (3→7) taken 299 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 299 times.
317 if (lhsSTy.isSigned() && rhsSTy.isSigned())
1776
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);
1777 else
1778
2/4
✓ Branch 0 (13→14) taken 299 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 299 times.
✗ Branch 3 (14→19) not taken.
299 return builder.CreateICmpULE(lhsV, rhsV);
1779 }
1780
1781 362 llvm::Value *OpRuleConversionManager::generateGT(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1782 llvm::Value *rhsV) const {
1783
6/6
✓ Branch 0 (3→4) taken 117 times.
✓ Branch 1 (3→7) taken 245 times.
✓ Branch 2 (5→6) taken 29 times.
✓ Branch 3 (5→7) taken 88 times.
✓ Branch 4 (8→9) taken 29 times.
✓ Branch 5 (8→13) taken 333 times.
362 if (lhsSTy.isSigned() && rhsSTy.isSigned())
1784
2/4
✓ Branch 0 (9→10) taken 29 times.
✗ Branch 1 (9→18) not taken.
✓ Branch 2 (10→11) taken 29 times.
✗ Branch 3 (10→18) not taken.
29 return builder.CreateICmpSGT(lhsV, rhsV);
1785 else
1786
2/4
✓ Branch 0 (13→14) taken 333 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 333 times.
✗ Branch 3 (14→19) not taken.
333 return builder.CreateICmpUGT(lhsV, rhsV);
1787 }
1788
1789 750 llvm::Value *OpRuleConversionManager::generateGE(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1790 llvm::Value *rhsV) const {
1791
6/6
✓ Branch 0 (3→4) taken 22 times.
✓ Branch 1 (3→7) taken 728 times.
✓ Branch 2 (5→6) taken 18 times.
✓ Branch 3 (5→7) taken 4 times.
✓ Branch 4 (8→9) taken 18 times.
✓ Branch 5 (8→13) taken 732 times.
750 if (lhsSTy.isSigned() && rhsSTy.isSigned())
1792
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.CreateICmpSGE(lhsV, rhsV);
1793 else
1794
2/4
✓ Branch 0 (13→14) taken 732 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 732 times.
✗ Branch 3 (14→19) not taken.
732 return builder.CreateICmpUGE(lhsV, rhsV);
1795 }
1796
1797 3 llvm::Value *OpRuleConversionManager::generateDiv(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1798 llvm::Value *rhsV) const {
1799
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())
1800
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);
1801 else
1802 return builder.CreateUDiv(lhsV, rhsV);
1803 }
1804
1805 13 llvm::Value *OpRuleConversionManager::generateRem(const QualType &lhsSTy, const QualType &rhsSTy, llvm::Value *lhsV,
1806 llvm::Value *rhsV) const {
1807
6/6
✓ Branch 0 (3→4) taken 6 times.
✓ Branch 1 (3→7) taken 7 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 10 times.
13 if (lhsSTy.isSigned() && rhsSTy.isSigned())
1808
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);
1809 else
1810
2/4
✓ Branch 0 (13→14) taken 10 times.
✗ Branch 1 (13→19) not taken.
✓ Branch 2 (14→15) taken 10 times.
✗ Branch 3 (14→19) not taken.
10 return builder.CreateURem(lhsV, rhsV);
1811 }
1812
1813 } // namespace spice::compiler
1814