Skip to content

Commit

Permalink
core: Add symbol reference attr contraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Jan 10, 2025
1 parent 7068fe6 commit 2692986
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions include/vast/Dialect/Core/CommonAttrConstraints.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,75 @@ def Core_VarSymbolRefAttr : Attr<
let convertFromStorage = "$_self.getValue()";
}

def Core_TypeSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::TypeSymbolRefAttr >($_self)" >,
"type symbol reference attribute"
> {
let storageType = [{ ::vast::core::TypeSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}

def Core_FuncSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::FuncSymbolRefAttr >($_self)" >,
"function symbol reference attribute"
> {
let storageType = [{ ::vast::core::FuncSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}

def Core_LabelSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::LabelSymbolRefAttr >($_self)" >,
"label symbol reference attribute"
> {
let storageType = [{ ::vast::core::LabelSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}

def Core_EnumConstantSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::EnumConstantSymbolRefAttr >($_self)" >,
"enum constant symbol reference attribute"
> {
let storageType = [{ ::vast::core::EnumConstantSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}

def Core_MemberVarSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::MemberVarSymbolRefAttr >($_self)" >,
"member variable symbol reference attribute"
> {
let storageType = [{ ::vast::core::MemberVarSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}

def Core_ElaboratedTypeSymbolRefAttr : Attr<
CPred< "::llvm::isa< ::vast::core::ElaboratedTypeSymbolRefAttr >($_self)" >,
"elaborated type symbol reference attribute"
> {
let storageType = [{ ::vast::core::ElaboratedTypeSymbolRefAttr }];
let returnType = [{ ::llvm::StringRef }];
let valueType = NoneType;
let constBuilderCall =
"::mlir::SymbolRefAttr::get($_builder.getContext(), $0)";
let convertFromStorage = "$_self.getValue()";
}
#endif // VAST_DIALECT_CORE_COMMON_ATTR_CONSTRAINTS_TD

0 comments on commit 2692986

Please sign in to comment.