|
15 | 15 | #define BUILTIN_ATTRIBUTES |
16 | 16 |
|
17 | 17 | include "mlir/IR/AttrTypeBase.td" |
| 18 | +include "mlir/IR/EnumAttr.td" |
18 | 19 | include "mlir/IR/BuiltinDialect.td" |
19 | 20 | include "mlir/IR/BuiltinAttributeInterfaces.td" |
20 | 21 | include "mlir/IR/OpAsmInterface.td" |
@@ -1202,6 +1203,47 @@ def Builtin_SymbolRefAttr : Builtin_Attr<"SymbolRef", "symbol_ref"> { |
1202 | 1203 | let skipDefaultBuilders = 1; |
1203 | 1204 | } |
1204 | 1205 |
|
| 1206 | +//===----------------------------------------------------------------------===// |
| 1207 | +// SymbolVisibilityAttr |
| 1208 | +//===----------------------------------------------------------------------===// |
| 1209 | + |
| 1210 | +def Builtin_SymbolVisibilityAttr : I32EnumAttr< |
| 1211 | + "SymbolVisibility", "sym_visibility", [ |
| 1212 | + I32EnumAttrCase<"Public", 0, "public">, |
| 1213 | + I32EnumAttrCase<"Private", 1, "private">, |
| 1214 | + I32EnumAttrCase<"Nested", 2, "nested"> |
| 1215 | +]> { |
| 1216 | + let summary = "An Attribute representing the visibility of a symbol"; |
| 1217 | + let description = [{ |
| 1218 | + Syntax: |
| 1219 | + |
| 1220 | + ``` |
| 1221 | + symbol-visibility-attribute ::= `public` | `private` | `nested` |
| 1222 | + ``` |
| 1223 | + |
| 1224 | + The visibility of a symbol defines its structural reachability within the |
| 1225 | + IR. A symbol has one of the following visibilities: |
| 1226 | + |
| 1227 | + - Public (Default): The symbol may be referenced from outside of the visible |
| 1228 | + IR. We cannot assume that all of the uses of this symbol are observable. If |
| 1229 | + the operation declares a symbol (as opposed to defining it), public |
| 1230 | + visibility is not allowed because symbol declarations are not intended to be |
| 1231 | + used from outside the visible IR. |
| 1232 | + |
| 1233 | + - Private: The symbol may only be referenced from within the current symbol |
| 1234 | + table. |
| 1235 | + |
| 1236 | + - Nested: The symbol may be referenced by operations outside of the current |
| 1237 | + symbol table, but not outside of the visible IR, as long as each symbol |
| 1238 | + table parent also defines a non-private symbol. |
| 1239 | + |
| 1240 | + See [`Symbols And SymbolTables`](../SymbolsAndSymbolTables.md) for more |
| 1241 | + information. |
| 1242 | + }]; |
| 1243 | + |
| 1244 | + let cppNamespace = "mlir"; |
| 1245 | +} |
| 1246 | + |
1205 | 1247 | //===----------------------------------------------------------------------===// |
1206 | 1248 | // TypeAttr |
1207 | 1249 | //===----------------------------------------------------------------------===// |
|
0 commit comments