blob: d58f90d2560c236f756ed75cc5c92d7b42ebc521 [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 Lattner23b7eb62007-06-15 23:05:46 +000019}
20
Chris Lattnerf97fe382007-05-24 06:29:05 +000021namespace clang {
22 class ASTContext;
23 class FunctionDecl;
24
25namespace CodeGen {
26
Chris Lattnerbed31442007-05-28 01:07:47 +000027/// CodeGenModule - This class organizes the cross-module state that is used
28/// while generating LLVM code.
29class CodeGenModule {
Chris Lattnerf97fe382007-05-24 06:29:05 +000030 ASTContext &Context;
Chris Lattner23b7eb62007-06-15 23:05:46 +000031 llvm::Module &TheModule;
Chris Lattnerf97fe382007-05-24 06:29:05 +000032public:
Chris Lattner23b7eb62007-06-15 23:05:46 +000033 CodeGenModule(ASTContext &C, llvm::Module &M) : Context(C), TheModule(M) {}
Chris Lattnerf97fe382007-05-24 06:29:05 +000034
Chris Lattnerd1af2d22007-05-29 23:17:50 +000035 ASTContext &getContext() const { return Context; }
Chris Lattner23b7eb62007-06-15 23:05:46 +000036 llvm::Module &getModule() const { return TheModule; }
Chris Lattnerd1af2d22007-05-29 23:17:50 +000037
Chris Lattnerbed31442007-05-28 01:07:47 +000038 void EmitFunction(FunctionDecl *FD);
Chris Lattnerf97fe382007-05-24 06:29:05 +000039
40 void PrintStats() {}
Chris Lattnerf97fe382007-05-24 06:29:05 +000041};
42} // end namespace CodeGen
43} // end namespace clang
Chris Lattnerf97fe382007-05-24 06:29:05 +000044
45#endif