|
| 1 | +//===--- CIRGenModule.h - Per-Module state for CIR gen ----------*- 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 | +// This is the internal per-translation-unit state used for CIR translation. |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +#ifndef LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENMODULE_H |
| 14 | +#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENMODULE_H |
| 15 | + |
| 16 | +#include "CIRGenTypeCache.h" |
| 17 | + |
| 18 | +#include "mlir/IR/BuiltinOps.h" |
| 19 | +#include "mlir/IR/MLIRContext.h" |
| 20 | + |
| 21 | +namespace clang { |
| 22 | +class ASTContext; |
| 23 | +class CodeGenOptions; |
| 24 | +class Decl; |
| 25 | +class DiagnosticsEngine; |
| 26 | +class LangOptions; |
| 27 | +class TargetInfo; |
| 28 | +} // namespace clang |
| 29 | + |
| 30 | +using namespace clang; |
| 31 | +namespace cir { |
| 32 | + |
| 33 | +/// This class organizes the cross-function state that is used while generating |
| 34 | +/// CIR code. |
| 35 | +class CIRGenModule : public CIRGenTypeCache { |
| 36 | + CIRGenModule(CIRGenModule &) = delete; |
| 37 | + CIRGenModule &operator=(CIRGenModule &) = delete; |
| 38 | + |
| 39 | +public: |
| 40 | + CIRGenModule(mlir::MLIRContext &context, clang::ASTContext &astctx, |
| 41 | + const clang::CodeGenOptions &cgo, |
| 42 | + clang::DiagnosticsEngine &diags); |
| 43 | + |
| 44 | + ~CIRGenModule() = default; |
| 45 | + |
| 46 | +private: |
| 47 | + /// Hold Clang AST information. |
| 48 | + clang::ASTContext &astCtx; |
| 49 | + |
| 50 | + const clang::LangOptions &langOpts; |
| 51 | + |
| 52 | + /// A "module" matches a c/cpp source file: containing a list of functions. |
| 53 | + mlir::ModuleOp theModule; |
| 54 | + |
| 55 | + const clang::TargetInfo ⌖ |
| 56 | + |
| 57 | +public: |
| 58 | + void buildTopLevelDecl(clang::Decl *decl); |
| 59 | +}; |
| 60 | +} // namespace cir |
| 61 | + |
| 62 | +#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENMODULE_H |
0 commit comments