blob: d72b84549c88f052fe212048dcd0ee63dd11e445 [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
Chris Lattner2ccb73b2007-06-16 00:16:26 +000017#include "CodeGenTypes.h"
18
Chris Lattnerf97fe382007-05-24 06:29:05 +000019namespace llvm {
20 class Module;
Chris Lattner2052bc82007-06-16 00:12:05 +000021 class Constant;
Chris Lattner23b7eb62007-06-15 23:05:46 +000022}
23
Chris Lattnerf97fe382007-05-24 06:29:05 +000024namespace clang {
25 class ASTContext;
26 class FunctionDecl;
Chris Lattner2052bc82007-06-16 00:12:05 +000027 class Decl;
Chris Lattnerf97fe382007-05-24 06:29:05 +000028
29namespace CodeGen {
30
Chris Lattnerbed31442007-05-28 01:07:47 +000031/// CodeGenModule - This class organizes the cross-module state that is used
32/// while generating LLVM code.
33class CodeGenModule {
Chris Lattnerf97fe382007-05-24 06:29:05 +000034 ASTContext &Context;
Chris Lattner23b7eb62007-06-15 23:05:46 +000035 llvm::Module &TheModule;
Chris Lattner2ccb73b2007-06-16 00:16:26 +000036 CodeGenTypes Types;
37
Chris Lattner2052bc82007-06-16 00:12:05 +000038 //llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
Chris Lattnerf97fe382007-05-24 06:29:05 +000039public:
Chris Lattner2ccb73b2007-06-16 00:16:26 +000040 CodeGenModule(ASTContext &C, llvm::Module &M);
Chris Lattnerf97fe382007-05-24 06:29:05 +000041
Chris Lattnerd1af2d22007-05-29 23:17:50 +000042 ASTContext &getContext() const { return Context; }
Chris Lattner23b7eb62007-06-15 23:05:46 +000043 llvm::Module &getModule() const { return TheModule; }
Chris Lattner2ccb73b2007-06-16 00:16:26 +000044 CodeGenTypes &getTypes() { return Types; }
Chris Lattnerd1af2d22007-05-29 23:17:50 +000045
Chris Lattnerbed31442007-05-28 01:07:47 +000046 void EmitFunction(FunctionDecl *FD);
Chris Lattnerf97fe382007-05-24 06:29:05 +000047
48 void PrintStats() {}
Chris Lattnerf97fe382007-05-24 06:29:05 +000049};
50} // end namespace CodeGen
51} // end namespace clang
Chris Lattnerf97fe382007-05-24 06:29:05 +000052
53#endif