Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:51

0001 //===---- CIRGenAction.h - CIR Code Generation Frontend Action -*- C++ -*--===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_CIR_CIRGENACTION_H
0010 #define LLVM_CLANG_CIR_CIRGENACTION_H
0011 
0012 #include "clang/Frontend/FrontendAction.h"
0013 
0014 #include "mlir/IR/BuiltinOps.h"
0015 #include "mlir/IR/OwningOpRef.h"
0016 
0017 namespace mlir {
0018 class MLIRContext;
0019 class ModuleOp;
0020 } // namespace mlir
0021 
0022 namespace cir {
0023 class CIRGenConsumer;
0024 
0025 class CIRGenAction : public clang::ASTFrontendAction {
0026 public:
0027   enum class OutputType {
0028     EmitCIR,
0029   };
0030 
0031 private:
0032   friend class CIRGenConsumer;
0033 
0034   mlir::OwningOpRef<mlir::ModuleOp> MLIRMod;
0035 
0036   mlir::MLIRContext *MLIRCtx;
0037 
0038 protected:
0039   CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx = nullptr);
0040 
0041   std::unique_ptr<clang::ASTConsumer>
0042   CreateASTConsumer(clang::CompilerInstance &CI,
0043                     llvm::StringRef InFile) override;
0044 
0045 public:
0046   ~CIRGenAction() override;
0047 
0048   OutputType Action;
0049 };
0050 
0051 class EmitCIRAction : public CIRGenAction {
0052   virtual void anchor();
0053 
0054 public:
0055   EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
0056 };
0057 
0058 } // namespace cir
0059 
0060 #endif