Lines Matching refs:ast
41 void generate(const ast::Module &astModule, ModuleOp module);
49 void generateConstraintAndRewrites(const ast::Module &astModule,
52 void generate(const ast::UserConstraintDecl *decl,
54 void generate(const ast::UserRewriteDecl *decl, StringSet<> &nativeFunctions);
55 void generateConstraintOrRewrite(const ast::CallableDecl *decl,
60 StringRef getNativeTypeName(ast::Type type);
63 StringRef getNativeTypeName(ast::VariableDecl *decl);
70 void CodeGen::generate(const ast::Module &astModule, ModuleOp module) { in generate()
134 void CodeGen::generateConstraintAndRewrites(const ast::Module &astModule, in generateConstraintAndRewrites()
146 for (const ast::Decl *decl : astModule.getChildren()) { in generateConstraintAndRewrites()
147 TypeSwitch<const ast::Decl *>(decl) in generateConstraintAndRewrites()
148 .Case<ast::UserConstraintDecl, ast::UserRewriteDecl>( in generateConstraintAndRewrites()
159 void CodeGen::generate(const ast::UserConstraintDecl *decl, in generate()
161 return generateConstraintOrRewrite(cast<ast::CallableDecl>(decl), in generate()
165 void CodeGen::generate(const ast::UserRewriteDecl *decl, in generate()
167 return generateConstraintOrRewrite(cast<ast::CallableDecl>(decl), in generate()
171 StringRef CodeGen::getNativeTypeName(ast::Type type) { in getNativeTypeName()
172 return llvm::TypeSwitch<ast::Type, StringRef>(type) in getNativeTypeName()
173 .Case([&](ast::AttributeType) { return "::mlir::Attribute"; }) in getNativeTypeName()
174 .Case([&](ast::OperationType opType) -> StringRef { in getNativeTypeName()
180 .Case([&](ast::TypeType) { return "::mlir::Type"; }) in getNativeTypeName()
181 .Case([&](ast::ValueType) { return "::mlir::Value"; }) in getNativeTypeName()
182 .Case([&](ast::TypeRangeType) { return "::mlir::TypeRange"; }) in getNativeTypeName()
183 .Case([&](ast::ValueRangeType) { return "::mlir::ValueRange"; }); in getNativeTypeName()
186 StringRef CodeGen::getNativeTypeName(ast::VariableDecl *decl) { in getNativeTypeName()
188 for (ast::ConstraintRef &cst : decl->getConstraints()) { in getNativeTypeName()
189 if (auto *userCst = dyn_cast<ast::UserConstraintDecl>(cst.constraint)) { in getNativeTypeName()
200 void CodeGen::generateConstraintOrRewrite(const ast::CallableDecl *decl, in generateConstraintOrRewrite()
220 ArrayRef<ast::VariableDecl *> results = decl->getResults(); in generateConstraintOrRewrite()
227 llvm::interleaveComma(results, os, [&](ast::VariableDecl *result) { in generateConstraintOrRewrite()
237 llvm::interleaveComma(decl->getInputs(), os, [&](ast::VariableDecl *input) { in generateConstraintOrRewrite()
249 void mlir::pdll::codegenPDLLToCPP(const ast::Module &astModule, ModuleOp module, in codegenPDLLToCPP()