19#include <llvm/ADT/SmallVector.h>
20#include <llvm/Support/ErrorHandling.h>
23#define GEN_PASS_DEF_CONSTRAINTDEPENDENCYGRAPHPRINTERPASS
32 using Base = ConstraintDependencyGraphPrinterPassBase<PassImpl>;
35 void runOnOperation()
override {
36 markAllAnalysesPreserved();
38 if (!llvm::isa<ModuleOp>(getOperation())) {
39 const char *msg =
"ConstraintDependencyGraphPrinterPass error: should be run on ModuleOp!";
40 getOperation()->emitError(msg).report();
41 llvm::report_fatal_error(msg);
44 auto &cs = getAnalysis<llzk::ConstraintDependencyGraphModuleAnalysis>();
45 cs.setIntraprocedural(runIntraprocedural);
46 auto am = getAnalysisManager();
47 cs.ensureAnalysisRun(am);
50 for (
const auto &[s, cdg] : cs.getCurrentResults()) {
51 auto &structDef =
const_cast<llzk::component::StructDefOp &
>(s);
55 "could not resolve fully qualified name of struct " + Twine(structDef.getName())
57 os << fullName.value() <<
' ';
llvm::raw_ostream & toStream(OutputStream val)
void ensure(bool condition, const llvm::Twine &errMsg)
FailureOr< SymbolRefAttr > getPathFromTopRoot(SymbolOpInterface to, ModuleOp *foundRoot)