mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 08:31:13 +00:00
[MLIR] Add setPublic(), setPrivate(), and setNested() to Symbol interface
- Add shorter helper functions to set visibility for Symbols. Differential Revision: https://reviews.llvm.org/D91096
This commit is contained in:
parent
8d51969bd4
commit
64be856f6d
@ -172,7 +172,7 @@ private:
|
||||
|
||||
// If this function isn't main, then set the visibility to private.
|
||||
if (funcAST.getProto()->getName() != "main")
|
||||
function.setVisibility(mlir::FuncOp::Visibility::Private);
|
||||
function.setPrivate();
|
||||
|
||||
return function;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ private:
|
||||
|
||||
// If this function isn't main, then set the visibility to private.
|
||||
if (funcAST.getProto()->getName() != "main")
|
||||
function.setVisibility(mlir::FuncOp::Visibility::Private);
|
||||
function.setPrivate();
|
||||
|
||||
return function;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ private:
|
||||
|
||||
// If this function isn't main, then set the visibility to private.
|
||||
if (funcAST.getProto()->getName() != "main")
|
||||
function.setVisibility(mlir::FuncOp::Visibility::Private);
|
||||
function.setPrivate();
|
||||
|
||||
return function;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ private:
|
||||
|
||||
// If this function isn't main, then set the visibility to private.
|
||||
if (funcAST.getProto()->getName() != "main")
|
||||
function.setVisibility(mlir::FuncOp::Visibility::Private);
|
||||
function.setPrivate();
|
||||
|
||||
return function;
|
||||
}
|
||||
|
@ -53,12 +53,6 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
|
||||
return mlir::SymbolTable::getSymbolVisibility(this->getOperation());
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Sets the visibility of this symbol.",
|
||||
"void", "setVisibility", (ins "mlir::SymbolTable::Visibility":$vis), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Returns true if this symbol has nested visibility.",
|
||||
"bool", "isNested", (ins), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
@ -77,6 +71,30 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
|
||||
return getVisibility() == mlir::SymbolTable::Visibility::Public;
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Sets the visibility of this symbol.",
|
||||
"void", "setVisibility", (ins "mlir::SymbolTable::Visibility":$vis), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Sets the visibility of this symbol to be nested.",
|
||||
"void", "setNested", (ins), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
setVisibility(mlir::SymbolTable::Visibility::Nested);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Sets the visibility of this symbol to be private.",
|
||||
"void", "setPrivate", (ins), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
setVisibility(mlir::SymbolTable::Visibility::Private);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<"Sets the visibility of this symbol to be public.",
|
||||
"void", "setPublic", (ins), [{}],
|
||||
/*defaultImplementation=*/[{
|
||||
setVisibility(mlir::SymbolTable::Visibility::Public);
|
||||
}]
|
||||
>,
|
||||
InterfaceMethod<[{
|
||||
Get all of the uses of the current symbol that are nested within the
|
||||
given operation 'from'.
|
||||
|
Loading…
Reference in New Issue
Block a user