clang
20.0.0git
include
clang
CIR
CIRGenerator.h
Go to the documentation of this file.
1
//===- CIRGenerator.h - CIR Generation from Clang AST ---------------------===//
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
// This file declares a simple interface to perform CIR generation from Clang
10
// AST
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_CIR_CIRGENERATOR_H
15
#define LLVM_CLANG_CIR_CIRGENERATOR_H
16
17
#include "
clang/AST/ASTConsumer.h
"
18
#include "
clang/Basic/CodeGenOptions.h
"
19
20
#include "llvm/ADT/IntrusiveRefCntPtr.h"
21
#include "llvm/Support/VirtualFileSystem.h"
22
23
#include <memory>
24
25
namespace
clang
{
26
class
DeclGroupRef;
27
class
DiagnosticsEngine;
28
namespace
CIRGen {
29
class
CIRGenModule
;
30
}
// namespace CIRGen
31
}
// namespace clang
32
33
namespace
mlir
{
34
class
MLIRContext;
35
}
// namespace mlir
36
namespace
cir
{
37
class
CIRGenerator
:
public
clang::ASTConsumer
{
38
virtual
void
anchor();
39
clang::DiagnosticsEngine
&diags;
40
clang::ASTContext
*astContext;
41
// Only used for debug info.
42
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
fs;
43
44
const
clang::CodeGenOptions
&codeGenOpts;
45
46
protected
:
47
std::unique_ptr<mlir::MLIRContext>
mlirContext
;
48
std::unique_ptr<clang::CIRGen::CIRGenModule>
cgm
;
49
50
public
:
51
CIRGenerator
(
clang::DiagnosticsEngine
&diags,
52
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>
fs,
53
const
clang::CodeGenOptions
&cgo);
54
~CIRGenerator
()
override
;
55
void
Initialize
(
clang::ASTContext
&astContext)
override
;
56
bool
HandleTopLevelDecl
(
clang::DeclGroupRef
group)
override
;
57
mlir::ModuleOp
getModule
()
const
;
58
};
59
60
}
// namespace cir
61
62
#endif
// LLVM_CLANG_CIR_CIRGENERATOR_H
ASTConsumer.h
CodeGenOptions.h
cir::CIRGenerator
Definition:
CIRGenerator.h:37
cir::CIRGenerator::getModule
mlir::ModuleOp getModule() const
Definition:
CIRGenerator.cpp:43
cir::CIRGenerator::cgm
std::unique_ptr< clang::CIRGen::CIRGenModule > cgm
Definition:
CIRGenerator.h:48
cir::CIRGenerator::~CIRGenerator
~CIRGenerator() override
cir::CIRGenerator::HandleTopLevelDecl
bool HandleTopLevelDecl(clang::DeclGroupRef group) override
HandleTopLevelDecl - Handle the specified top-level declaration.
Definition:
CIRGenerator.cpp:45
cir::CIRGenerator::mlirContext
std::unique_ptr< mlir::MLIRContext > mlirContext
Definition:
CIRGenerator.h:47
cir::CIRGenerator::Initialize
void Initialize(clang::ASTContext &astContext) override
Initialize - This is called to initialize the consumer, providing the ASTContext.
Definition:
CIRGenerator.cpp:32
clang::ASTConsumer
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition:
ASTConsumer.h:34
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:188
clang::CIRGen::CIRGenModule
This class organizes the cross-function state that is used while generating CIR code.
Definition:
CIRGenModule.h:39
clang::CodeGenOptions
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Definition:
CodeGenOptions.h:56
clang::DeclGroupRef
Definition:
DeclGroup.h:51
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition:
Diagnostic.h:231
llvm::IntrusiveRefCntPtr
Definition:
LLVM.h:43
cir
Definition:
CIRGenerator.h:36
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
mlir
Definition:
CIRGenerator.h:33
Generated on Sat Dec 28 2024 22:20:06 for clang by
1.9.6