clang 23.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
14#include "llvm/ADT/SmallVector.h"
15
16#include "mlir/IR/BuiltinOps.h"
17#include "mlir/IR/OwningOpRef.h"
18
19namespace llvm {
20class LLVMContext;
21} // namespace llvm
22
23namespace mlir {
24class MLIRContext;
25class ModuleOp;
26} // namespace mlir
27
28namespace cir {
29class CIRGenConsumer;
30
32public:
40
41private:
42 friend class CIRGenConsumer;
43
44 mlir::OwningOpRef<mlir::ModuleOp> MLIRMod;
45
46 mlir::MLIRContext *MLIRCtx;
47
48 std::unique_ptr<llvm::LLVMContext> Ctx;
50
51protected:
52 CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx = nullptr);
53
55
56 std::unique_ptr<clang::ASTConsumer>
58 llvm::StringRef InFile) override;
59
60public:
61 ~CIRGenAction() override;
62
64};
65
67 virtual void anchor();
68
69public:
70 EmitCIRAction(mlir::MLIRContext *MLIRCtx = nullptr);
71};
72
74 virtual void anchor();
75
76public:
77 EmitLLVMAction(mlir::MLIRContext *MLIRCtx = nullptr);
78};
79
80class EmitBCAction : public CIRGenAction {
81 virtual void anchor();
82
83public:
84 EmitBCAction(mlir::MLIRContext *MLIRCtx = nullptr);
85};
86
88 virtual void anchor();
89
90public:
91 EmitAssemblyAction(mlir::MLIRContext *MLIRCtx = nullptr);
92};
93
95 virtual void anchor();
96
97public:
98 EmitObjAction(mlir::MLIRContext *MLIRCtx = nullptr);
99};
100
101} // namespace cir
102
103#endif
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
CIRGenAction(OutputType Action, mlir::MLIRContext *MLIRCtx=nullptr)
OutputType Action
bool BeginSourceFileAction(clang::CompilerInstance &CI) override
Callback at the start of processing a single input.
~CIRGenAction() override
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &CI, llvm::StringRef InFile) override
friend class CIRGenConsumer
EmitAssemblyAction(mlir::MLIRContext *MLIRCtx=nullptr)
EmitBCAction(mlir::MLIRContext *MLIRCtx=nullptr)
EmitCIRAction(mlir::MLIRContext *MLIRCtx=nullptr)
EmitLLVMAction(mlir::MLIRContext *MLIRCtx=nullptr)
EmitObjAction(mlir::MLIRContext *MLIRCtx=nullptr)
Abstract base class to use for AST consumer-based frontend actions.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30