Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIRRTL][InferWidths] Tweak debug printing to show names and more bits. #5415

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/Dialect/FIRRTL/Transforms/InferWidths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ struct RootExpr : public ExprBase<RootExpr, Expr::Kind::Root> {
struct VarExpr : public ExprBase<VarExpr, Expr::Kind::Var> {
void print(llvm::raw_ostream &os) const {
// Hash the `this` pointer into something somewhat human readable. Since
// this is just for debug dumping, we wrap around at 4096 variables.
os << "var" << ((size_t)this / llvm::PowerOf2Ceil(sizeof(*this)) & 0xFFF);
// this is just for debug dumping, we wrap around at 65536 variables.
os << "var" << ((size_t)this / llvm::PowerOf2Ceil(sizeof(*this)) & 0xFFFF);
}

/// The constraint expression this variable is supposed to be greater than or
Expand Down Expand Up @@ -1979,6 +1979,9 @@ void InferenceMapping::setExpr(FieldRef fieldRef, Expr *expr) {
llvm::dbgs() << "Expr " << *expr << " for " << fieldRef.getValue();
if (fieldRef.getFieldID())
llvm::dbgs() << " '" << getFieldName(fieldRef).first << "'";
auto fieldName = getFieldName(fieldRef);
if (fieldName.second)
llvm::dbgs() << " (\"" << fieldName.first << "\")";
llvm::dbgs() << "\n";
});
opExprs[fieldRef] = expr;
Expand Down