12 #include "llvm/ADT/SetVector.h" 13 #include "llvm/ADT/TypeSwitch.h" 22 #define GET_ATTRDEF_CLASSES 23 #include "mlir/IR/BuiltinLocationAttributes.cpp.inc" 29 void BuiltinDialect::registerLocationAttributes() {
31 #define GET_ATTRDEF_LIST 32 #include "mlir/IR/BuiltinLocationAttributes.cpp.inc" 41 if (walkFn(*this).wasInterrupted())
46 if (callLoc.getCallee()->walk(walkFn).wasInterrupted())
48 return callLoc.getCaller()->walk(walkFn);
51 for (
Location subLoc : fusedLoc.getLocations())
52 if (subLoc->walk(walkFn).wasInterrupted())
57 return nameLoc.getChildLoc()->walk(walkFn);
60 return opaqueLoc.getFallbackLocation()->walk(walkFn);
67 return attr.
isa<CallSiteLoc, FileLineColLoc, FusedLoc, NameLoc, OpaqueLoc,
76 assert(!frames.empty() &&
"required at least 1 call frame");
78 for (
auto frame : llvm::reverse(frames.drop_back()))
79 caller = CallSiteLoc::get(frame, caller);
80 return CallSiteLoc::get(name, caller);
90 llvm::SmallSetVector<Location, 4> decomposedLocs;
91 for (
auto loc : locs) {
94 if (
auto fusedLoc = loc.dyn_cast<FusedLoc>()) {
95 if (fusedLoc.getMetadata() == metadata) {
98 decomposedLocs.insert(fusedLoc.getLocations().begin(),
99 fusedLoc.getLocations().end());
104 if (!loc.isa<UnknownLoc>())
105 decomposedLocs.insert(loc);
107 locs = decomposedLocs.getArrayRef();
113 return UnknownLoc::get(context);
119 if (locs.size() == 1 && !metadata)
122 return Base::get(context, locs, metadata);
Include the generated interface declarations.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Attributes are known-constant values of operations.
static WalkResult advance()
static WalkResult interrupt()
A utility result that is used to signal how to proceed with an ongoing walk:
static bool classof(Attribute attr)
Methods for support type inquiry through isa, cast, and dyn_cast.
MLIRContext is the top-level object for a collection of MLIR operations.
WalkResult walk(function_ref< WalkResult(Location)> walkFn)
Walk all of the locations nested under, and including, the current.