llvm / llvm/circt

[HW] Make `hw::getBitWidth` use std::optional vs -1

Open
#9,287 2 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

HW
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Convert `circt::getBitWidth` to return `std::optional`. Also convert the `BitWidthTypeInterface` `getBitWidth` method to return the same instead of a signed version. Update the callsites. Where the callsites do not check for it, add an assertion. In cases where a bitwidth was inappropriately assumed (e.g. canonicalizers) but wasn't checked or asserted, update the code to bail out appropriately without making changes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.