clang 22.0.0git
CIRGenAction.h
Go to the documentation of this file.
1//===---- CIRGenAction.h - CIR Code Generation Frontend Action -*- C++ -*--===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_CIR_CIRGENACTION_H
10#define LLVM_CLANG_CIR_CIRGENACTION_H
11
13
14#include "mlir/IR/BuiltinOps.h"
15#include "mlir/IR/OwningOpRef.h"
16
17namespace mlir {
18class MLIRContext;
19class ModuleOp;
20} // namespace mlir
21
22namespace cir {
23class CIRGenConsumer;
24
26public:
27 enum class OutputType {
29 EmitCIR,
31 EmitBC,
32 EmitObj,
33 };
34
35private:
36 friend class CIRGenConsumer;
37
38 mlir::OwningOpRef<mlir::ModuleOp> MLIRMod;
39
40 mlir::MLIRContext *MLIRCtx;
41
42protected:
43 CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx = nullptr);
44
45 std::unique_ptr<clang::ASTConsumer>
47 llvm::StringRef InFile) override;
48
49public:
50 ~CIRGenAction() override;
51
53};
54
56 virtual void anchor();
57
58public:
59 EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
60};
61
63 virtual void anchor();
64
65public:
66 EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
67};
68
69class EmitBCAction : public CIRGenAction {
70 virtual void anchor();
71
72public:
73 EmitBCAction(mlir::MLIRContext *MLIRCtx = nullptr);
74};
75
77 virtual void anchor();
78
79public:
80 EmitAssemblyAction(mlir::MLIRContext *MLIRCtx = nullptr);
81};
82
84 virtual void anchor();
85
86public:
87 EmitObjAction(mlir::MLIRContext *MLIRCtx = nullptr);
88};
89
90} // namespace cir
91
92#endif
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
OutputType Action
Definition: CIRGenAction.h:52
~CIRGenAction() override
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &CI, llvm::StringRef InFile) override
Abstract base class to use for AST consumer-based frontend actions.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Definition: ABIArgInfo.h:22