This method gets or creates an index for an operation.
| 584 | |
| 585 | /// This method gets or creates an index for an operation. |
| 586 | uint64_t getOpIndex(Operation *op) { |
| 587 | auto it = opIndexMap.find(op); |
| 588 | if (it != opIndexMap.end()) |
| 589 | return it->second; |
| 590 | |
| 591 | // Check if the operation location has a reserved index and return it. |
| 592 | auto reserved = getDebugReserved(op->getLoc()); |
| 593 | if (reserved != Bytecode::DebugReserved::SIZE) |
| 594 | return static_cast<uint64_t>(reserved); |
| 595 | |
| 596 | // Adjust the index to account for reserved indices. |
| 597 | uint64_t opIndex = opIndexMap.size() + |
| 598 | static_cast<uint64_t>(Bytecode::DebugReserved::SIZE); |
| 599 | |
| 600 | opIndexMap[op] = opIndex; |
| 601 | return opIndex; |
| 602 | } |
| 603 | |
| 604 | /// This method adds a debug info attribute to an operation. |
| 605 | void addDebugInfo(uint64_t opIndex, Attribute attr) { |
no test coverage detected