| 146 | } |
| 147 | |
| 148 | Id Builder::makePointer(StorageClass storageClass, Id pointee) |
| 149 | { |
| 150 | // try to find it |
| 151 | Instruction* type; |
| 152 | for (int t = 0; t < (int)groupedTypes[enumCast(Op::OpTypePointer)].size(); ++t) { |
| 153 | type = groupedTypes[enumCast(Op::OpTypePointer)][t]; |
| 154 | if (type->getImmediateOperand(0) == (unsigned)storageClass && |
| 155 | type->getIdOperand(1) == pointee) |
| 156 | return type->getResultId(); |
| 157 | } |
| 158 | |
| 159 | // not found, make it |
| 160 | type = new Instruction(getUniqueId(), NoType, Op::OpTypePointer); |
| 161 | type->reserveOperands(2); |
| 162 | type->addImmediateOperand(storageClass); |
| 163 | type->addIdOperand(pointee); |
| 164 | groupedTypes[enumCast(Op::OpTypePointer)].push_back(type); |
| 165 | constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type)); |
| 166 | module.mapInstruction(type); |
| 167 | |
| 168 | if (emitNonSemanticShaderDebugInfo) { |
| 169 | const Id debugResultId = makePointerDebugType(storageClass, pointee); |
| 170 | debugTypeIdLookup[type->getResultId()] = debugResultId; |
| 171 | } |
| 172 | |
| 173 | return type->getResultId(); |
| 174 | } |
| 175 | |
| 176 | Id Builder::makeForwardPointer(StorageClass storageClass) |
| 177 | { |
no test coverage detected