14 #include "PassDetail.h" 21 struct SymbolPrivatize :
public SymbolPrivatizeBase<SymbolPrivatize> {
24 void runOnOperation()
override;
32 exclude = excludeSymbols;
36 for (
const std::string &symbol : exclude)
37 excludedSymbols.insert(StringAttr::get(context, symbol));
41 void SymbolPrivatize::runOnOperation() {
42 for (
Region ®ion : getOperation()->getRegions()) {
43 for (
Block &block : region) {
45 auto symbol = dyn_cast<SymbolOpInterface>(op);
48 if (!excludedSymbols.contains(symbol.getNameAttr()))
57 return std::make_unique<SymbolPrivatize>(exclude);
Include the generated interface declarations.
This class contains a list of basic blocks and a link to the parent operation it is attached to...
Operation is a basic unit of execution within MLIR.
Block represents an ordered list of Operations.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
This class represents an efficient way to signal success or failure.
The symbol is private and may only be referenced by SymbolRefAttrs local to the operations within the...
std::unique_ptr< Pass > createSymbolPrivatizePass(ArrayRef< std::string > excludeSymbols={})
Creates a pass which marks top-level symbol operations as private unless listed in excludeSymbols...
MLIRContext is the top-level object for a collection of MLIR operations.