15 #ifndef TOOLS_CIRCT_LEC_UTILITY_H
16 #define TOOLS_CIRCT_LEC_UTILITY_H
18 #include "mlir/IR/Value.h"
19 #include "mlir/Support/IndentedOstream.h"
20 #include "llvm/ADT/APInt.h"
21 #include "llvm/Support/Debug.h"
22 #include "llvm/Support/raw_ostream.h"
28 inline mlir::raw_indented_ostream &
dbgs() {
29 static auto stream = mlir::raw_indented_ostream(
llvm::dbgs());
33 inline mlir::raw_indented_ostream &
errs() {
34 static auto stream = mlir::raw_indented_ostream(
llvm::errs());
38 inline mlir::raw_indented_ostream &
outs() {
39 static auto stream = mlir::raw_indented_ostream(
llvm::outs());
52 lec::dbgs() <<
"symbol: " << expr.to_string() <<
"\n";
53 lec::dbgs() <<
"sort: " << expr.get_sort().to_string() <<
"\n";
54 lec::dbgs() <<
"expression id: " << expr.id() <<
"\n";
55 lec::dbgs() <<
"expression hash: " << expr.hash() <<
"\n";
60 lec::dbgs() <<
"value: " << value <<
"\n";
61 lec::dbgs() <<
"type: " << value.getType() <<
"\n";
67 lec::dbgs() <<
"APInt: " << value.getZExtValue() <<
"\n";
This header provides a variety of utility functions and macros for use throughout the tool.
void printExpr(const z3::expr &expr)
Helper function to provide a common debug formatting for z3 expressions.
void printValue(const mlir::Value &value)
Helper function to provide a common debug formatting for MLIR values.
mlir::raw_indented_ostream & outs()
mlir::raw_indented_ostream & errs()
void printAPInt(const mlir::APInt &value)
Helper function to provide a common debug formatting for MLIR APInt'egers.
mlir::raw_indented_ostream & dbgs()
llvm::hash_code hash_value(const T &e)
RAII struct to indent the output streams.
mlir::raw_indented_ostream::DelimitedScope indentDbgs
mlir::raw_indented_ostream::DelimitedScope indentOuts
mlir::raw_indented_ostream::DelimitedScope indentErrs