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