blob: 448d0f17f861486aad815a8eb5bc62270ddad232 [file] [log] [blame]
Chris Lattnerbed31442007-05-28 01:07:47 +00001//===--- CodeGenModule.h - Per-Module state for LLVM CodeGen --------------===//
Chris Lattnerf97fe382007-05-24 06:29:05 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This is the internal per-translation-unit state used for llvm translation.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattnerbed31442007-05-28 01:07:47 +000014#ifndef CODEGEN_CODEGENMODULE_H
15#define CODEGEN_CODEGENMODULE_H
Chris Lattnerf97fe382007-05-24 06:29:05 +000016
17namespace llvm {
18 class Module;
Chris Lattner2052bc82007-06-16 00:12:05 +000019 class Constant;
Chris Lattner23b7eb62007-06-15 23:05:46 +000020}
21
Chris Lattnerf97fe382007-05-24 06:29:05 +000022namespace clang {
23 class ASTContext;
24 class FunctionDecl;
Chris Lattner2052bc82007-06-16 00:12:05 +000025 class Decl;
Chris Lattnerf97fe382007-05-24 06:29:05 +000026
27namespace CodeGen {
28
Chris Lattnerbed31442007-05-28 01:07:47 +000029/// CodeGenModule - This class organizes the cross-module state that is used
30/// while generating LLVM code.
31class CodeGenModule {
Chris Lattnerf97fe382007-05-24 06:29:05 +000032 ASTContext &Context;
Chris Lattner23b7eb62007-06-15 23:05:46 +000033 llvm::Module &TheModule;
Chris Lattner2052bc82007-06-16 00:12:05 +000034
35 //llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
Chris Lattnerf97fe382007-05-24 06:29:05 +000036public:
Chris Lattner23b7eb62007-06-15 23:05:46 +000037 CodeGenModule(ASTContext &C, llvm::Module &M) : Context(C), TheModule(M) {}
Chris Lattnerf97fe382007-05-24 06:29:05 +000038
Chris Lattnerd1af2d22007-05-29 23:17:50 +000039 ASTContext &getContext() const { return Context; }
Chris Lattner23b7eb62007-06-15 23:05:46 +000040 llvm::Module &getModule() const { return TheModule; }
Chris Lattnerd1af2d22007-05-29 23:17:50 +000041
Chris Lattnerbed31442007-05-28 01:07:47 +000042 void EmitFunction(FunctionDecl *FD);
Chris Lattnerf97fe382007-05-24 06:29:05 +000043
44 void PrintStats() {}
Chris Lattnerf97fe382007-05-24 06:29:05 +000045};
46} // end namespace CodeGen
47} // end namespace clang
Chris Lattnerf97fe382007-05-24 06:29:05 +000048
49#endif