GCC Code Coverage Report


Directory: ../
File: src/irgenerator/OpRuleConversionManager.cpp
Date: 2025-10-23 00:48:11
Coverage Exec Excl Total
Lines: 64.8% 782 61 1268
Functions: 93.2% 124 0 133
Branches: 30.9% 1500 136 4994

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