| 131 | BasicBlock Function::sink_bb("#sink"); |
| 132 | |
| 133 | unsigned Function::FnDecl::hash() const { |
| 134 | GenHash hash; |
| 135 | |
| 136 | function<void(const Type&)> hash_ty = [&](const Type &ty) { |
| 137 | if (ty.isPtrType()) { |
| 138 | hash.add((uint8_t)0x42); |
| 139 | } else if (dynamic_cast<const VoidType*>(&ty)) { |
| 140 | hash.add((uint8_t)0xEF); |
| 141 | } else if (auto agg = ty.getAsAggregateType()) { |
| 142 | hash.add((uint8_t)0x11); |
| 143 | for (unsigned i = 0, e = agg->numElementsConst(); i != e; ++i) { |
| 144 | if (!agg->isPadding(i)) |
| 145 | hash_ty(agg->getChild(i)); |
| 146 | } |
| 147 | } else { |
| 148 | uint8_t data[2] = { uint8_t(0x33+ty.isFloatType()), (uint8_t)ty.bits() }; |
| 149 | hash.add(data, sizeof(data)); |
| 150 | } |
| 151 | }; |
| 152 | |
| 153 | for (auto &[ty, attrs] : inputs) { |
| 154 | hash_ty(*ty); |
| 155 | } |
| 156 | hash_ty(*output); |
| 157 | hash.add(is_varargs * 32); |
| 158 | return hash(); |
| 159 | } |
| 160 | |
| 161 | expr Function::getTypeConstraints() const { |
| 162 | expr t(true); |
no test coverage detected